From 9f9841eb7327c9fe73e84e197fd2965a97b639cf Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Wed, 15 Jun 2016 10:40:36 +0300 Subject: Don't make assumptions about build tools paths One more followup to https://github.com/erlang/otp/pull/1056 and https://github.com/erlang/otp/pull/1023 This time it's about `/usr/bin/env` and `/bin/cp`: - `/usr/bin/env` in `diameterc` was used to find the bootstrapped `escript` executable. Changed it to exlpicit call to `escript` in Makefile. - `/usr/bin/env` and `/bin/cp` were referenced in documentation build/install process. Now full paths to this tools are injected using autoconf magic. --- configure.in | 7 +++++++ erts/configure.in | 5 +++++ lib/debugger/doc/src/Makefile | 2 +- lib/diameter/src/Makefile | 2 +- lib/gs/doc/src/Makefile | 2 +- lib/ic/doc/src/Makefile | 2 +- lib/jinterface/doc/src/Makefile | 2 +- make/emd2exml.in | 2 +- make/otp.mk.in | 1 + 9 files changed, 19 insertions(+), 6 deletions(-) mode change 100644 => 100755 make/emd2exml.in diff --git a/configure.in b/configure.in index 8a7f372a50..ea98dc9836 100644 --- a/configure.in +++ b/configure.in @@ -129,6 +129,13 @@ AC_PROG_CC AC_PROG_CXX AC_CHECK_TOOL(LD, [ld]) +_search_path=/bin:/usr/bin:/usr/local/bin:$PATH + +AC_PATH_PROG(ENV, [env], false, $_search_path) +if test "$ac_cv_path_ENV" = false; then + AC_MSG_ERROR([No 'env' command found]) +fi + # # We need GNU make, complain if we can't find it # diff --git a/erts/configure.in b/erts/configure.in index 81ecad4f51..7986a55911 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -738,6 +738,11 @@ if test "$ac_cv_path_MKDIR" = false; then AC_MSG_ERROR([No 'mkdir' command found]) fi +AC_PATH_PROG(CP, cp, false, $_search_path) +if test "$ac_cv_path_CP" = false; then + AC_MSG_ERROR([No 'cp' command found]) +fi + _search_path= diff --git a/lib/debugger/doc/src/Makefile b/lib/debugger/doc/src/Makefile index 6c9617ca69..0f724b6f17 100644 --- a/lib/debugger/doc/src/Makefile +++ b/lib/debugger/doc/src/Makefile @@ -114,7 +114,7 @@ release_docs_spec: docs $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - (/bin/cp -rf $(HTMLDIR) "$(RELSYSDIR)/doc") + ($(CP) -rf $(HTMLDIR) "$(RELSYSDIR)/doc") $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" diff --git a/lib/diameter/src/Makefile b/lib/diameter/src/Makefile index 7f61620fc1..6bf748a727 100644 --- a/lib/diameter/src/Makefile +++ b/lib/diameter/src/Makefile @@ -123,7 +123,7 @@ ERL_COMPILE_FLAGS += \ # erl/hrl from dictionary file. gen/diameter_gen_%.erl gen/diameter_gen_%.hrl: dict/%.dia $(dia_verbose) \ - ../bin/diameterc -o gen -i $(EBIN) $< + escript ../bin/diameterc -o gen -i $(EBIN) $< opt: $(TARGET_FILES) diff --git a/lib/gs/doc/src/Makefile b/lib/gs/doc/src/Makefile index b270bc84fe..a24ec77e31 100644 --- a/lib/gs/doc/src/Makefile +++ b/lib/gs/doc/src/Makefile @@ -148,7 +148,7 @@ release_docs_spec: docs $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - (/bin/cp -rf $(HTMLDIR) "$(RELSYSDIR)/doc") + ($(CP) -rf $(HTMLDIR) "$(RELSYSDIR)/doc") $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" diff --git a/lib/ic/doc/src/Makefile b/lib/ic/doc/src/Makefile index c9691df7af..19f12ac6b9 100644 --- a/lib/ic/doc/src/Makefile +++ b/lib/ic/doc/src/Makefile @@ -225,7 +225,7 @@ release_docs_spec: docs $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - (/bin/cp -rf $(HTMLDIR) "$(RELSYSDIR)/doc") + ($(CP) -rf $(HTMLDIR) "$(RELSYSDIR)/doc") $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" $(INSTALL_DATA) $(MAN3_FILES) "$(RELEASE_PATH)/man/man3" diff --git a/lib/jinterface/doc/src/Makefile b/lib/jinterface/doc/src/Makefile index cd1e61a795..508c8e01b5 100644 --- a/lib/jinterface/doc/src/Makefile +++ b/lib/jinterface/doc/src/Makefile @@ -166,7 +166,7 @@ release_docs_spec: docs $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" $(INSTALL_DIR) "$(RELSYSDIR)/doc/html/java/$(JAVA_PKG_PATH)" $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - (/bin/cp -rf ../html "$(RELSYSDIR)/doc") + ($(CP) -rf ../html "$(RELSYSDIR)/doc") # $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \ # "$(RELSYSDIR)/doc/html" diff --git a/make/emd2exml.in b/make/emd2exml.in old mode 100644 new mode 100755 index 903d707716..b4e052fef5 --- a/make/emd2exml.in +++ b/make/emd2exml.in @@ -1,4 +1,4 @@ -#!/usr/bin/env escript +#!@ENV@ escript %% -*- erlang -*- %%! -smp disable diff --git a/make/otp.mk.in b/make/otp.mk.in index c05c499d66..45eda71127 100644 --- a/make/otp.mk.in +++ b/make/otp.mk.in @@ -260,6 +260,7 @@ DEFAULT_GIF_FILES = $(HTMLDIR)/min_head.gif XSLTPROC = @XSLTPROC@ FOP = @FOP@ XMLLINT = @XMLLINT@ +CP = @CP@ DOCGEN=$(ERL_TOP)/lib/erl_docgen FOP_CONFIG = $(DOCGEN)/priv/fop.xconf -- cgit v1.2.3 From 0e00f80fb74f8f449eacf237e84a698a5555e7bd Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Tue, 21 Jun 2016 18:01:54 +0300 Subject: Use perl discovered by configure --- erts/configure.in | 14 ++++++++--- make/make_emakefile | 66 -------------------------------------------------- make/make_emakefile.in | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 70 deletions(-) delete mode 100755 make/make_emakefile create mode 100755 make/make_emakefile.in diff --git a/erts/configure.in b/erts/configure.in index 7986a55911..6ffd20f210 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -4821,8 +4821,7 @@ dnl Output the result. dnl ---------------------------------------------------------------------- dnl Note that the output files are relative to $srcdir - -AC_OUTPUT( +AC_CONFIG_FILES([ emulator/$host/Makefile:emulator/Makefile.in epmd/src/$host/Makefile:epmd/src/Makefile.in etc/common/$host/Makefile:etc/common/Makefile.in @@ -4832,15 +4831,22 @@ AC_OUTPUT( Makefile:Makefile.in ../make/$host/otp.mk:../make/otp.mk.in ../make/$host/otp_ded.mk:../make/otp_ded.mk.in +]) + +AC_CONFIG_FILES([../make/make_emakefile:../make/make_emakefile.in], + [chmod +x ../make/make_emakefile]) + dnl dnl The ones below should be moved to their respective lib dnl +dnl ../lib/ssl/c_src/$host/Makefile:../lib/ssl/c_src/Makefile.in +AC_CONFIG_FILES([ ../lib/ic/c_src/$host/Makefile:../lib/ic/c_src/Makefile.in ../lib/os_mon/c_src/$host/Makefile:../lib/os_mon/c_src/Makefile.in -dnl ../lib/ssl/c_src/$host/Makefile:../lib/ssl/c_src/Makefile.in ../lib/crypto/c_src/$host/Makefile:../lib/crypto/c_src/Makefile.in ../lib/orber/c_src/$host/Makefile:../lib/orber/c_src/Makefile.in ../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in ../lib/tools/c_src/$host/Makefile:../lib/tools/c_src/Makefile.in - ) + ]) +AC_OUTPUT diff --git a/make/make_emakefile b/make/make_emakefile deleted file mode 100755 index 56440d9bf0..0000000000 --- a/make/make_emakefile +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env perl -# -*- cperl -*- - -use strict; - -my $key; -my @opts; -my @modules; -my $m; -my $o; - -foreach (@ARGV) { - if (/^\-I(.+)/) { - push(@opts,"{i,\"$1\"}"); - $key=0; - } - elsif (/^\-o(.+)/) { - push(@opts,"{outdir,\"$1\"}"); - $key=0; - } - elsif (/^\-D(.+)=(.+)/) { - push(@opts,"{d,\'$1\',$2}"); - $key=0; - } - elsif (/^\-D(.+)/) { - push(@opts,"{d,\'$1\'}"); - $key=0; - } - elsif (/^\+(.+)/) { - push(@opts,$1), - $key=0; - } - elsif (/^(\-(.+))$/) { - $key = $1; - } - elsif ($key eq "\-I") { - push(@opts,"{i,\"$_\"}"); - $key=0; - } - elsif ($key eq "\-o") { - push(@opts,"{outdir,\"$_\"}"); - $key=0; - } - elsif ($key) { - print "Warning: Ignoring invalid option \"$key $_\"\n"; - $key=0; - } - else { - push(@modules,"\'$_\'"), - $key=0; - } -}; - -$m = pop(@modules); -print "{[$m"; -foreach (@modules) { - print ",$_"; -}; - -$o = pop(@opts); -print "],[$o"; -foreach (@opts) { - print ",$_"; -}; - -print "]}.\n"; diff --git a/make/make_emakefile.in b/make/make_emakefile.in new file mode 100755 index 0000000000..fbca77887a --- /dev/null +++ b/make/make_emakefile.in @@ -0,0 +1,66 @@ +#!@PERL@ +# -*- cperl -*- + +use strict; + +my $key; +my @opts; +my @modules; +my $m; +my $o; + +foreach (@ARGV) { + if (/^\-I(.+)/) { + push(@opts,"{i,\"$1\"}"); + $key=0; + } + elsif (/^\-o(.+)/) { + push(@opts,"{outdir,\"$1\"}"); + $key=0; + } + elsif (/^\-D(.+)=(.+)/) { + push(@opts,"{d,\'$1\',$2}"); + $key=0; + } + elsif (/^\-D(.+)/) { + push(@opts,"{d,\'$1\'}"); + $key=0; + } + elsif (/^\+(.+)/) { + push(@opts,$1), + $key=0; + } + elsif (/^(\-(.+))$/) { + $key = $1; + } + elsif ($key eq "\-I") { + push(@opts,"{i,\"$_\"}"); + $key=0; + } + elsif ($key eq "\-o") { + push(@opts,"{outdir,\"$_\"}"); + $key=0; + } + elsif ($key) { + print "Warning: Ignoring invalid option \"$key $_\"\n"; + $key=0; + } + else { + push(@modules,"\'$_\'"), + $key=0; + } +}; + +$m = pop(@modules); +print "{[$m"; +foreach (@modules) { + print ",$_"; +}; + +$o = pop(@opts); +print "],[$o"; +foreach (@opts) { + print ",$_"; +}; + +print "]}.\n"; -- cgit v1.2.3