1 1.1 plunky #!/bin/sh -x 2 1.1 plunky # 3 1.1 plunky # prepare pcc distribution for import 4 1.1 plunky # 5 1.1 plunky # pcc can be built as part of the toolchain by setting 6 1.1 plunky # 7 1.1 plunky # HAVE_PCC=yes 8 1.1 plunky # 9 1.1 plunky # and as a native binary for a release build by setting 10 1.1 plunky # 11 1.1 plunky # MKPCC=yes 12 1.1 plunky # 13 1.1 plunky 14 1.1 plunky # 15 1.1 plunky # TODO 16 1.1 plunky # - some files only have NetBSD tags to start with, they end up with none 17 1.1 plunky 18 1.1 plunky set -e 19 1.1 plunky 20 1.6 plunky if [ ! -d work -o ! -d work/pcc ]; then 21 1.6 plunky echo "checkout or unpack pcc to work/ first, eg" 22 1.1 plunky echo "" 23 1.6 plunky echo " cvs -d :pserver:anonymous (at] pcc.ludd.ltu.se:/cvsroot -f checkout -P -d work -N pcc" 24 1.1 plunky echo "" 25 1.1 plunky exit 1 26 1.1 plunky fi 27 1.1 plunky 28 1.1 plunky echo "====> Removing pcc CVS directories..." 29 1.1 plunky find work -type d -name CVS | xargs rm -Rf 30 1.1 plunky 31 1.1 plunky echo "====> Fixing file and directory permissions..." 32 1.1 plunky find work -type d -exec chmod u=rwx,go=rx {} \; 33 1.1 plunky find work -type f -exec chmod u=rw,go=r {} \; 34 1.1 plunky 35 1.1 plunky echo "====> Fixing RCS tags..." 36 1.1 plunky # fix existing RCS tags, and insert blank NetBSD tags 37 1.1 plunky for f in $(grep -RL '\$(NetBSD|Id).*\$' work); do 38 1.1 plunky sed -e '/\$NetBSD\$/d' \ 39 1.1 plunky -e 's,\$\(NetBSD[[:>:]].*\)\$,\1,' \ 40 1.1 plunky -e 's,\(.*\)\$\(Id[[:>:]].*\)\$\(.*\),\1\2\3 \ 41 1.1 plunky \1\$NetBSD\$\3,' \ 42 1.1 plunky < ${f} > ${f}_tmp 43 1.1 plunky mv ${f}_tmp ${f} 44 1.1 plunky done 45 1.1 plunky 46 1.1 plunky echo "====> Creating pcc \"config.h\" file..." 47 1.1 plunky mkdir work/tmp 48 1.1 plunky cd work/tmp 49 1.6 plunky env -i PATH=/bin:/usr/bin /bin/sh ../pcc/configure --enable-tls 50 1.1 plunky cd ../.. 51 1.1 plunky # 52 1.1 plunky # comment out items we provide at build time from Makefile.inc 53 1.1 plunky # define PREPROCESSOR as pcpp to avoid conflicts with GCC 54 1.1 plunky # 55 1.1 plunky sed -e "s,^\(#define[[:space:]]*VERSSTR[[:>:]].*\)\$,/* \1 */," \ 56 1.1 plunky -e "s,^\(#define[[:space:]]*HOST_BIG_ENDIAN[[:>:]].*\)\$,/* \1 */," \ 57 1.1 plunky -e "s,^\(#define[[:space:]]*HOST_LITTLE_ENDIAN[[:>:]].*\)\$,/* \1 */," \ 58 1.1 plunky -e "s,^\(#define[[:space:]]*TARGET_BIG_ENDIAN[[:>:]].*\)\$,/* \1 */," \ 59 1.1 plunky -e "s,^\(#define[[:space:]]*TARGET_LITTLE_ENDIAN[[:>:]].*\)\$,/* \1 */," \ 60 1.1 plunky -e "s,^\(.*[[:<:]]PREPROCESSOR[[:>:]].*\)\$,#define PREPROCESSOR \"pcpp\"," \ 61 1.1 plunky < work/tmp/config.h > work/config.h 62 1.1 plunky 63 1.5 plunky # 64 1.5 plunky # update Makefile.inc to create version string at build time 65 1.5 plunky # 66 1.5 plunky datestamp=$(cat work/pcc/DATESTAMP) 67 1.5 plunky version=$(sed -n -e "/PACKAGE_VERSION/s/.*\"\(.*\)\"/\1/p" < work/config.h) 68 1.6 plunky sed -e "/^PCC_DATESTAMP=/s/=.*$/=${datestamp}/" \ 69 1.6 plunky -e "/^PCC_VERSION=/s/=.*$/=${version}/" \ 70 1.5 plunky < Makefile.inc > work/Makefile.inc 71 1.5 plunky 72 1.1 plunky echo "====> Replacing pcc sources..." 73 1.1 plunky rm -Rf dist/pcc dist/pcc-libs 74 1.6 plunky mv work/pcc dist 75 1.1 plunky if cmp -s work/config.h include/config.h; then :; else 76 1.1 plunky echo "====> Updating include/config.h..." 77 1.1 plunky mv work/config.h include/config.h 78 1.1 plunky fi 79 1.5 plunky if cmp -s work/Makefile.inc Makefile.inc; then :; else 80 1.5 plunky echo "====> Updating Makefile.inc..." 81 1.5 plunky mv work/Makefile.inc Makefile.inc 82 1.5 plunky fi 83 1.1 plunky 84 1.1 plunky echo "====> Done." 85 1.1 plunky rm -Rf work 86 1.1 plunky 87 1.1 plunky echo "" 88 1.1 plunky echo "after testing, use the following command to import from the dist directory," 89 1.1 plunky echo "" 90 1.2 plunky echo " cvs import src/external/bsd/pcc/dist ragge pcc-${datestamp}" 91 1.1 plunky echo "" 92 1.1 plunky echo "providing a ChangeLog in the commit message." 93