From e29753d01bff70064c8cfeaf245f8017e1289404 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 3 Apr 2024 14:17:57 +0000 Subject: [PATCH] Bug 35716: PoC **K-T-D TEST ONLY** At /kohadevbox/koha, run the following: - sudo cpan File::Copy::Recursive - sudo rm -rf /usr/share/koha - sudo perl Makefile.PL # press Enter on all prompts - sudo make install - find /usr/share/koha -name hello.js Notice the output: /usr/share/koha/opac/htdocs/opac-tmpl/js/hello.js /usr/share/koha/intranet/htdocs/intranet-tmpl/js/hello.js My first attemp was using the file_map that is used to PM but I failed. Even changing the code to allow for multiple targets in the file_map, the WriteMakefile will always only map 1 to 1 from the PM hashref. But PL_FILES allows for an array of destinations given one source. This patch needs more work as a SHARED_TMPL_DIR env variable would be ideal, amongst other improvements, but this is just a proof of concept to have others look at and see if they agree with this approach. --- Makefile.PL | 4 ++++ build-from-shared-tmpl.PL | 7 +++++++ koha-tmpl/shared-tmpl/js/hello.js | 0 3 files changed, 11 insertions(+) create mode 100644 build-from-shared-tmpl.PL create mode 100644 koha-tmpl/shared-tmpl/js/hello.js diff --git a/Makefile.PL b/Makefile.PL index a1ff82673d0..0c905f70f67 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -694,6 +694,10 @@ my $pl_files = { 'fix-perl-path.PL' => [ # this script ensures the correct shebang line for the platform installed on... 'blib' ], + 'build-from-shared-tmpl.PL' => [ + 'blib/OPAC_TMPL_DIR', + 'blib/INTRANET_TMPL_DIR' + ], }; push @{ $pl_files->{'rewrite-config.PL'} }, ( diff --git a/build-from-shared-tmpl.PL b/build-from-shared-tmpl.PL new file mode 100644 index 00000000000..de28f2a2e21 --- /dev/null +++ b/build-from-shared-tmpl.PL @@ -0,0 +1,7 @@ +use strict; +use Modern::Perl; +use File::Copy::Recursive qw(dircopy); + +my $basedir = (shift); + +dircopy( './koha-tmpl/shared-tmpl', $basedir ) or die("$!\n"); diff --git a/koha-tmpl/shared-tmpl/js/hello.js b/koha-tmpl/shared-tmpl/js/hello.js new file mode 100644 index 00000000000..e69de29bb2d -- 2.30.2