From 7f5a2b15c1cf360d8eb529582835aac1a2a5dade Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 17 Nov 2019 01:44:30 +0000 Subject: [PATCH] base91: Build the C basE91 code with our own renaming We want to use a variant character set. This will mean patching the library. (That will happen in a moment.) It seems unwise, and perhaps rude, to make a thing that has the same name as the official basE91 but has a different and incompatible encoding. So we change all the names: `basE91' and `base91' become base91s. We don't change the leaf filenames because that's rather inconvenient. We do put it all in a base91s subdirectory. Rather than running the basE91 upstream makefile, or trying to sed it, or something, we simply make our own makefile. It is simple enough. The only complication is that the "source" files are all actually made by this name substitution perl rune. Overall, the chief result is that we build a base91s/base91s utility, by default. Right now it does not have our charset change, so it is not ready for use yet. Signed-off-by: Ian Jackson --- .gitignore | 3 +++ base91s/Subdir.sd.mk | 16 ++++++++++++++++ configure | 5 +++++ configure.ac | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 base91s/Subdir.sd.mk diff --git a/.gitignore b/.gitignore index b166c42..301117d 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,6 @@ build-stamp [sm]test/d-* stest/udp-preload.so + +base91s/*.[ch] +base91s/base91s diff --git a/base91s/Subdir.sd.mk b/base91s/Subdir.sd.mk new file mode 100644 index 0000000..d41ca9a --- /dev/null +++ b/base91s/Subdir.sd.mk @@ -0,0 +1,16 @@ + +&TARGETS += & base91s base91.o +&OBJECTS += & base91.o cli.o + +&CFILES += & base91.c base91.h cli.c +&CLEAN += $(&CFILES) + +$(&CFILES): &/%: &~/base91-c/% &/Subdir.mk + perl -pe <$< >$@.tmp \ + 'next if m{^\#include}; s/basE91/base91s/g; s/base91\b/base91s/g' + mv -f $@.tmp $@ + +$(&OBJECTS): &base91.h + +&base91s: $(&OBJECTS) + $(CC) -o$@ $(&LDFLAGS) $^ $(&LDLIBS) diff --git a/configure b/configure index 37e76cb..d76d35b 100755 --- a/configure +++ b/configure @@ -2149,6 +2149,10 @@ ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files stest/Subdir.mk:stest/Subdir.mk.tmp" + subdirmk_subdirs="$subdirmk_subdirs 'base91s/'" + ac_config_files="$ac_config_files base91s/Subdir.mk:base91s/Subdir.mk.tmp" + + @@ -4873,6 +4877,7 @@ do "test-example/Subdir.mk") CONFIG_FILES="$CONFIG_FILES test-example/Subdir.mk:test-example/Subdir.mk.tmp" ;; "mtest/Subdir.mk") CONFIG_FILES="$CONFIG_FILES mtest/Subdir.mk:mtest/Subdir.mk.tmp" ;; "stest/Subdir.mk") CONFIG_FILES="$CONFIG_FILES stest/Subdir.mk:stest/Subdir.mk.tmp" ;; + "base91s/Subdir.mk") CONFIG_FILES="$CONFIG_FILES base91s/Subdir.mk:base91s/Subdir.mk.tmp" ;; "common.make") CONFIG_FILES="$CONFIG_FILES common.make:common.make.in" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; diff --git a/configure.ac b/configure.ac index 256abc8..7b06f09 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_INIT(secnet,0.1.18+,secnet@chiark.greenend.org.uk) AC_CONFIG_SRCDIR(secnet.c) AC_CONFIG_HEADER(config.h) -SUBDIRMK_SUBDIRS([test-example mtest stest]) +SUBDIRMK_SUBDIRS([test-example mtest stest base91s]) AC_PREREQ(2.50) AC_REVISION($Id: configure.in,v 1.4 2002/09/09 22:05:02 steve Exp $) -- 2.30.2