diff packaging/linux-createpackage.sh.in @ 1138:45de97d43e13

Implemented generic include mechanism.
author Sascha Wilde <wilde@intevation.de>
date Wed, 17 Sep 2014 17:20:23 +0200
parents cf154e1f687a
children a72d59f8c3ea
line wrap: on
line diff
--- a/packaging/linux-createpackage.sh.in	Wed Sep 17 15:06:03 2014 +0200
+++ b/packaging/linux-createpackage.sh.in	Wed Sep 17 17:20:23 2014 +0200
@@ -6,6 +6,26 @@
 # and comes with ABSOLUTELY NO WARRANTY!
 # See LICENSE.txt for details.
 
+process_includes()
+{
+  # Process include statements of the form:
+  # ###INCLUDE:filename
+  # in the file given as $1
+  # the path given as $2, it is used as base path for the included files.
+
+  local file="$1"
+  local include_base="$2"
+
+  local inc_directive
+  while [ "${inc_directive:=`grep '^###INCLUDE:' "$file" | head -1`}" ] ; do
+    local include_file="${inc_directive#'###INCLUDE:'}"
+    sed -i "/${inc_directive}/r ${include_base}/${include_file}" "$file"
+    sed -i "/${inc_directive}/d" "$file"
+    inc_directive=""
+  done
+}
+
+
 TMPDIR=$(mktemp -d)
 TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX")
 
@@ -35,8 +55,6 @@
 HELPFILES_SOURCES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_sources \
     -maxdepth 1 -type f -printf "%p \n")
 
-L10N_DE_FILE="@CMAKE_BINARY_DIR@/packaging/linux-installer.l10n-de"
-
 # Make installation in TMPDIR, this is what we will put into the
 # shar-archive.
 echo "Using $TMPDIR for temporary installation to build installer..."
@@ -51,6 +69,8 @@
 
 echo "Building $INSTALLER..."
 cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER"
+process_includes "$INSTALLER" "@CMAKE_BINARY_DIR@/packaging"
+
 binnames=""
 for file in "${EXEFILES[@]}" ; do
   binnames="`basename $file` $binnames"
@@ -79,7 +99,6 @@
 sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER"
 sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER"
 sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER"
-sed -i "/###L10N_DE###/r $L10N_DE_FILE" "$INSTALLER"
 sed -i "s/###HELPNAMES###/${helpnames}/" "$INSTALLER"
 sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$INSTALLER"
 sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$INSTALLER"

http://wald.intevation.org/projects/trustbridge/