From ba9e21cb8c224cc2f2b26c41afdcae92652bf088 Mon Sep 17 00:00:00 2001 From: Fritz Zaucker Date: Tue, 5 Sep 2023 10:52:52 +0200 Subject: [PATCH] Update configure/make setup for Perl5 modules --- .gitignore | 8 +++++++ .tool-versions | 1 + Makefile.am | 34 +++++++------------------- VERSION | 2 +- configure.ac | 1 + cpanfile | 1 + thirdparty/Makefile.am | 54 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 75 insertions(+), 26 deletions(-) create mode 100644 .tool-versions create mode 100644 cpanfile create mode 100644 thirdparty/Makefile.am diff --git a/.gitignore b/.gitignore index 686f558c4..844400cd3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,11 @@ etc/*.yaml etc/*.secret public/ conftools/ +thirdparty/build.log +thirdparty/cache +thirdparty/carton/ +thirdparty/latest-build +thirdparty/touch +thirdparty/lib/ +thirdparty/work/ +thirdparty/bin/ diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..92d82d03c --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +perl system diff --git a/Makefile.am b/Makefile.am index 32c4ba575..60e117d30 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,33 +1,17 @@ -# Copyright (C) 2020 Fritz Zaucker +# Copyright (C) 2023 Fritz Zaucker -AUTOMAKE_OPTIONS = foreign +AUTOMAKE_OPTIONS = foreign -SUBDIRS = etc frontend -PUB := $(shell find -L public -type d \( -name ".??*" -o -name transpiled \) -prune -o -not -name "*db.json" -a -not -name "*.map" -a -not -name "*~" -a -not -name transpiled -a -not -name "*.tmp" -a -type f -print ) -SHARE := $(shell test -d share && find -L share -type d -name ".??*" -prune -o -not -name ".*" -a -not -name "*~" -a -not -name "*.tmp" -a -not -name '*.sql' -a -not -wholename '*/Docu/*' -a -not -wholename '*/Docu' -a -not -wholename '*/_Attic' -a -not -wholename '*/_Attic/*' -a -type f -print) - -PERLTESTS := $(shell find -L t -name "*.t") -PM := $(shell find -L lib -name "*.pm") - -#EXTRA_DIST = META6.json COPYRIGHT LICENSE CHANGES AUTHORS bootstrap $(PUB) $(POD) $(TEMPL) $(SHARE) - -EXTRA_DIST = META6.json COPYRIGHT bin lib/Agrammon bootstrap $(PUB) $(SHARE) # $(PERLTESTS) +SUBDIRS = thirdparty etc frontend -YEAR := $(shell date +%Y) -DATE := $(shell date +%Y-%m-%d) - -datadir = $(prefix) -nobase_data_DATA = $(PUB) $(TEMPL) $(SHARE) - -README.md COPYRIGHT: - $(PERL) -i -p -e 's/(#VERSION#|\d+\.\d+\.\d+[^.\s]*)/$(PACKAGE_VERSION)/g;s/(#YEAR#|20[1-9]\d)/$(YEAR)/g;s/(#DATE#|20[1-9]\d-[01]\d-[0-3]\d)/$(DATE)/g;' $@ +PUB := $(shell find -L public -type d \( -name ".??*" -o -name transpiled \) -prune -o -not -name "*db.json" -a -not -name "*.map" -a -not -name "*~" -a -not -name transpiled -a -not -name "*.tmp" -a -type f -print ) +TEMPL := $(shell test -d templates && find -L templates -type f -name "*.ep") +SHARE := $(shell test -d share && find -L share -type d -name ".??*" -prune -o -not -name ".*" -a -not -name "*~" -a -not -name "*.tmp" -a -type f -print) -LANGUAGES := $(shell $(PERL) -e 'use JSON::PP qw(decode_json); print join(" ", map {"share/".$$_.".po"} @{decode_json(join("",<>))->{locales}})' frontend/compile.json) +PERLTESTS := $(shell find t -name "*.t") +PM := $(shell find lib -name "*.pm") -test: - prove -j8 -e 'raku -Ilib' t +EXTRA_DIST = VERSION cpanfile COPYRIGHT LICENSE CHANGES AUTHORS bootstrap $(PUB) $(wildcard t/*.t) $(POD) $(TEMPL) $(PERLTESTS) $(SHARE) Dockerfile -unit-test: - AGRAMMON_UNIT_TEST=1 prove -j8 -e 'raku -Ilib' t diff --git a/VERSION b/VERSION index 798e38995..19b860c18 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.3.0 +6.4.0 diff --git a/configure.ac b/configure.ac index 36df524a3..b64433df2 100644 --- a/configure.ac +++ b/configure.ac @@ -154,6 +154,7 @@ AC_CONFIG_FILES([ Makefile etc/Makefile frontend/Makefile + thirdparty/Makefile ]) AC_SUBST(VERSION) diff --git a/cpanfile b/cpanfile new file mode 100644 index 000000000..ce89cddda --- /dev/null +++ b/cpanfile @@ -0,0 +1 @@ +requires 'Excel::Writer::XLSX'; diff --git a/thirdparty/Makefile.am b/thirdparty/Makefile.am new file mode 100644 index 000000000..6efed1e6c --- /dev/null +++ b/thirdparty/Makefile.am @@ -0,0 +1,54 @@ +# Copyright (C) 2023 Fritz Zaucker + +AUTOMAKE_OPTIONS = foreign + +THIRDPARTY_DIR := $(shell pwd) + +CPANSNAPV := cpanfile-$(shell $(PERL) -MConfig -e 'my $$v = $$Config{version}; $$v =~ s/\.\d+$$//; print $$v').snapshot + + +#EXTRA_DIST = $(THIRDPARTY_DIST) $(wildcard bin/cpanm) +EXTRA_DIST = bin/cpanm $(wildcard cpanfile*snapshot) + +all-local: touch + +touch: bin/cpanm $(CPANSNAPV) + $(AM_V_at)echo "** Installing Dependencies using $(CPANSNAPV)" + cp $(CPANSNAPV) ../cpanfile.snapshot + test -x carton/bin/carton || PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) $(PERL) bin/cpanm -q --notest --local-lib-contained $(THIRDPARTY_DIR)/carton Carton Date::Parse +# if ever DBD::ODBC is compiled, make sure we get the utf8 version + PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) DBD_ODBC_UNICODE=1 PERL5LIB=$(THIRDPARTY_DIR)/carton/lib/perl5 PERL_CARTON_PATH=$(THIRDPARTY_DIR) $(PERL) $(THIRDPARTY_DIR)/carton/bin/carton install + $(AM_V_at)rm -f ../cpanfile.snapshot + $(AM_V_at)touch touch + +bin/cpanm: + $(AM_V_at)mkdir -p bin + $(URL_CAT) https://cpanmin.us > bin/cpanm + $(AM_V_at)chmod 755 bin/cpanm + +$(CPANSNAPV): ../cpanfile + $(AM_V_at)echo "** Installing Dependencies using Carton install" + test -f $(CPANSNAPV) && cp $(CPANSNAPV) ../cpanfile.snapshot || true + test -x carton/bin/carton || PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) $(PERL) bin/cpanm -q --notest --local-lib-contained $(THIRDPARTY_DIR)/carton Carton Date::Parse +# if ever DBD::ODBC is compiled, make sure we get the utf8 version + PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) DBD_ODBC_UNICODE=1 PERL5LIB=$(THIRDPARTY_DIR)/carton/lib/perl5 PERL_CARTON_PATH=$(THIRDPARTY_DIR) $(PERL) $(THIRDPARTY_DIR)/carton/bin/carton install + mv ../cpanfile.snapshot $(CPANSNAPV) + $(AM_V_at)touch touch + +update: $(CPANSNAPV) + $(AM_V_at)echo "** Updating Dependencies using Carton update" + $(AM_V_at)cp $(CPANSNAPV) ../cpanfile.snapshot + $(AM_V_at)PERL_CPANM_OPT= PERL_CPANM_HOME=$(THIRDPARTY_DIR) PERL5LIB=$(THIRDPARTY_DIR)/carton/lib/perl5 PERL_CARTON_PATH=$(THIRDPARTY_DIR) $(PERL) $(THIRDPARTY_DIR)/carton/bin/carton update + $(AM_V_at)mv ../cpanfile.snapshot $(CPANSNAPV) + +clean-local: + ls -1 | grep -v Makefile | grep -v cpanfile |grep -v bin | xargs rm -rf + +distclean-local: + ls -1 | grep -v Makefile | grep -v cpanfile | xargs rm -rf + +install-exec-hook: + cp -fr lib/perl5/* $(DESTDIR)$(libdir) + cp -f bin/cover $(DESTDIR)$(bindir) + $(AM_V_at)echo "** Patching cover command" + $(PERL) -i -p -e 's{use warnings;}{use warnings;\nuse lib qw($(libdir));}' $(DESTDIR)$(bindir)/cover