1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/plan9port/plan9port.conf
3 # Copyright (C) 2021 - 2022 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 if atstage cross; then
13 export HOSTPLAN9=$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/plan9port
17 var_append CPPFLAGS ' ' "-I$root$includedir/freetype2"
18 var_append CPPFLAGS ' ' '-Wno-sizeof-array-div'
19 var_append CPPFLAGS ' ' '-Wno-array-parameter'
20 var_append LDFLAGS ' ' "-L$root/$SDECFG_PKG_X11_PREFIX/${libdir##*/}"
22 var_append CC9FLAGS ' ' "$CFLAGS"
23 var_append CC9FLAGS ' ' "$CPPFLAGS"
24 var_append CC9FLAGS ' ' "$LDFLAGS"
25 echo "CC9FLAGS='$CC9FLAGS'" >> LOCAL.config
26 echo "CC9='$CC'" >> LOCAL.config
27 echo "LDFLAGS='$LDFLAGS'" >> LOCAL.config
29 if atstage cross; then
30 # Use cross tools yacc, lex and rc
31 # Note: replacing with just yacc (lex, rc) won't work, since it would conflict with system binaries
32 cp src/mkhdr src/mkhdr.orig
33 sed -i "s%9 yacc%$HOSTPLAN9/bin/yacc%g" src/mkhdr src/cmd/upas/smtp/mkfile
34 sed -i "s%9 lex%$HOSTPLAN9/bin/lex%g" src/mkhdr src/cmd/mkfile src/cmd/tpic/mkfile
35 sed -i "s%9 rc%PLAN9=$HOSTPLAN9 $HOSTPLAN9/bin/rc%g" man/mkfile dist/mkfile dist/publish
40 if atstage toolchain; then
41 # Toolchain stage - build mk, yacc, lex, rc and cleanname
43 export PATH=$PATH:$PLAN9/bin
48 mk $PLAN9/bin/cleanname
55 # Build libdraw and libmux (required for rgbycc)
57 mk $PLAN9/lib/libdraw.a
59 mk $PLAN9/lib/libmux.a
62 ./INSTALL -r $root/$prefix/plan9port | tee install.log
63 fgrep 'exit status=exit(1)' install.log >/dev/null && exit 1
64 fgrep 'exit status=exit(2)' install.log >/dev/null && exit 2
67 for file in $(find . -type f -executable -exec grep -Iq . {} \; -print)
69 sed -i "s%#!/usr/local/plan9/bin/rc%#!/$prefix/plan9port/bin/rc%" "$file"
72 # Revert src/mkhdr changes
73 atstage cross && mv src/mkhdr.orig src/mkhdr
79 if atstage toolchain; then
80 mkdir -p $root/plan9port/{bin,lib,include}
82 # Install mk, yacc, lex, rc, cleanname, 9c and 9l
83 for cmd in mk yacc lex rc cleanname 9c 9l
85 command install bin/$cmd $root/plan9port/bin/
88 # Install libraries and includes for toolchain compiler
89 cp -r include/* $root/plan9port/include/
90 cp -r lib/* $root/plan9port/lib/
91 cp rcmain $root/plan9port/rcmain
92 mkdir -p $root/plan9port/src
93 for file in $(find src/ -maxdepth 1 -type f)
95 cp $file $root/plan9port/src/
98 # Remove files not needed at runtime
99 rm -rf `find src/ -type d -maxdepth 1 -mindepth 1` unix/ mac/ dist/
100 find . -maxdepth 1 -type f -and ! -name rcmain | xargs rm
102 cp -rv . $root/$prefix/plan9port/ || exit 1
103 ln -sf /$prefix/plan9port/bin/9 $root$bindir/9 || exit 1
104 echo "export PLAN9=/$prefix/plan9port" > $root$sysconfdir/profile.d/plan9port
112 hook_add premake 2 configure
113 hook_add inmake 2 build
114 hook_add postmake 2 install