From 68664a647faafe43da7cb0986577ec7d9d69af01 Mon Sep 17 00:00:00 2001 From: Konstantin Romanov Date: Thu, 8 Sep 2016 09:30:36 -0500 Subject: [PATCH] Generate shebang header on make world stage. Shebang header points at camlrunm and in bytecode binaries. Most RPM/DEB build platforms use fake-root, while executing make install, but can use real root when executing make world. Thus, all paths should be defined before make install stage, i.e. at make world stage. --- src/.gitignore | 1 + src/launch/Makefile | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index fa44a41f..85b3cc9f 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -2,3 +2,4 @@ camlrunm config/m.h config/s.h +launch/header diff --git a/src/launch/Makefile b/src/launch/Makefile index f19c63c0..5daeb8c0 100644 --- a/src/launch/Makefile +++ b/src/launch/Makefile @@ -3,12 +3,13 @@ include ../Makefile.inc -all: mosml mosmlc mosmllex camlexec testprog - -# header cannot be generated until camlrunm is installed in $(BINDIR)... +all: header mosml mosmlc mosmllex camlexec testprog install: - echo "#!$(BINDIR)/camlrunm" > $(DESTDIR)$(LIBDIR)/header; + # header cannot be used until camlrunm is installed in $(BINDIR)... + # but we have to pregenerate it with directories of BUILD phase, since + # while packaging (RPM) "make install" runs with fake-root. + cp header $(DESTDIR)$(LIBDIR)/header; for script in mosml mosmlc mosmllex; do \ ${INSTALL_SCRIPT} $$script $(DESTDIR)$(BINDIR)/$$script; \ chmod a+x $(DESTDIR)$(BINDIR)/$$script; \ @@ -30,6 +31,8 @@ old_install: chmod a+x $(BINDIR)/$$script; \ done +header: + echo "#!$(BINDIR)/camlrunm" > header mosml: mosml.tpl sed -e "s|LIBDIR|$(LIBDIR)|" -e "s|BINDIR|$(BINDIR)|" mosml.tpl > mosml