]> git.draconx.ca Git - slotifier.git/commitdiff
Replace Gnulib striconv with copyright_symbol from dxcommon.
authorNick Bowler <nbowler@draconx.ca>
Sat, 27 May 2023 06:10:50 +0000 (02:10 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sun, 28 May 2023 20:29:14 +0000 (16:29 -0400)
The only use of the striconv module is to produce the copyright symbol
for --version output and at the start of an interactive session.  Using
the new, single-purpose function reduces code size quite a bit.

Makefile.am
bootstrap
common
configure.ac
m4/gnulib-cache.m4
src/slotifier.c

index b0736580b740d99787b00c766430cf35f370aa6f..cd868b33f170543bc9d07f581ac2690badd829e6 100644 (file)
@@ -21,11 +21,20 @@ AM_CFLAGS = $(LIBGERBV_CFLAGS) $(CNEARTREE_CFLAGS)
 bin_PROGRAMS = slotifier
 
 noinst_HEADERS = common/src/help.h common/src/xtra.h
-slotifier_SOURCES = src/slotifier.c src/options.h common/src/help.c
-slotifier_LDADD = $(LIBGERBV_LIBS) $(CNEARTREE_LIBS) libgnu.a \
-                  $(LTLIBICONV) $(LTLIBINTL) $(HYPOT_LIBM)
+slotifier_SOURCES = src/options.h common/src/help.c
+EXTRA_slotifier_DEPENDENCIES = $(libslotifiermain_a_OBJECTS)
+slotifier_LDADD = $(EXTRA_slotifier_DEPENDENCIES) \
+                  $(LIBGERBV_LIBS) $(CNEARTREE_LIBS) libgnu.a \
+                  $(LTLIBINTL) $(HYPOT_LIBM)
 $(slotifier_OBJECTS): $(gnulib_headers)
-$(slotifier_OBJECTS): src/options.h
+
+if USE_NLS
+slotifier_SOURCES += common/src/copysym.c
+endif
+
+EXTRA_LIBRARIES += libslotifiermain.a
+libslotifiermain_a_SOURCES = src/slotifier.c
+$(libslotifiermain_a_OBJECTS): $(gnulib_headers) src/options.h
 
 dist_man_MANS = doc/slotifier.1
 
index f92c1c763439c3f742f47ec7bcb677d6da42e874..7bb1f8dc9aef98382f6a775fdb7f9e18cccd2e97 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright © 2011-2012, 2021 Nick Bowler
+# Copyright © 2011-2012, 2015, 2021-2023 Nick Bowler
 #
 # Simple script to get started from a fresh git checkout.
 #
@@ -22,7 +22,8 @@ die () { err "$@"; exit 1; }
 $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."
+  $GNULIB/gnulib-tool --copy-file -S build-aux/config.rpath config.rpath
 else
   err "Gnulib sources are not properly installed in $GNULIB/"
   cat >&2 <<'EOF'
@@ -39,8 +40,8 @@ EOF
   exit 1
 fi
 
-$PERL common/scripts/fix-gnulib.pl -o lib/gnulib.mk -i lib/gnulib.mk.in ||
-  die "Failed to fixup Gnulib makefile fragment."
+$PERL common/scripts/fix-gnulib.pl -o lib/gnulib.mk -i lib/gnulib.mk.in \
+  || die "Failed to fixup Gnulib makefile fragment."
 
 # Rewrite if ! ... construts produced by gnulib conditional dependencies
 # as these fail in heirloom-sh.
diff --git a/common b/common
index e599119f0492b01f1f21a8cce8d695c314dab3b1..207d0dbfbbfa7ad70b59ada3a741895842958885 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit e599119f0492b01f1f21a8cce8d695c314dab3b1
+Subproject commit 207d0dbfbbfa7ad70b59ada3a741895842958885
index 165e1a4ec008310c8f1a8fa764029a3ea9a5312d..c7bc9072d4fbc9b8d94485588406bf55f305f4b8 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright © 2018-2019, 2021-2022 Nick Bowler
+dnl Copyright © 2018-2019, 2021-2023 Nick Bowler
 dnl
 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
 dnl This is free software: you are free to do what the fuck you want to.
@@ -54,6 +54,8 @@ m4_newline([DX_LIB_USERFLAG_BLURB([libgerbv])])
 m4_newline([DX_LIB_PKGCONFIG_BLURB([libgerbv])])
 ])])
 
+AM_CONDITIONAL([USE_NLS], [test x"$USE_NLS" = x"yes"])
+
 AC_CONFIG_TESTDIR([.])
 DX_PROG_AUTOTEST
 AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
index 83a11410f397e796c3b5039c9a2edb6a57f6338d..cf4354643ff3d2db061b947537020d3fc302874b 100644 (file)
@@ -45,8 +45,7 @@
 #  gitlog-to-changelog \
 #  hypot \
 #  localcharset \
-#  mbswidth \
-#  striconv
+#  mbswidth
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -57,7 +56,6 @@ gl_MODULES([
   hypot
   localcharset
   mbswidth
-  striconv
 ])
 gl_AVOID([std-gnu11])
 gl_SOURCE_BASE([lib])
index 312f9f688827b1d495000f5dfe08f1a2e605ba6b..09e5aeecce281f894bca42b8c87630c37eb8c6ff 100644 (file)
@@ -28,7 +28,6 @@
 #include <gettext.h>
 #include <localcharset.h>
 #include <mbswidth.h>
-#include <striconv.h>
 
 #include <CNearTree.h>
 #include <gerbv.h>
@@ -36,6 +35,7 @@
 #include "options.h"
 #include "help.h"
 #include "xtra.h"
+#include "copysym.h"
 
 #if !ENABLE_NLS
 #  undef ENABLE_NLS
@@ -49,23 +49,13 @@ static unsigned verbose;
 
 static void print_version(void)
 {
-       const char *copysign = "(C)";
-       void *convsign = NULL;
+       const char *copysign = copyright_symbol(locale_charset());
 
        puts(PACKAGE_STRING);
-
-       if (ENABLE_NLS) {
-               convsign = str_iconv("\xc2\xa9", "UTF-8", locale_charset());
-               if (convsign)
-                       copysign = convsign;
-       }
-
        printf("Copyright %s 2023 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.");
-
-       free(convsign);
 }
 
 static void print_usage(FILE *f)