~phablet-team/trust-store/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh

# Copyright (C) 2015 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Authored by: Michi Henning <michi.henning@canonical.com>
#              Thomas Voß <thomas.voss@canonical.com>
#              Robert Bruce Park <robert.park@canonical.com>

#
# Script to generate debian files for dual landing in Vivid (gcc 4.9 ABI)
# and Wily and later (gcc 5 ABI).
#
# This script is called from debian/rules and generates:
#
# - control
# - libtrust-store${soversion}.install
#
# For all but control, this is a straight substition and/or renaming exercise for each file.
#

set -e  # Fail if any command fails.

progname=$(basename $0)

[ $# -gt 1 ] && {
    echo "usage: $progname [path-to-debian-dir]" >&2
    exit 1
}
dir=$1
version_dir=$(mktemp -d)

[ -n "$dir" ] || dir="./debian"
[ -n "$SERIES" ] || SERIES="$(lsb_release -c -s)"

# Dump version numbers into files and initialize vars from those files.
sh ${dir}/get-versions.sh ${dir} ${version_dir}

export TRUST_STORE_SOVERSION=$(cat $version_dir/libtrust-store.soversion)

trap "rm -fr $version_dir" 0 INT TERM QUIT

process()
{
    cat <<EOF
# This file is autogenerated. DO NOT EDIT!
#
# Modifications should be made to $(basename "$1") instead.
# This file is regenerated automatically in the clean target.
#
EOF
    perl -pe 's/@([A-Z_]+)@/$ENV{$1} or die "$1 undefined"/eg' <"$1"
}

process "$dir/control.in" >"$dir/control"
process "$dir/libtrust-store.install.in" > "$dir/libtrust-store${TRUST_STORE_SOVERSION}.install"

exit 0