From 511120a0b6d7d5a48425a23dfc4f78f34c84bc5b Mon Sep 17 00:00:00 2001 From: tglozar Date: Mon, 10 Jan 2022 09:07:21 +0000 Subject: [PATCH] * improved plan9port cross-compilation to fully build --- .../plan9port/cross-disable-web-manual.patch | 24 ++++++++ package/emulators/plan9port/cross.patch | 69 ++++++++++++++++------ package/emulators/plan9port/plan9port.conf | 39 ++++++++---- package/emulators/plan9port/plan9port.desc | 1 + 4 files changed, 104 insertions(+), 29 deletions(-) create mode 100644 package/emulators/plan9port/cross-disable-web-manual.patch diff --git a/package/emulators/plan9port/cross-disable-web-manual.patch b/package/emulators/plan9port/cross-disable-web-manual.patch new file mode 100644 index 0000000000..cc23f8395c --- /dev/null +++ b/package/emulators/plan9port/cross-disable-web-manual.patch @@ -0,0 +1,24 @@ +# --- T2-COPYRIGHT-NOTE-BEGIN --- +# T2 SDE: package/*/plan9port/cross-disable-web-manual.patch +# Copyright (C) 2022 The T2 SDE Project +# +# This Copyright note is generated by scripts/Create-CopyPatch, +# more information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License version 2 as used by the T2 SDE. +# --- T2-COPYRIGHT-NOTE-END --- + +--- plan9port-d0d4408/INSTALL.vanilla 2022-01-09 18:18:09.495000000 +0100 ++++ plan9port-d0d4408/INSTALL 2022-01-09 18:18:57.263000000 +0100 +@@ -184,7 +184,7 @@ + cd $PLAN9 + sh lib/moveplan9.sh + echo "* Building web manual..." +- ( ++ [ "$PLAN9" -eq "$HOSTPLAN9" ] && ( + cd $PLAN9/dist + echo cd `pwd`';' mk man + mk man diff --git a/package/emulators/plan9port/cross.patch b/package/emulators/plan9port/cross.patch index 6d1c7ff38b..6d04baaddf 100644 --- a/package/emulators/plan9port/cross.patch +++ b/package/emulators/plan9port/cross.patch @@ -11,36 +11,37 @@ # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- ---- plan9port-d0d4408/INSTALL.vanilla 2021-10-19 18:08:45.000000000 +0200 -+++ plan9port-d0d4408/INSTALL 2022-01-08 11:40:25.741000000 +0100 -@@ -99,6 +99,11 @@ - rm -f ./a.out - fi +--- plan9port-d0d4408/INSTALL.vanilla 2022-01-09 18:35:54.589000000 +0100 ++++ plan9port-d0d4408/INSTALL 2022-01-09 18:36:13.447000000 +0100 +@@ -31,7 +31,13 @@ + rm -f config + PLAN9=`pwd` export PLAN9 +-PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH ++ +if [ -z "$HOSTPLAN9" ]; then -+ # Native compiling, set HOSTPLAN9 to PLAN9 -+ HOSTPLAN9="$PLAN9" ++ # Native compiling, set HOSTPLAN9 to PLAN9 ++ export HOSTPLAN9="$PLAN9" +fi + - if [ `uname` != Darwin ]; then - # Determine whether fontsrv X11 files are available. - rm -f a.out -@@ -127,12 +132,17 @@ ++PATH=/bin:/usr/bin:$HOSTPLAN9/bin:$PLAN9/bin:$PATH export PATH + case `uname` in + SunOS) + awk=nawk +@@ -127,12 +133,14 @@ cd src if $dobuild; then - echo "* Building mk..." - ../dist/buildmk 2>&1 | sed 's/^[+] //' -+ if [ -e "$HOSTPLAN9/bin/mk" ]; then -+ # Cross-compiling, Use host make -+ PATH=$PATH:$HOSTPLAN9/bin -+ else -+ echo "* Building mk..." -+ ../dist/buildmk 2>&1 | sed 's/^[+] //' - +- - if [ ! -x ../bin/mk ]; then - echo "* Error: mk failed to build." - exit 1 ++ if [ ! -e "$HOSTPLAN9/bin/mk" ]; then ++ echo "* Building mk..." ++ ../dist/buildmk 2>&1 | sed 's/^[+] //' ++ + if [ ! -x ../bin/mk ]; then + echo "* Error: mk failed to build." + exit 1 @@ -48,3 +49,35 @@ fi echo "* Building everything (be patient)..." +--- plan9port-d0d4408/src/cmd/awk/mkfile.vanilla 2022-01-09 11:12:50.334000000 +0100 ++++ plan9port-d0d4408/src/cmd/awk/mkfile 2022-01-09 11:58:39.322000000 +0100 +@@ -29,7 +29,7 @@ + ./$O.maketab >proctab.c + + maketab.$O: maketab.c +- $CC $CFLAGS maketab.c ++ PLAN9=$HOSTPLAN9 CC9=$HOSTCC $CC $CFLAGS maketab.c + + $O.maketab:V: y.tab.h maketab.$O +- $LD -o $O.maketab maketab.$O ++ PLAN9=$HOSTPLAN9 CC9=$HOSTCC $LD -o $O.maketab maketab.$O +--- plan9port-d0d4408/src/cmd/jpg/mkfile.vanilla 2022-01-09 16:01:44.661000000 +0100 ++++ plan9port-d0d4408/src/cmd/jpg/mkfile 2022-01-09 16:01:18.174000000 +0100 +@@ -34,13 +34,13 @@ + torgbv.$O: ycbcr.h rgbv.h + + ycbcr.h: rgbycc.c +- 9c rgbycc.c +- 9l -o o.rgbycc rgbycc.o -ldraw -l9 ++ PLAN9=$HOSTPLAN9 CC9=$HOSTCC 9c rgbycc.c ++ PLAN9=$HOSTPLAN9 CC9=$HOSTCC 9l -o o.rgbycc rgbycc.o -ldraw -l9 + ./o.rgbycc >ycbcr.h + + rgbv.h: rgbrgbv.c +- 9c rgbrgbv.c +- 9l -o o.rgbrgbv rgbrgbv.o -ldraw -l9 ++ PLAN9=$HOSTPLAN9 CC9=$HOSTCC 9c rgbrgbv.c ++ PLAN9=$HOSTPLAN9 CC9=$HOSTCC 9l -o o.rgbrgbv rgbrgbv.o -ldraw -l9 + ./o.rgbrgbv >rgbv.h + + nuke:V: nuke-headers diff --git a/package/emulators/plan9port/plan9port.conf b/package/emulators/plan9port/plan9port.conf index 4546c04308..369bfad8ab 100644 --- a/package/emulators/plan9port/plan9port.conf +++ b/package/emulators/plan9port/plan9port.conf @@ -21,33 +21,47 @@ configure() { var_append CC9FLAGS ' ' "$CFLAGS" var_append CC9FLAGS ' ' "$CPPFLAGS" + var_append CC9FLAGS ' ' "$LDFLAGS" echo "CC9FLAGS='$CC9FLAGS'" >> LOCAL.config echo "CC9='$CC'" >> LOCAL.config echo "LDFLAGS='$LDFLAGS'" >> LOCAL.config if atstage cross; then - # Use cross tools yacc and lex + # Use cross tools yacc, lex and rc + # Note: replacing with just yacc (lex, rc) won't work, since it would conflict with system binaries cp src/mkhdr src/mkhdr.orig sed -i "s%9 yacc%$HOSTPLAN9/bin/yacc%g" src/mkhdr src/cmd/upas/smtp/mkfile sed -i "s%9 lex%$HOSTPLAN9/bin/lex%g" src/mkhdr src/cmd/mkfile src/cmd/tpic/mkfile + sed -i "s%9 rc%PLAN9=$HOSTPLAN9 $HOSTPLAN9/bin/rc%g" man/mkfile dist/mkfile dist/publish fi } build() { if atstage toolchain; then - # Toolchain stage - build mk, yacc and lex + # Toolchain stage - build mk, yacc, lex, rc and cleanname export PLAN9=$PWD export PATH=$PATH:$PLAN9/bin cd src ../dist/buildmk cd cmd mk $PLAN9/bin/yacc + mk $PLAN9/bin/cleanname cd lex mk $PLAN9/bin/lex - cd ../../.. + cd ../rc + mk $PLAN9/bin/rc + cd ../.. + + # Build libdraw and libmux (required for rgbycc) + cd libdraw + mk $PLAN9/lib/libdraw.a + cd ../libmux + mk $PLAN9/lib/libmux.a + cd ../.. else ./INSTALL -r $root/$prefix/plan9port | tee install.log fgrep 'exit status=exit(1)' install.log >/dev/null && exit 1 + fgrep 'exit status=exit(2)' install.log >/dev/null && exit 2 # Fix rc scripts for file in $(find . -type f -executable -exec grep -Iq . {} \; -print) @@ -63,15 +77,18 @@ build() { install() { if atstage toolchain; then - # Install mk, yacc and lex - mkdir -p $root/plan9port/bin - command install bin/mk $root/plan9port/bin/ - command install bin/yacc $root/plan9port/bin/ - command install bin/lex $root/plan9port/bin/ + mkdir -p $root/plan9port/{bin,lib,include} + + # Install mk, yacc, lex, rc, cleanname, 9c and 9l + for cmd in mk yacc lex rc cleanname 9c 9l + do + command install bin/$cmd $root/plan9port/bin/ + done # Install libraries and includes for toolchain compiler - cp -r include/ $root/plan9port/include - cp -r lib/ $root/plan9port/lib + cp -r include/* $root/plan9port/include/ + cp -r lib/* $root/plan9port/lib/ + cp rcmain $root/plan9port/rcmain mkdir -p $root/plan9port/src for file in $(find src/ -maxdepth 1 -type f) do @@ -83,7 +100,7 @@ install() { find . -maxdepth 1 -type f -and ! -name rcmain | xargs rm cp -rv . $root/$prefix/plan9port/ || exit 1 - ln -sf $root/$prefix/plan9port/bin/9 $root$bindir/9 || exit 1 + ln -sf /$prefix/plan9port/bin/9 $root$bindir/9 || exit 1 echo "export PLAN9=/$prefix/plan9port" > $root$sysconfdir/profile.d/plan9port fi } diff --git a/package/emulators/plan9port/plan9port.desc b/package/emulators/plan9port/plan9port.desc index da8d7bfa86..d9e80cd4ec 100644 --- a/package/emulators/plan9port/plan9port.desc +++ b/package/emulators/plan9port/plan9port.desc @@ -22,6 +22,7 @@ [M] Tomas Glozar [C] extra/emulator +[F] CROSS [L] MIT [S] Stable -- 2.11.4.GIT