Fix ElfFile crashing when opening short (<64 bytes) files.
[folly.git] / folly / build / build_debs_ubuntu_14.04.sh
1 #!/bin/sh -x
2
3 # Note: this script was written on Ubuntu 14.04 and will need work in order to
4 # work on additional platforms. This is left as an exercise for the reader.
5
6 set -e
7
8 BOOST_VERSION=${BOOST_VERSION:-1.54.0}
9 LIBEVENT_VERSION=${LIBEVENT_VERSION:-2.0-5}
10 SSL_VERSION=${SSL_VERSION:-1.0.0}
11
12 VERSION=${VERSION:-"$(sed 's/:/./' VERSION)"}
13 ITERATION=${ITERATION:-1}
14
15 DESTDIR=${DESTDIR:-$(mktemp -d)}
16 DEBUGDIR=${DEBUGDIR:-$DESTDIR/usr/lib/debug}
17 PKGDIR=${PKGDIR:-/tmp}
18
19 DESC="Folly is an open-source C++ library developed and used at Facebook
20   as a foundation for our infrastructure."
21 URL=https://github.com/facebook/folly
22 LICENSE="Apache License v2.0"
23 MAINTAINER="Folly Eng"
24
25 which fpm || (echo "Please install fpm from https://github.com/jordansissel/fpm" && exit 1)
26 [ -d "$DESTDIR" ]
27
28 # Make
29 [ -e ./configure ] || autoreconf -if
30 [ -e Makefile ] || ./configure --prefix=/usr
31 make
32 make install DESTDIR="$DESTDIR"
33
34 # Move symbols to debug file
35 [ -d "$DEBUGDIR/usr/lib" ] || mkdir -p "$DEBUGDIR/usr/lib"
36 find "$DESTDIR/usr/lib" -maxdepth 1 -iname "lib*.so.*" -type f \
37   -execdir objcopy --only-keep-debug {} "$DEBUGDIR/usr/lib/{}.debug" \; \
38   -execdir strip --strip-debug --strip-unneeded {} \; \
39   -execdir objcopy --add-gnu-debuglink "$DEBUGDIR/usr/lib/{}.debug" {} \;
40
41 # Build debs
42 fpm \
43   -s dir -t deb \
44   -n "libfolly$VERSION" \
45   -v "$VERSION" --iteration "$ITERATION" \
46   -p "$PKGDIR/NAME_VERSION-ITERATION_ARCH.deb" \
47   -C "$DESTDIR" \
48   --description "$DESC" \
49   --vendor Facebook \
50   --url "$URL" \
51   --license "$LICENSE" \
52   --maintainer "$MAINTAINER" \
53   --category libs \
54   --provides libfolly \
55   --depends libc6 \
56   --depends libstdc++6 \
57   --depends libboost-context"$BOOST_VERSION" \
58   --depends libboost-filesystem"$BOOST_VERSION" \
59   --depends libboost-program-options"$BOOST_VERSION" \
60   --depends libboost-regex"$BOOST_VERSION" \
61   --depends libboost-system"$BOOST_VERSION" \
62   --depends libboost-thread"$BOOST_VERSION" \
63   --depends libdouble-conversion1 \
64   --depends libevent-"$LIBEVENT_VERSION" \
65   --depends libgflags2 \
66   --depends libgoogle-glog0 \
67   --depends libicu52 \
68   --depends libjemalloc1 \
69   --depends liblz4-1 \
70   --depends liblzma5 \
71   --depends libsnappy1 \
72   --depends libssl"$SSL_VERSION" \
73   --depends zlib1g \
74   --exclude usr/lib/debug \
75   --exclude usr/lib/*.a \
76   --exclude usr/lib/*.la \
77   usr/lib
78
79 fpm \
80   -s dir -t deb \
81   -n libfolly-dev \
82   -v "$VERSION" --iteration "$ITERATION" \
83   -p "$PKGDIR/NAME_VERSION-ITERATION_ARCH.deb" \
84   -C "$DESTDIR" \
85   --description "$DESC" \
86   --vendor Facebook \
87   --url "$URL" \
88   --license "$LICENSE" \
89   --maintainer "$MAINTAINER" \
90   --category devel \
91   --depends "libfolly$VERSION" \
92   --exclude usr/lib/*.so* \
93   usr/include \
94   usr/lib/debug
95
96 echo "${DESTDIR}"
97