From df7f5ab26e593b39bd5ee43b44246b703159beb3 Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Sat, 24 Oct 2020 15:48:07 +0200 Subject: [PATCH 1/7] Updated * Made it compatible with GNU Make on CentOS 7. * Defined it as a makefile for GNU Make (and not BSD Make). --- share/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/share/Makefile b/share/Makefile index dbfa91ba..c600ebad 100644 --- a/share/Makefile +++ b/share/Makefile @@ -1,12 +1,15 @@ +# This is the main Makefile in this directory and should be kept +# GNU Make compatible. + .POSIX: .SUFFIXES: .po .mo .PHONY: all dist touch-po update-po extract-pot DISTNAME = Zonemaster-CLI -POFILES != find . -maxdepth 1 -type f -name '*.po' +POFILES := $(shell find . -maxdepth 1 -type f -name '*.po' -exec basename {} \;) MOFILES := $(POFILES:%.po=%.mo) POTFILE = $(DISTNAME).pot -PMFILES != find ../lib -type f -name '*.pm' | sort +PMFILES := $(shell find ../lib -type f -name '*.pm' | sort) all: $(MOFILES) @echo From e25ada610993fb36c5cd4266315ec24efe2cbfbb Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Sat, 24 Oct 2020 15:51:02 +0200 Subject: [PATCH 2/7] Renamed to be GNU Make's primary file --- share/{Makefile => GNUmakefile} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename share/{Makefile => GNUmakefile} (100%) diff --git a/share/Makefile b/share/GNUmakefile similarity index 100% rename from share/Makefile rename to share/GNUmakefile From 1b16bb59fefff33bac421b8dc551d942e5bfd030 Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Sat, 24 Oct 2020 16:04:53 +0200 Subject: [PATCH 3/7] /Makefile should be ignored, but not */Makefile --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0ecdfc21..31f9ad3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -Makefile +/Makefile Makefile.old Build Build.bat From 3cedb5f7501a6d3f0fc3c79f4831b4abf2d940cb Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Sat, 24 Oct 2020 16:05:37 +0200 Subject: [PATCH 4/7] Wrapper Makefile for BSD Make --- share/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 share/Makefile diff --git a/share/Makefile b/share/Makefile new file mode 100644 index 00000000..a883f892 --- /dev/null +++ b/share/Makefile @@ -0,0 +1,15 @@ +# This is a wrapper for BSD Make (FreeBSD) to execute +# GNU Make (gmake) and the primary makefile GNUmakefile. + +GNUMAKE?= gmake +FILES != ls * + +# File targets should be evaluated by gmake. +.PHONY: all $(FILES) + +all: + @${GNUMAKE} $@ + +.DEFAULT: + @${GNUMAKE} $@ + From 1c6fe3938769da7f9ffaacd0d9d70d7974097bac Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Sat, 24 Oct 2020 21:08:36 +0200 Subject: [PATCH 5/7] Use gmake for FreeBSD for share/GNUmakefile --- MANIFEST | 2 ++ Makefile.PL | 25 +++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/MANIFEST b/MANIFEST index dfbe6830..27632379 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3,6 +3,7 @@ docs/Installation.md inc/Module/Install.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm +inc/Module/Install/External.pm inc/Module/Install/Fetch.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm @@ -18,6 +19,7 @@ META.yml README.md script/zonemaster-cli script/zonemaster-info +share/GNUmakefile share/Makefile share/locale/da/LC_MESSAGES/Zonemaster-CLI.mo share/locale/fr/LC_MESSAGES/Zonemaster-CLI.mo diff --git a/Makefile.PL b/Makefile.PL index 41944ad5..0e4a6a14 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -23,13 +23,30 @@ requires( 'Zonemaster::LDNS' => 2.0, ); +# Make all platforms include inc/Module/Install/External.pm +requires_external_bin 'find'; +if ($^O eq "freebsd") { + requires_external_bin 'gmake'; +}; + sub MY::postamble { - return <<'MAKE_FRAG'; - $(MYEXTLIB): share/Makefile - cd share && $(MAKE) all -MAKE_FRAG + my $sharemakefile = 'share/GNUmakefile'; + my $text; + if ($^O eq "freebsd") { + # Make FreeBSD use gmake for share + $text = q[GMAKE ?= "gmake"] . "\n" + . q[pure_all :: ] . "$sharemakefile\n" + . "\t" . q[cd share && $(GMAKE) all] . "\n"; + } else { + # Here Linux and GNU Make is assumed + $text = q[pure_all :: ] . "$sharemakefile\n" + . "\t" . q[cd share && $(MAKE) all] . "\n"; + }; + return $text; }; + + install_script 'zonemaster-cli'; install_share; From b9f8f9653e60f9ca8281a288c8332db41445ff9f Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Sat, 24 Oct 2020 21:09:55 +0200 Subject: [PATCH 6/7] Added installation of devel/gmake for FreeBSD --- docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Installation.md b/docs/Installation.md index b67e29b3..5bafb471 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -97,7 +97,7 @@ This instruction covers the following operating systems: 2) Install dependencies available from binary packages: ```sh - pkg install p5-JSON-XS p5-Locale-libintl p5-MooseX-Getopt p5-Text-Reflow + pkg install devel/gmake p5-JSON-XS p5-Locale-libintl p5-MooseX-Getopt p5-Text-Reflow ``` 3) Install Zonemaster::CLI: From 4a61ab5f47902a96e90a4ef655f4a875edf837ce Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Mon, 26 Oct 2020 10:58:35 +0100 Subject: [PATCH 7/7] Updated, but no change of logic. --- Makefile.PL | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 0e4a6a14..43971622 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -31,18 +31,16 @@ if ($^O eq "freebsd") { sub MY::postamble { my $sharemakefile = 'share/GNUmakefile'; - my $text; if ($^O eq "freebsd") { # Make FreeBSD use gmake for share - $text = q[GMAKE ?= "gmake"] . "\n" - . q[pure_all :: ] . "$sharemakefile\n" - . "\t" . q[cd share && $(GMAKE) all] . "\n"; + return "GMAKE ?= \"gmake\"\n" + . "pure_all :: $sharemakefile\n" + . "\tcd share && \$(GMAKE) all\n"; } else { # Here Linux and GNU Make is assumed - $text = q[pure_all :: ] . "$sharemakefile\n" - . "\t" . q[cd share && $(MAKE) all] . "\n"; + return "pure_all :: $sharemakefile\n" + . "\tcd share && \$(MAKE) all\n"; }; - return $text; };