~michaeleguo/ubuntu/trusty/percona-xtradb-cluster-5.5/arm64fix

« back to all changes in this revision

Viewing changes to build-ps/build-dpkg.sh

  • Committer: Package Import Robot
  • Author(s): Rafael David Tinoco
  • Date: 2016-07-16 20:24:11 UTC
  • mfrom: (5.1.1 trusty-security)
  • Revision ID: package-import@ubuntu.com-20160716202411-wqt0uhix3mzbyhr6
Tags: 5.5.37-25.10+dfsg-0ubuntu0.14.04.2
d/p/fix_tc_log_initlization_on_ppc64.patch: Fix log-tc-size for bigger
page sizes to fix crash on ppc64el (LP: #1570678)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Usage: build-dpkg.sh [target dir]
 
3
# The default target directory is the current directory. If it is not
 
4
# supplied and the current directory is not empty, it will issue an error in
 
5
# order to avoid polluting the current directory after a test run.
 
6
#
 
7
# The program will setup the dpkg building environment and ultimately call
 
8
# dpkg-buildpackage with the appropiate parameters.
 
9
#
 
10
 
 
11
# Bail out on errors, be strict
 
12
set -ue
 
13
 
 
14
# Examine parameters
 
15
go_out="$(getopt --options "k:Ke:bBDS" \
 
16
    --longoptions key:,nosign,epoch:,binary,binarydep,nodebug,source \
 
17
    --name "$(basename "$0")" -- "$@")"
 
18
test $? -eq 0 || exit 1
 
19
eval set -- $go_out
 
20
 
 
21
BUILDPKG_KEY=''
 
22
EPOCH=''
 
23
DPKG_BINSRC=''
 
24
SKIPDEBUG=''
 
25
 
 
26
for arg
 
27
do
 
28
    case "$arg" in
 
29
    -- ) shift; break;;
 
30
    -k | --key ) shift; BUILDPKG_KEY="-pgpg -k$1"; shift;;
 
31
    -K | --nosign ) shift; BUILDPKG_KEY="-uc -us";;
 
32
    -e | --epoch ) shift; EPOCH="$1:"; shift;;
 
33
    -b | --binary ) shift; DPKG_BINSRC='-b';;
 
34
    -B | --binarydep ) shift; DPKG_BINSRC='-B';;
 
35
    -D | --nodebug ) shift; SKIPDEBUG='yes';;
 
36
    -S | --source ) shift; DPKG_BINSRC='-S';;
 
37
    esac
 
38
done
 
39
 
 
40
# Working directory
 
41
if test "$#" -eq 0
 
42
then
 
43
    WORKDIR="$(pwd)"
 
44
 
 
45
    # Check that the current directory is not empty
 
46
    if test "x$(echo *)" != "x*"
 
47
    then
 
48
        echo >&2 \
 
49
            "Current directory is not empty. Use $0 . to force build in ."
 
50
        exit 1
 
51
    fi
 
52
 
 
53
elif test "$#" -eq 1
 
54
then
 
55
    WORKDIR="$1"
 
56
 
 
57
    # Check that the provided directory exists and is a directory
 
58
    if ! test -d "$WORKDIR"
 
59
    then
 
60
        echo >&2 "$WORKDIR is not a directory"
 
61
        exit 1
 
62
    fi
 
63
 
 
64
else
 
65
    echo >&2 "Usage: $0 [target dir]"
 
66
    exit 1
 
67
 
 
68
fi
 
69
 
 
70
SOURCEDIR="$(cd $(dirname "$0"); cd ..; pwd)"
 
71
test -e "$SOURCEDIR/Makefile" || exit 2
 
72
 
 
73
# The number of processors is a good default for -j
 
74
if test -e "/proc/cpuinfo"
 
75
then
 
76
    PROCESSORS="$(grep -c ^processor /proc/cpuinfo)"
 
77
else
 
78
    PROCESSORS=4
 
79
fi
 
80
 
 
81
# Extract version from the Makefile
 
82
MYSQL_VERSION="$(grep ^MYSQL_VERSION= "$SOURCEDIR/Makefile" \
 
83
    | cut -d = -f 2)"
 
84
WSREP_VERSION="$(grep WSREP_INTERFACE_VERSION "$SOURCEDIR/wsrep/wsrep_api.h" |
 
85
    cut -d '"' -f2).$(grep 'SET(WSREP_PATCH_VERSION' \
 
86
    "$SOURCEDIR/cmake/wsrep.cmake" | cut -d '"' -f2)"
 
87
PERCONA_SERVER_VERSION="$(grep ^PERCONA_SERVER_VERSION= "$SOURCEDIR/Makefile" | cut -d = -f 2)"
 
88
PRODUCT="Percona-XtraDB-Cluster-$MYSQL_VERSION"
 
89
DEBIAN_VERSION="$(lsb_release -sc)"
 
90
 
 
91
# Build information
 
92
export REVISION="$(cd "$SOURCEDIR"; bzr revno)"
 
93
export WSREP_REV="$(cd "$SOURCEDIR";test -r WSREP-REVISION && cat WSREP-REVISION || echo "$REVISION")"
 
94
export DEB_BUILD_OPTIONS='debug nocheck'
 
95
export BB_PERCONA_REVISION="$(cd "$SOURCEDIR"; bzr revno)"
 
96
 
 
97
# Compilation flags
 
98
export CC="${CC:-gcc}"
 
99
export CXX="${CXX:-gcc}"
 
100
export HS_CXX=${HS_CXX:-g++}
 
101
export UDF_CXX=${UDF_CXX:-g++}
 
102
export CFLAGS="-fPIC -Wall -O3 -g -static-libgcc -fno-omit-frame-pointer -DPERCONA_INNODB_VERSION=$PERCONA_SERVER_VERSION ${CFLAGS:-}"
 
103
export CXXFLAGS="-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fno-exceptions -DPERCONA_INNODB_VERSION=$PERCONA_SERVER_VERSION ${CXXFLAGS:-}"
 
104
export MAKE_JFLAG="${MAKE_JFLAG:--j$PROCESSORS}"
 
105
 
 
106
# Prepare sources
 
107
(
 
108
    cd "$SOURCEDIR"
 
109
    make all
 
110
)
 
111
 
 
112
# Build
 
113
(
 
114
    # Make a copy in workdir and copy debian files
 
115
    cd "$WORKDIR"
 
116
 
 
117
    rm -rf "$PRODUCT/"
 
118
    cp -a "$SOURCEDIR/$PRODUCT/" .
 
119
    (
 
120
        cd "$PRODUCT/"
 
121
 
 
122
        # Copy debian files from source
 
123
        cp -R "$SOURCEDIR/build/debian" .
 
124
        chmod +x debian/rules
 
125
 
 
126
        # If nodebug is set, do not ship mysql-debug
 
127
        if test "x$SKIPDEBUG" = "xyes"
 
128
        then
 
129
            sed -i '/mysqld-debug/d' debian/percona-server-server-5.5.install
 
130
        fi
 
131
 
 
132
        # Update distribution name
 
133
        dch -m -D "$DEBIAN_VERSION" --force-distribution -v "$EPOCH$MYSQL_VERSION-$WSREP_VERSION-$BB_PERCONA_REVISION.$DEBIAN_VERSION" 'Update distribution'
 
134
 
 
135
        DEB_CFLAGS_APPEND="$CFLAGS" DEB_CXXFLAGS_APPEND="$CXXFLAGS" \
 
136
                SKIP_DEBUG_BINARY="$SKIPDEBUG" \
 
137
                dpkg-buildpackage $DPKG_BINSRC -rfakeroot $BUILDPKG_KEY
 
138
 
 
139
    )
 
140
 
 
141
    rm -rf "$PRODUCT"
 
142
 
 
143
)