comparison 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
comparison
equal deleted inserted replaced
1135:cf154e1f687a 1138:45de97d43e13
3 # Software engineering by Intevation GmbH 3 # Software engineering by Intevation GmbH
4 # 4 #
5 # This file is Free Software under the GNU GPL (v>=2) 5 # This file is Free Software under the GNU GPL (v>=2)
6 # and comes with ABSOLUTELY NO WARRANTY! 6 # and comes with ABSOLUTELY NO WARRANTY!
7 # See LICENSE.txt for details. 7 # See LICENSE.txt for details.
8
9 process_includes()
10 {
11 # Process include statements of the form:
12 # ###INCLUDE:filename
13 # in the file given as $1
14 # the path given as $2, it is used as base path for the included files.
15
16 local file="$1"
17 local include_base="$2"
18
19 local inc_directive
20 while [ "${inc_directive:=`grep '^###INCLUDE:' "$file" | head -1`}" ] ; do
21 local include_file="${inc_directive#'###INCLUDE:'}"
22 sed -i "/${inc_directive}/r ${include_base}/${include_file}" "$file"
23 sed -i "/${inc_directive}/d" "$file"
24 inc_directive=""
25 done
26 }
27
8 28
9 TMPDIR=$(mktemp -d) 29 TMPDIR=$(mktemp -d)
10 TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX") 30 TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX")
11 31
12 ARCH="$1" 32 ARCH="$1"
33 HELPFILES_IMG=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_images \ 53 HELPFILES_IMG=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_images \
34 -maxdepth 1 -type f -printf "%p \n") 54 -maxdepth 1 -type f -printf "%p \n")
35 HELPFILES_SOURCES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_sources \ 55 HELPFILES_SOURCES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_sources \
36 -maxdepth 1 -type f -printf "%p \n") 56 -maxdepth 1 -type f -printf "%p \n")
37 57
38 L10N_DE_FILE="@CMAKE_BINARY_DIR@/packaging/linux-installer.l10n-de"
39
40 # Make installation in TMPDIR, this is what we will put into the 58 # Make installation in TMPDIR, this is what we will put into the
41 # shar-archive. 59 # shar-archive.
42 echo "Using $TMPDIR for temporary installation to build installer..." 60 echo "Using $TMPDIR for temporary installation to build installer..."
43 install -d "$TMPDIR/bin" 61 install -d "$TMPDIR/bin"
44 install -d "$TMPDIR/share/pixmaps/trustbridge" 62 install -d "$TMPDIR/share/pixmaps/trustbridge"
49 install "${EXEFILES[@]}" "$TMPDIR/bin" 67 install "${EXEFILES[@]}" "$TMPDIR/bin"
50 install "$ICON" "$TMPDIR/share/pixmaps/trustbridge/trustbridge.png" 68 install "$ICON" "$TMPDIR/share/pixmaps/trustbridge/trustbridge.png"
51 69
52 echo "Building $INSTALLER..." 70 echo "Building $INSTALLER..."
53 cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER" 71 cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER"
72 process_includes "$INSTALLER" "@CMAKE_BINARY_DIR@/packaging"
73
54 binnames="" 74 binnames=""
55 for file in "${EXEFILES[@]}" ; do 75 for file in "${EXEFILES[@]}" ; do
56 binnames="`basename $file` $binnames" 76 binnames="`basename $file` $binnames"
57 done 77 done
58 for file in ${HELPFILES} ; do 78 for file in ${HELPFILES} ; do
77 shar -z -B `find -type f` | sed 's/^exit 0//' >>"$TMPSHAR" 97 shar -z -B `find -type f` | sed 's/^exit 0//' >>"$TMPSHAR"
78 98
79 sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER" 99 sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER"
80 sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER" 100 sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER"
81 sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER" 101 sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER"
82 sed -i "/###L10N_DE###/r $L10N_DE_FILE" "$INSTALLER"
83 sed -i "s/###HELPNAMES###/${helpnames}/" "$INSTALLER" 102 sed -i "s/###HELPNAMES###/${helpnames}/" "$INSTALLER"
84 sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$INSTALLER" 103 sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$INSTALLER"
85 sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$INSTALLER" 104 sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$INSTALLER"
86 sed -i "s/###HELPNAMES_IMG###/${helpnames_img}/" "$INSTALLER" 105 sed -i "s/###HELPNAMES_IMG###/${helpnames_img}/" "$INSTALLER"
87 sed -i "s/###ARCH###/${ARCH}/" "$INSTALLER" 106 sed -i "s/###ARCH###/${ARCH}/" "$INSTALLER"

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