Bug 39849: Fix makefile target dependency order

This patch fixes the makefile target dependency order, so that it runs
in this order:
1. Build CSS and JS assets
2. Run pm_to_blib, which is the step that copies over most of Koha's files
into blib
3. Move 'vue/dist' files via "move_compiled_js" makefile target/step

To test:
1a. Run 'git archive --format=tar HEAD > "koha.orig.tar"'
1b. sudo mkdir /opt/koha /opt/build_koha
1c. sudo chown kohadev-koha /opt/koha /opt/build_koha
1d. mv koha.orig.tar /opt/build_koha/.
1e. cd /opt/build_koha
1f. tar xvf koha.orig.tar
2. Run "perl Makefile.PL"
Choose "single"
Choose "/opt/koha" for target directory
Choose the defaults for the rest
3. Run "make"
4. Note the first step is the CSS/JS build
5. Note the second step is the copying of files to "blib"
6. Run "find -name 'esm.js.map'" and note it appears in the regular
build location as well as in "blib"
7. Run "find -name 'swagger_bundle.json'" and note it appears in
the regular build location as well as in "blib"
8. Run "make install"
9. Run the above "find" commands using "/opt/koha" and note that
the files appear in the installed directory

Signed-off-by: Blou <philippe.blouin@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
David Cook 2025-05-07 07:04:30 +00:00 committed by Katrin Fischer
parent a2f190f01f
commit e429e642d6
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 9 additions and 4 deletions

View File

@ -1909,17 +1909,22 @@ sub top_targets {
my $inherited = shift->SUPER::top_targets(@_);
my $compile_step;
#NOTE: Make "all" depend on "compile_css_js"
$compile_step .= "all :: compile_css_js\n";
#NOTE: Make "all" depend on "compile_css_js" and "move_compiled_js", so that it runs those targets/steps
$compile_step .= "all :: compile_css_js move_compiled_js\n";
$compile_step .= "\t" . '$(NOECHO) $(NOOP)' . "\n";
$compile_step .= "\n";
#NOTE: Make compile_css_js depend on pm_to_blib, so we have access to the blib directory
$compile_step .= "compile_css_js: pm_to_blib\n";
#NOTE: Build CSS and Javascript assets
$compile_step .= "compile_css_js:\n";
$compile_step .= "\t" . '$(PERLRUN) build-resources.PL' . "\n";
$compile_step .= "\n";
#NOTE: Make move_compiled_js depend on compile_css_js, so we have our generated Javascript assets
#NOTE: Make move_compiled_js depend on pm_to_blib, so we have access to the blib directory
#NOTE: Copy the generated vue dist files into the relevant blib
$compile_step .= "move_compiled_js: compile_css_js pm_to_blib\n";
$compile_step .= "\t" . 'cp -r koha-tmpl/intranet-tmpl/prog/js/vue/dist blib/INTRANET_TMPL_DIR/prog/js/vue/' . "\n";
$compile_step .= "\n";
my $top_targets = $compile_step . "\n" . $inherited;
return $top_targets;