]> git.draconx.ca Git - rrace.git/commitdiff
Pull in gnulib for its portability features.
authorNick Bowler <nbowler@draconx.ca>
Sat, 5 Mar 2022 20:43:33 +0000 (15:43 -0500)
committerNick Bowler <nbowler@draconx.ca>
Mon, 7 Mar 2022 03:36:22 +0000 (22:36 -0500)
.gitignore
.gitmodules
Makefile.am
bootstrap [new file with mode: 0755]
configure.ac
gnulib [new submodule]
m4/.gitignore
m4/gnulib-cache.m4 [new file with mode: 0644]

index 2f2a3da8d12aa07fd0e6e17ba3d8ac475a93555e..92acc78df366edf9b8ed385c1268bff0e0b9de37 100644 (file)
@@ -2,6 +2,7 @@
 *.o
 .deps
 .dirstamp
+/INSTALL
 /Makefile
 /Makefile.in
 /aclocal.m4
@@ -12,6 +13,7 @@
 /configure
 /depcomp
 /install-sh
+/lib
 /libtool
 /ltmain.sh
 /missing
index a0019b308513f899407220044644f9ac41d1e0aa..34c552cbf1f1bbec2fcbd6ac8e30b9db0de8c673 100644 (file)
@@ -1,3 +1,6 @@
 [submodule "common"]
        path = common
        url = https://git.draconx.ca/dxcommon.git
+[submodule "gnulib"]
+       path = gnulib
+       url = https://git.savannah.gnu.org/git/gnulib.git
index c9c281633ff502866fc994a24957ed11fcb616ad..48a0b4ed5048ec8472f8137e86d49efd89f32ff5 100644 (file)
@@ -9,29 +9,35 @@ ACLOCAL_AMFLAGS = -I m4 -I common/m4
 EXTRA_DIST =
 EXTRA_LIBRARIES =
 MAINTAINERCLEANFILES =
+MOSTLYCLEANFILES =
 DISTCLEANFILES =
 CLEANFILES = $(EXTRA_LIBRARIES)
 
-AM_CPPFLAGS = -I$(builddir)/src -I$(srcdir)/src -I$(DX_BASEDIR)/src
+AM_CPPFLAGS = -I$(builddir)/src -I$(srcdir)/src -I$(DX_BASEDIR)/src \
+              -I$(builddir)/lib -I$(srcdir)/lib
 AM_CFLAGS = $(MOTIF_CFLAGS)
 
 bin_PROGRAMS = rrace-motif
 
 rrace_motif_SOURCES = src/game.c src/x11.c
 rrace_motif_LDADD = $(libmotifmain_a_OBJECTS) $(libmotifui_a_OBJECTS) \
-                    $(libglohelp_a_OBJECTS) $(MOTIF_LIBS)
+                    $(libglohelp_a_OBJECTS) libgnu.a $(MOTIF_LIBS)
+$(rrace_motif_OBJECTS): $(gnulib_headers)
 
 EXTRA_LIBRARIES += libmotifmain.a
 libmotifmain_a_SOURCES = src/motif.c
+$(libmotifmain_a_OBJECTS): $(gnulib_headers)
 $(libmotifmain_a_OBJECTS): src/motifopt.h
 
 EXTRA_LIBRARIES += libmotifui.a
 libmotifui_a_SOURCES = src/motif_ui.c
+$(libmotifui_a_OBJECTS): $(gnulib_headers)
 $(libmotifui_a_OBJECTS): src/motifgui.h src/motifstr.h
 
 EXTRA_LIBRARIES += libglohelp.a
 libglohelp_a_SOURCES = common/src/help.c
 libglohelp_a_CFLAGS = -DHELP_GETOPT_LONG_ONLY
+$(libglohelp_a_OBJECTS): $(gnulib_headers)
 libglohelp_a_SHORTNAME = glo
 
 OPTFILES = src/motifopt.opt
@@ -60,6 +66,8 @@ EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-tree.awk $(GUIFILES)
 
 check_PROGRAMS = t/boardmove t/rng-test
 
-t_boardmove_LDADD = src/game.$(OBJEXT)
+t_boardmove_LDADD = src/game.$(OBJEXT) libgnu.a
+$(t_boardmove_OBJECTS): $(gnulib_headers)
 
+include $(top_srcdir)/lib/gnulib.mk
 include $(top_srcdir)/common/snippet/autotest.mk
diff --git a/bootstrap b/bootstrap
new file mode 100755 (executable)
index 0000000..f16d302
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright © 2011-2012, 2015, 2021-2022 Nick Bowler
+#
+# Simple script to get started from a fresh git checkout.
+#
+# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
+# This is free software: you are free to do what the fuck you want to.
+# There is NO WARRANTY, to the extent permitted by law.
+
+scriptname=$0
+
+err() { printf '%s: %s\n' "$scriptname" "$*" 1>&2; }
+die() { err "$@"; exit 1; }
+
+: ${AUTORECONF=autoreconf}
+: ${AUTOMAKE=automake}
+: ${GNULIB=gnulib}
+: ${GIT=git}
+: ${PERL=perl}
+
+$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."
+else
+  err "Gnulib sources are not properly installed in $GNULIB/"
+  cat >&2 <<'EOF'
+
+To bootstrap this package using an external Gnulib, you can set the GNULIB
+environment variable to indicate the location of the Gnulib sources.
+EOF
+
+  test ! -f configure || cat >&2 <<'EOF'
+
+However, it seems this package is already bootstrapped.  It should not
+normally be necessary to run this script from a release tarball.
+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."
+
+# Rewrite if ! ... construts produced by gnulib conditional dependencies
+# as these fail in heirloom-sh.
+sed 's/if ! *\(.*gnulib_enabled[^;]*\); then/if \1; then :; else/' \
+  m4/gnulib-comp.m4 >m4/gnulib-comp.m4.new || exit
+mv -f m4/gnulib-comp.m4.new m4/gnulib-comp.m4 || exit
+
+# Punt some automake-generated files so that Gentoo's wrapper script doesn't
+# try to detect the automake version in use.
+rm -f Makefile.in aclocal.m4
+$AUTORECONF -fis || exit
+
+amdir=`$AUTOMAKE --print-libdir`
+if test -f "$amdir/INSTALL"; then
+  ln -sf "$amdir/INSTALL" INSTALL
+fi
index b0c7fb06355cb0916ee5d021694cbc7c0cc36f24..88c9db9a2a11f83fada79fce250dcca40e6528e4 100644 (file)
@@ -4,6 +4,9 @@ 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.
 dnl There is NO WARRANTY, to the extent permitted by law.
 
+dnl remove pointless gnulib warning flag check
+AC_DEFUN([gl_CC_GNULIB_WARNINGS])
+
 AC_INIT([rrace], [0], [nbowler@draconx.ca])
 AC_CONFIG_HEADERS([config.h])
 
@@ -12,7 +15,12 @@ AM_SILENT_RULES([yes])
 DX_AUTOMAKE_COMPAT
 
 AC_PROG_CC_C99
+gl_EARLY
 LT_INIT
+gl_INIT
+
+AC_CACHE_SAVE
+m4_include([lib/gnulib.mk])
 
 AC_PATH_XTRA
 AS_IF([test x"$no_x" != x"yes"],
diff --git a/gnulib b/gnulib
new file mode 160000 (submodule)
index 0000000..8c4f4d7
--- /dev/null
+++ b/gnulib
@@ -0,0 +1 @@
+Subproject commit 8c4f4d7a3c28f88b64fce2fb1d0dc0e570d1a482
index 94e6f26a7da0b4cbb75408fbe1a8c788f875bef0..ff430e2cb36c94e22a766b684ac07b0dea7beb98 100644 (file)
@@ -1,5 +1,26 @@
+/00gnulib.m4
+/absolute-header.m4
+/extensions.m4
+/extern-inline.m4
+/getopt.m4
+/gnulib-common.m4
+/gnulib-comp.m4
+/gnulib-tool.m4
+/include_next.m4
+/inline.m4
 /libtool.m4
 /ltoptions.m4
 /ltsugar.m4
 /ltversion.m4
 /lt~obsolete.m4
+/nocrash.m4
+/off_t.m4
+/pid_t.m4
+/ssize_t.m4
+/stddef_h.m4
+/sys_types_h.m4
+/unistd_h.m4
+/vararrays.m4
+/warn-on-use.m4
+/wchar_t.m4
+/zzgnulib.m4
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
new file mode 100644 (file)
index 0000000..d1c7383
--- /dev/null
@@ -0,0 +1,63 @@
+# Copyright (C) 2002-2022 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file.  If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License,
+# this file may be distributed as part of a program that
+# contains a configuration script generated by Autoconf, under
+# the same distribution terms as the rest of that program.
+#
+# Generated by gnulib-tool.
+#
+# This file represents the specification of how gnulib-tool is used.
+# It acts as a cache: It is written and read by gnulib-tool.
+# In projects that use version control, this file is meant to be put under
+# version control, like the configure.ac and various Makefile.am files.
+
+
+# Specification in the form of a command-line invocation:
+# gnulib-tool --import \
+#  --lib=libgnu \
+#  --source-base=lib \
+#  --m4-base=m4 \
+#  --doc-base=doc \
+#  --tests-base=tests \
+#  --aux-dir=. \
+#  --makefile-name=gnulib.mk.in \
+#  --conditional-dependencies \
+#  --no-libtool \
+#  --macro-prefix=gl \
+#  --no-vc-files \
+#  getopt-gnu \
+#  inline
+
+# Specification in the form of a few gnulib-tool.m4 macro invocations:
+gl_LOCAL_DIR([])
+gl_MODULES([
+  getopt-gnu
+  inline
+])
+gl_AVOID([])
+gl_SOURCE_BASE([lib])
+gl_M4_BASE([m4])
+gl_PO_BASE([])
+gl_DOC_BASE([doc])
+gl_TESTS_BASE([tests])
+gl_LIB([libgnu])
+gl_MAKEFILE_NAME([gnulib.mk.in])
+gl_CONDITIONAL_DEPENDENCIES
+gl_MACRO_PREFIX([gl])
+gl_PO_DOMAIN([])
+gl_WITNESS_C_MACRO([])
+gl_VC_FILES([false])