# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/plan9port/plan9port.conf # Copyright (C) 2021 - 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 program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2. # --- T2-COPYRIGHT-NOTE-END --- if atstage cross; then export HOSTPLAN9=$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/plan9port fi configure() { var_append CPPFLAGS ' ' "-I$root$includedir/freetype2" var_append CPPFLAGS ' ' '-Wno-sizeof-array-div' var_append CPPFLAGS ' ' '-Wno-array-parameter' var_append LDFLAGS ' ' "-L$root/$SDECFG_PKG_X11_PREFIX/${libdir##*/}" 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, 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, 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 ../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) do sed -i "s%#!/usr/local/plan9/bin/rc%#!/$prefix/plan9port/bin/rc%" "$file" done # Revert src/mkhdr changes atstage cross && mv src/mkhdr.orig src/mkhdr true fi } install() { if atstage toolchain; then 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 rcmain $root/plan9port/rcmain mkdir -p $root/plan9port/src for file in $(find src/ -maxdepth 1 -type f) do cp $file $root/plan9port/src/ done else # Remove files not needed at runtime rm -rf `find src/ -type d -maxdepth 1 -mindepth 1` unix/ mac/ dist/ find . -maxdepth 1 -type f -and ! -name rcmain | xargs rm cp -rv . $root/$prefix/plan9port/ || exit 1 ln -sf /$prefix/plan9port/bin/9 $root$bindir/9 || exit 1 echo "export PLAN9=/$prefix/plan9port" > $root$sysconfdir/profile.d/plan9port fi } runconf=0 makeopt= makeinstopt= hook_add premake 2 configure hook_add inmake 2 build hook_add postmake 2 install