]> git.draconx.ca Git - cdecl99.git/commitdiff
Improve gnulib build times.
authorNick Bowler <nbowler@draconx.ca>
Fri, 18 Feb 2022 04:08:19 +0000 (23:08 -0500)
committerNick Bowler <nbowler@draconx.ca>
Fri, 18 Feb 2022 04:57:43 +0000 (23:57 -0500)
Use the new dxcommon features in an attempt to avoid the expensive
symbol renaming and PIC build steps for the portions of gnulib that
are not actually needed by the libcdecl library.

.gitignore
Makefile.am
bootstrap
common
configure.ac
src/cdecl99.c
test/testlib.c

index bd0dd922ef114f5cd5ba8ba0f3935d6bf9eb392d..2a3a25d0f130e8b37b4035a96a465b1dae0d71dd 100644 (file)
@@ -1,3 +1,4 @@
+*.a
 *.la
 *.lo
 *.o
index bef5f018d19fea158c46f6dff23ee11aac1654d5..0248f6d7e3ff1a5caddcf36f6ddfb0ece6a88500 100644 (file)
@@ -21,7 +21,7 @@ MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \
 
 DISTCLEANFILES =
 
-CLEANFILES = $(EXTRA_LTLIBRARIES)
+CLEANFILES = $(EXTRA_LTLIBRARIES) $(EXTRA_LIBRARIES)
 
 EXTRA_DIST = bootstrap $(DX_BASEDIR)/scripts/fix-gnulib.pl m4/gnulib-cache.m4 \
              src/types.lst src/parse.y src/parse.stamp src/scan.l \
@@ -35,26 +35,36 @@ noinst_HEADERS = conf_pre.h conf_post.h common/src/help.h \
 
 noinst_DATA = $(MOFILES)
 
+shared_gl_objects = $(gnulib_symfiles:.glsym=.lo)
+static_gl_objects = $(gnulib_extra_objects:.lo=.@OBJEXT@)
+
 lib_LTLIBRARIES = libcdecl.la
-libcdecl_la_LDFLAGS = -export-symbols-regex '^cdecl_[[:lower:]]' \
+libcdecl_la_LDFLAGS = -export-symbols-regex '^cdecl_([[:lower:]]|_gl_)' \
                       -no-undefined -version-info 1:0:0
 libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/output.c \
                       src/explain.c src/declare.c src/error.c src/normalize.c \
                       src/cdecl-internal.h
-libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
+libcdecl_la_LIBADD = $(shared_gl_objects) $(LTLIBINTL) $(LIBTHREAD)
+EXTRA_libcdecl_la_DEPENDENCIES = $(shared_gl_objects)
 $(libcdecl_la_OBJECTS): $(gnulib_headers)
 
 if USE_NLS
 libcdecl_la_SOURCES += src/i18n.c
 endif
 
+EXTRA_LIBRARIES = libgnu.a
+libgnu_a_SOURCES =
+libgnu_a_LIBADD = $(static_gl_objects)
+EXTRA_libgnu_a_DEPENDENCIES = $(static_gl_objects)
+dummy $(static_gl_objects): $(gnulib_headers)
+
 bin_PROGRAMS = cdecl99
 cdecl99_SOURCES = common/src/help.c src/commands.c src/cdecl99.h
 cdecl99_LDADD = $(libmain_a_OBJECTS) $(libexec_a_OBJECTS) libcdecl.la \
-                libgnu.la $(LTLIBICONV) $(LTLIBINTL) $(LTLIBREADLINE)
+                libgnu.a $(LTLIBICONV) $(LTLIBINTL) $(LTLIBREADLINE)
 $(cdecl99_OBJECTS): $(gnulib_headers)
 
-EXTRA_LIBRARIES = libexec.a
+EXTRA_LIBRARIES += libexec.a
 libexec_a_SOURCES = src/execute.c src/commands.h
 $(libexec_a_OBJECTS): $(gnulib_headers)
 $(libexec_a_OBJECTS): src/commands.h src/cmdlist.h
@@ -66,17 +76,19 @@ $(libmain_a_OBJECTS): src/options.h
 
 check_PROGRAMS = test/crossparse test/normalize test/randomdecl
 check_LIBRARIES = libtest.a
-libtest_a_SOURCES = test/testlib.c common/src/help.c
+libtest_a_SOURCES = test/testlib.c test/rng.c common/src/help.c
 $(libtest_a_OBJECTS): $(gnulib_headers)
 
-test_randomdecl_SOURCES = test/randomdecl.c test/declgen.c test/rng.c
-test_randomdecl_LDADD = libtest.a libcdecl.la libgnu.la $(LDEXP_LIBM)
+TEST_LIBS = libtest.a libcdecl.la libgnu.a $(LDEXP_LIBM)
+
+test_randomdecl_SOURCES = test/randomdecl.c test/declgen.c
+test_randomdecl_LDADD = $(TEST_LIBS)
 $(test_randomdecl_OBJECTS): $(gnulib_headers)
 
-test_crossparse_LDADD = libtest.a libcdecl.la libgnu.la
+test_crossparse_LDADD = $(TEST_LIBS)
 $(test_crossparse_OBJECTS): $(gnulib_headers)
-test_normalize_LDADD = libtest.a src/output.lo src/normalize.lo \
-                       libcdecl.la libgnu.la
+
+test_normalize_LDADD = src/output.lo src/normalize.lo $(TEST_LIBS)
 $(test_normalize_OBJECTS): $(gnulib_headers)
 
 src/parse.lo: src/scan.h
index 43fee2c28260a8a8f8fd4052616da6f32cbd0ff4..5acafcb0849ea1abd3c6d4ffe5f0b9f87a4e1aea 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright © 2011-2012, 2021 Nick Bowler
+# Copyright © 2011-2012, 2021-2022 Nick Bowler
 #
 # Simple script to get started from a fresh git checkout.
 #
@@ -28,7 +28,19 @@ die() {
 $GIT submodule update --init || err "Failed to update submodules from git."
 
 if test -x $GNULIB/gnulib-tool; then
-       $GNULIB/gnulib-tool --update -S || die "Failed to update Gnulib."
+  $GNULIB/gnulib-tool --update -S || die "Failed to update Gnulib."
+
+  exec 3>lib/symfiles.tmp 4<lib/symfiles.tmp
+  rm -f lib/symfiles.tmp
+
+  shared_modules='lock tls flexmember snprintf'
+  set x --extract-recursive-dependencies $shared_modules; shift
+  (set -x; $GNULIB/gnulib-tool "$@" >&3 ) || die "gnulib-tool failed"
+  shared_modules=`LC_ALL=C sort -u <&4`
+
+  set x --extract-filelist $shared_modules; shift
+  ( set -x; $GNULIB/gnulib-tool "$@" >&3 ) || die "gnulib-tool failed"
+  <&4 grep '^lib/.*[.][^vh][^.]*$' | LC_ALL=C sort -u >lib/symfiles
 else
   err "Gnulib sources are not properly installed in $GNULIB/"
   cat >&2 <<'EOF'
diff --git a/common b/common
index afc0149dd2e0393d529c5322f25396039872f787..e7d29006d05055ab5b7af44078668c1915d35262 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit afc0149dd2e0393d529c5322f25396039872f787
+Subproject commit e7d29006d05055ab5b7af44078668c1915d35262
index a615f98a75404e3a921a661e4bacf87b932b0ad3..d2b02d4892872eaebfc336eec2fb118eecdea5d0 100644 (file)
@@ -52,7 +52,9 @@ AS_IF([test x"$dx_cv_rl_add_history" = x"yes"],
     [Define to 1 if readline supports add_history.])])
 
 m4_include([lib/gnulib.mk])
-DX_GLSYM_PREFIX([cdecl__])
+DX_GLSYM_PREFIX([cdecl__gl_])
+DX_GNULIB_SYMFILES([lib/symfiles])
+AM_CONDITIONAL([BUILD_STATIC], [test x"$enable_static" = x"yes"])
 
 dnl We provide our own makefile rules for gettext.  Disable tracing of
 dnl AM_GNU_GETTEXT to prevent autoreconf from running autopoint, and to
index 2354626dd9002108b9236f16a3881667efc23631..9d9fcc8a6615f5c5462cb903823e1516887c10d3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Command line utility for making sense of C declarations.
- * Copyright © 2011-2012, 2020-2021 Nick Bowler
+ * Copyright © 2011-2012, 2020-2022 Nick Bowler
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@ static void print_version(void)
        }
 
        puts(PACKAGE_STRING);
-       printf("Copyright %s 2021 Nick Bowler.\n", copysign);
+       printf("Copyright %s 2022 Nick Bowler.\n", copysign);
        puts("License GPLv3+: GNU GPL version 3 or any later version.");
        puts("This is free software: you are free to change and redistribute it.");
        puts("There is NO WARRANTY, to the extent permitted by law.");
index 93186635639250a1d1e5867708eb5d66db477ea3..fdb9d3b5f83dd10e419a368400ec90d01d403022 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Miscellaneous functions used by the cdecl99 test suite.
- *  Copyright © 2011-2012, 2021 Nick Bowler
+ *  Copyright © 2011-2012, 2021-2022 Nick Bowler
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -92,7 +92,7 @@ bool strict_strtoul(unsigned long *val, const char *str, int base)
 void test_print_version(const char *program)
 {
        printf("%s (%s) %s\n", program, PACKAGE_NAME, PACKAGE_VERSION);
-       puts("Copyright (C) 2021 Nick Bowler.");
+       puts("Copyright (C) 2022 Nick Bowler.");
        puts("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.");
        puts("This is free software: you are free to change and redistribute it.");
        puts("There is NO WARRANTY, to the extent permitted by law.");