-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-release.sh
executable file
·53 lines (46 loc) · 1.32 KB
/
build-release.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
#!/usr/bin/env -S bash -xe
VERSION=$(grep -Po "^project\(.*VERSION\s\K[0-9]+\.[0-9]+\.[0-9]+" CMakeLists.txt | tr -d "\n")
./build.sh
PKG=$(realpath "bmath_$VERSION"*.deb)
PKG_DBG=$(realpath "bmath-dbg_$VERSION"*.deb)
BINARY="bin/usr/bin/bmath"
BUILD_ID=$(readelf -n "$BINARY" | grep -Po 'Build ID:\s\K[0-9a-zA-Z]+')
BUILD_ID_START=${BUILD_ID:0:2}
BUILD_ID=${BUILD_ID:2}
DEBUG_BINARY="dbg/usr/lib/debug/.build-id/$BUILD_ID_START/$BUILD_ID.debug"
rm -rf dbg
mkdir -p $(dirname "$DEBUG_BINARY")
objcopy --only-keep-debug "$BINARY" "$DEBUG_BINARY"
strip --strip-debug --strip-unneeded "$BINARY"
objcopy --add-gnu-debuglink="$DEBUG_BINARY" "$BINARY"
chmod -x "$DEBUG_BINARY"
rm -f "$PKG" "$PKG_DBG"
fpm \
-s dir \
-t deb \
-v $VERSION \
-n bmath \
-a amd64 \
-m "Frederick Lawler <[email protected]>" \
--url "https://github.com/fredlawl/bmath" \
--description "64bit big-endian bitwise operation calculator" \
--license "MIT" \
-d "libncurses6" \
-d "libc6 >= 2.15" \
-d "libtinfo6" \
-C bin \
.
fpm \
-s dir \
-t deb \
-v $VERSION \
-n bmath-dbg \
-a amd64 \
-m "Frederick Lawler <[email protected]>" \
--url "https://github.com/fredlawl/bmath" \
--description "64bit big-endian bitwise operation calculator" \
--license "MIT" \
-d "bmath = $VERSION" \
--deb-priority optional \
-C dbg \
.