Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/pcc use better method of creating version strin...



details:   https://anonhg.NetBSD.org/src/rev/305e2e1e0b91
branches:  trunk
changeset: 765829:305e2e1e0b91
user:      plunky <plunky%NetBSD.org@localhost>
date:      Tue Jun 07 13:07:26 2011 +0000

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

diffstat:

 external/bsd/pcc/Makefile.inc      |   3 ++-
 external/bsd/pcc/prepare-import.sh |  15 ++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r 082378459aef -r 305e2e1e0b91 external/bsd/pcc/Makefile.inc
--- a/external/bsd/pcc/Makefile.inc     Tue Jun 07 10:10:44 2011 +0000
+++ b/external/bsd/pcc/Makefile.inc     Tue Jun 07 13:07:26 2011 +0000
@@ -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
diff -r 082378459aef -r 305e2e1e0b91 external/bsd/pcc/prepare-import.sh
--- a/external/bsd/pcc/prepare-import.sh        Tue Jun 07 10:10:44 2011 +0000
+++ b/external/bsd/pcc/prepare-import.sh        Tue Jun 07 13:07:26 2011 +0000
@@ -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



Home | Main Index | Thread Index | Old Index