]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
libtoolize: inline sourced helper scripts during install.
authorGary V. Vaughan <gary@gnu.org>
Thu, 11 Oct 2012 13:36:17 +0000 (20:36 +0700)
committerGary V. Vaughan <gary@gnu.org>
Fri, 12 Oct 2012 13:18:29 +0000 (20:18 +0700)
* build-aux/inline-source: New file.
* Makefile.am (inline_source): Path to inline-source script.
(EXTRA_DIST): Distribute inline-source too.
(helper_scripts): Remove.
(install-data-local): Inline sourced helper scripts during
installation.
Don't install helper_scripts.
(uninstall-hook): Don't uninstall helper_scripts.

Makefile.am
build-aux/inline-source [new file with mode: 0755]

index 9c699d1fffbf356e6e7bc616e5a37f2f12143801..747a01bef05708da7b9c4f372fb6190961a09e13 100644 (file)
@@ -86,6 +86,7 @@ configure_ac  = $(srcdir)/configure.ac
 config_status  = $(top_builddir)/config.status
 extract_trace  = $(srcdir)/$(aux_dir)/extract-trace
 funclib_sh     = $(srcdir)/$(aux_dir)/funclib.sh
+inline_source  = $(srcdir)/$(aux_dir)/inline-source
 libtoolize_in  = $(srcdir)/libtoolize.in
 ltmain_sh      = $(srcdir)/$(aux_dir)/ltmain.sh
 libtool_m4     = $(srcdir)/$(macro_dir)/libtool.m4
@@ -93,9 +94,9 @@ ltversion_in  = $(srcdir)/$(macro_dir)/ltversion.in
 ltversion_m4   = $(srcdir)/$(macro_dir)/ltversion.m4
 options_parser = $(srcdir)/$(aux_dir)/options-parser
 
-EXTRA_DIST     += $(extract_trace) $(funclib_sh) $(libtoolize_in) \
-                 $(ltmain_m4sh) $(ltmain_sh) $(ltversion_in) \
-                 $(ltversion_m4) $(options_parser)
+EXTRA_DIST     += $(extract_trace) $(funclib_sh) $(inline_source) \
+                 $(libtoolize_in) $(ltmain_m4sh) $(ltmain_sh) \
+                 $(ltversion_in) $(ltversion_m4) $(options_parser)
 
 ## These are the replacements that need to be made at bootstrap time,
 ## because they must be static in distributed files, and not accidentally
@@ -488,8 +489,6 @@ pkgltdl_files       = COPYING.LIB \
                  ltdl.mk \
                  slist.c
 
-helper_scripts = extract-trace funclib.sh options-parser
-
 install-data-local: $(lt_Makefile_in)
        @$(NORMAL_INSTALL)
 ## Don't install over the top of an old pkgdatadir
@@ -502,7 +501,7 @@ install-data-local: $(lt_Makefile_in)
          $(INSTALL_DATA) "$(srcdir)/$(macro_dir)/$$p" "$(DESTDIR)$(aclocaldir)/$$p"; \
        done
 ## install the helper scripts
-       @list='$(helper_scripts) $(pkgaux_scripts)' && \
+       @list='$(pkgaux_scripts)' && \
        for p in $$list; do \
          d=`echo "$(DESTDIR)$(pkgauxdir)/$$p" |$(SED) 's|[^/]*$$||'`; \
          test -d "$$d" || $(mkinstalldirs) "$$d"; \
@@ -522,9 +521,8 @@ install-data-local: $(lt_Makefile_in)
          echo " $(INSTALL_DATA) '$(ltdldir)/$$p' '$(DESTDIR)$(pkgdatadir)/$$p'"; \
          $(INSTALL_DATA) "$(ltdldir)/$$p" "$(DESTDIR)$(pkgdatadir)/$$p"; \
        done
-## Update direcory locations for installed libtoolize script
-       $(SED) -e "/^\\. /s|$(abs_aux_dir)|$(pkgauxdir)|g" libtoolize \
-         > '$(DESTDIR)$(bindir)/libtoolize';
+## Inline helper-scripts for installed libtoolize script
+       '$(inline_source)' libtoolize > '$(DESTDIR)$(bindir)/libtoolize';
        -chmod a+x '$(DESTDIR)$(pkgdatadir)/configure' '$(DESTDIR)$(bindir)/libtoolize'
 
 
@@ -596,7 +594,7 @@ uninstall-hook:
          echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
          rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
        done
-       @list='$(helper_scripts) $(pkgaux_scripts) $(pkgaux_data_files)'; \
+       @list='$(pkgaux_scripts) $(pkgaux_data_files)'; \
        for f in $$list; do \
          echo " rm -f '$(DESTDIR)$(pkgauxdir)/$$f'"; \
          rm -f "$(DESTDIR)$(pkgauxdir)/$$f"; \
diff --git a/build-aux/inline-source b/build-aux/inline-source
new file mode 100755 (executable)
index 0000000..aef25a0
--- /dev/null
@@ -0,0 +1,108 @@
+#! /bin/sh
+
+# Source required external libraries:
+. `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh"
+. `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser"
+
+# Set a version string for *this* script.
+scriptversion=2012-10-11.10; # UTC
+
+# Output the contents of a file with sourced files inlined.
+# Written by Gary V. Vaughan, 2012
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please report bugs or propose patches to bug-libtool@gnu.org.
+
+
+: ${AWK="awk"}
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# Run `build-aux/inline-source --help' for help with using this stript
+# from the command line.
+
+
+## ---------------- ##
+## Options parsing. ##
+## ---------------- ##
+
+usage='$progpath [OPTION]... FILE'
+
+# Short help message in response to `-h'.
+usage_message='Options:
+       --debug        enable verbose shell tracing
+       --version      print version information and exit
+   -h, --help         print help message and exit
+'
+
+long_help_message="\
+Report bugs to <bug-libtool@gnu.org>
+General help using GNU software: <http://www.gnu.org/gethelp/>."
+
+func_options ${1+"$@"}
+eval set dummy "$func_options_result"; shift
+
+
+## --------------- ##
+## Core functions. ##
+## --------------- ##
+
+# func_include LINE
+# -----------------
+# Output the contents of file included by LINE.
+func_include ()
+{
+    test -f "$1" \
+        || func_fatal_error "file '$1' not found"
+
+    _G_scriptdir=`echo "$1" |$SED 's|[^/]*$||'`
+    test -n "$_G_scriptdir" || _G_scriptdir="./"
+
+    $AWK '
+        /^\. ['\''"].*['\''"]$/ {
+            file = substr ($2, 2, length ($2) -2);
+           system (sprintf ("'$progpath' %s", file));
+            next;
+        }
+
+        /^\. `echo [^`]*`['\''"][^'\''"]*['\''"]$/ {
+            tail = substr ($0, match ($0, /`['\''"]/));
+           file = substr (tail, 3, length (tail) -3);
+           system (sprintf ("'$progpath' '"$_G_scriptdir"'%s", file));
+            next;
+        }
+
+        { print; }
+    ' < "$1"
+}
+
+func_include "$1"
+
+exit 0
+
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End: