Module Name:    src
Committed By:   plunky
Date:           Tue Jun  7 13:07:27 UTC 2011

Modified Files:
        src/external/bsd/pcc: Makefile.inc prepare-import.sh

Log Message:
use better method of creating version string, current method can
introduce spurious " characters during stringification


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/pcc/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/pcc/prepare-import.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/pcc/Makefile.inc
diff -u src/external/bsd/pcc/Makefile.inc:1.12 src/external/bsd/pcc/Makefile.inc:1.13
--- src/external/bsd/pcc/Makefile.inc:1.12	Fri Jun  3 13:31:25 2011
+++ src/external/bsd/pcc/Makefile.inc	Tue Jun  7 13:07:26 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.12 2011/06/03 13:31:25 plunky Exp $
+#	$NetBSD: Makefile.inc,v 1.13 2011/06/07 13:07:26 plunky Exp $
 
 PCC_DIR:=${.PARSEDIR}
 PCC_DIST=${PCC_DIR}/dist/pcc
@@ -18,6 +18,7 @@
 ERROR!= echo "ERROR: ${TARGMACH} not yet supported - write code!" >&2;echo
 .endif
 
+# this string will be updated by the prepare-import.sh script
 VERSSTR = PACKAGE_STRING " for ${TARGOS}-${TARGMACH}"
 
 CPPFLAGS+=	-DGCC_COMPAT

Index: src/external/bsd/pcc/prepare-import.sh
diff -u src/external/bsd/pcc/prepare-import.sh:1.4 src/external/bsd/pcc/prepare-import.sh:1.5
--- src/external/bsd/pcc/prepare-import.sh:1.4	Fri Jun  3 08:56:39 2011
+++ src/external/bsd/pcc/prepare-import.sh	Tue Jun  7 13:07:26 2011
@@ -50,19 +50,24 @@
 cd ../..
 #
 # comment out items we provide at build time from Makefile.inc
-# modify the PACKAGE_STRING to include the checkout date
 # define PREPROCESSOR as pcpp to avoid conflicts with GCC
 #
-datestamp=$(cat work/pcc/DATESTAMP)
 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,^\(#define[[:space:]]*PACKAGE_STRING[[:>:]].*\".*\)\(\".*\)\$,\1 [${datestamp}]\2,"	\
     -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 "s,^VERSSTR=.*$,VERSSTR=\"pcc ${version} ${datestamp} for \${TARGMACH}-\${TARGOS}\","	\
+	< Makefile.inc > work/Makefile.inc
+
 echo "====> Replacing pcc sources..."
 rm -Rf dist/pcc dist/pcc-libs
 mv work/pcc work/pcc-libs dist
@@ -70,6 +75,10 @@
     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

Reply via email to