forked from rethinkdb/rethinkdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-rpm.sh
executable file
·80 lines (67 loc) · 2.47 KB
/
build-rpm.sh
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
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# This script is used to build RethinkDB RPM on CentOS 6.4 and 7
#
# It requires:
# * The build dependencies: https://www.rethinkdb.com/docs/install/centos/
# * gem install fpm
set -eu
main () {
MAKEFLAGS=${MAKEFLAGS:- -j 8}
export MAKEFLAGS
ARCH=`gcc -dumpmachine | cut -f 1 -d -`
RPM_ROOT=build/packages/rpm
VERSION=`./scripts/gen-version.sh | sed -e s/-/_/g`
RPM_PACKAGE=build/packages/rethinkdb-$VERSION.$ARCH.rpm
SYMBOLS_FILE_IN=build/release/rethinkdb.debug
SYMBOLS_FILE_OUT=$RPM_PACKAGE.debug.bz2
DESCRIPTION='RethinkDB is built to store JSON documents, and scale to multiple servers with very little effort. It has a pleasant query language that supports really useful queries like table joins and group by.'
tmpfile BEFORE_INSTALL <<EOF
getent group rethinkdb >/dev/null || groupadd -r rethinkdb
getent passwd rethinkdb >/dev/null || \
useradd --system --no-create-home --gid rethinkdb --shell /sbin/nologin \
--comment "RethinkDB Daemon" rethinkdb
EOF
test -n "${NOCONFIGURE:-}" || ./configure --static all --fetch all --prefix=/usr --sysconfdir=/etc --localstatedir=/var
`make command-line` install DESTDIR=$RPM_ROOT BUILD_PORTABLE=1 ALLOW_WARNINGS=1 SPLIT_SYMBOLS=1
... () { command="$command $(for x in "$@"; do printf "%q " "$x"; done)"; }
GLIBC_VERSION=`rpm -qa --queryformat '%{VERSION}' glibc`
command=fpm
... -t rpm # Build an RPM package
... --package $RPM_PACKAGE
... --name rethinkdb
... --license AGPL
... --vendor RethinkDB
... --category Database
... --version "$VERSION"
... --iteration "`./scripts/gen-version.sh -r`"
... --depends "glibc >= $GLIBC_VERSION"
... --conflicts 'rethinkdb'
... --architecture "$ARCH"
... --maintainer 'RethinkDB <[email protected]>'
... --description "$DESCRIPTION"
... --url 'http://www.rethinkdb.com/'
... --before-install "$BEFORE_INSTALL"
... -s dir -C $RPM_ROOT # Directory containing the installed files
... usr etc var # Directories to package in the package
eval $command
bzip2 -c "$SYMBOLS_FILE_IN" > "$SYMBOLS_FILE_OUT"
}
tmpfile () {
local _file=`mktemp`
cat >"$_file"
at_exit rm "$_file"
eval "$1=$(printf %q "$_file")"
}
at_exit () {
local cmd=
for x in "$@"; do
cmd="$cmd $(printf %q "$x")"
done
AT_EXIT_ALL=${AT_EXIT_ALL:-}'
'"$cmd"
trap exit_handler EXIT
}
exit_handler () {
eval "$AT_EXIT_ALL"
}
main "$@"