[BACK]Return to prepare-import.sh CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / external / bsd / pcc

File: [cvs.NetBSD.org] / src / external / bsd / pcc / prepare-import.sh (download)

Revision 1.6, Thu Sep 1 13:00:14 2011 UTC (2 years, 10 months ago) by plunky
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, khorben-n900, agc-symver-base, agc-symver, HEAD
Changes since 1.5: +7 -6 lines

update build machinery for pcc-20110901

#!/bin/sh -x
#
#	prepare pcc distribution for import
#
# pcc can be built as part of the toolchain by setting
#
#	HAVE_PCC=yes
#
# and as a native binary for a release build by setting
#
#	MKPCC=yes
#

#
# TODO
# - some files only have NetBSD tags to start with, they end up with none

set -e

if [ ! -d work -o ! -d work/pcc ]; then
	echo "checkout or unpack pcc to work/ first, eg"
	echo ""
	echo "    cvs -d :pserver:anonymous@pcc.ludd.ltu.se:/cvsroot -f checkout -P -d work -N pcc"
	echo ""
	exit 1
fi

echo "====> Removing pcc CVS directories..."
find work -type d -name CVS | xargs rm -Rf

echo "====> Fixing file and directory permissions..."
find work -type d -exec chmod u=rwx,go=rx {} \;
find work -type f -exec chmod u=rw,go=r {} \;

echo "====> Fixing RCS tags..."
# fix existing RCS tags, and insert blank NetBSD tags
for f in $(grep -RL '\$(NetBSD|Id).*\$' work); do
    sed -e '/\$NetBSD\$/d'				\
	-e 's,\$\(NetBSD[[:>:]].*\)\$,\1,'		\
	-e 's,\(.*\)\$\(Id[[:>:]].*\)\$\(.*\),\1\2\3	\
\1\$NetBSD\$\3,'					\
	< ${f} > ${f}_tmp
    mv ${f}_tmp ${f}
done

echo "====> Creating pcc \"config.h\" file..."
mkdir work/tmp
cd work/tmp
env -i PATH=/bin:/usr/bin /bin/sh ../pcc/configure --enable-tls
cd ../..
#
# comment out items we provide at build time from Makefile.inc
# define PREPROCESSOR as pcpp to avoid conflicts with GCC
#
sed -e "s,^\(#define[[:space:]]*VERSSTR[[:>:]].*\)\$,/* \1 */,"					\
    -e "s,^\(#define[[:space:]]*HOST_BIG_ENDIAN[[:>:]].*\)\$,/* \1 */,"				\
    -e "s,^\(#define[[:space:]]*HOST_LITTLE_ENDIAN[[:>:]].*\)\$,/* \1 */,"			\
    -e "s,^\(#define[[:space:]]*TARGET_BIG_ENDIAN[[:>:]].*\)\$,/* \1 */,"			\
    -e "s,^\(#define[[:space:]]*TARGET_LITTLE_ENDIAN[[:>:]].*\)\$,/* \1 */,"			\
    -e "s,^\(.*[[:<:]]PREPROCESSOR[[:>:]].*\)\$,#define PREPROCESSOR \"pcpp\","			\
    < work/tmp/config.h > work/config.h

#
# update Makefile.inc to create version string at build time
#
datestamp=$(cat work/pcc/DATESTAMP)
version=$(sed -n -e "/PACKAGE_VERSION/s/.*\"\(.*\)\"/\1/p" < work/config.h)
sed -e "/^PCC_DATESTAMP=/s/=.*$/=${datestamp}/"	\
    -e "/^PCC_VERSION=/s/=.*$/=${version}/"	\
	< Makefile.inc > work/Makefile.inc

echo "====> Replacing pcc sources..."
rm -Rf dist/pcc dist/pcc-libs
mv work/pcc dist
if cmp -s work/config.h include/config.h; then :; else
    echo "====> Updating include/config.h..."
    mv work/config.h include/config.h
fi
if cmp -s work/Makefile.inc Makefile.inc; then :; else
    echo "====> Updating Makefile.inc..."
    mv work/Makefile.inc Makefile.inc
fi

echo "====> Done."
rm -Rf work

echo ""
echo "after testing, use the following command to import from the dist directory,"
echo ""
echo "    cvs import src/external/bsd/pcc/dist ragge pcc-${datestamp}"
echo ""
echo "providing a ChangeLog in the commit message."