-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake-redex-package.sh
More file actions
executable file
·91 lines (71 loc) · 1.87 KB
/
Copy pathmake-redex-package.sh
File metadata and controls
executable file
·91 lines (71 loc) · 1.87 KB
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
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
# Helper script to create redex archive.
# Stop on first error.
set -e
function build() {
TMP_DIR=`mktemp -d`
# Workaround for static linking failure on Fedora 29.
export CFLAGS="-L$(realpath .libs)"
autoreconf -ivf
./configure --prefix=${TMP_DIR}
if [ "${MAX_PARALLEL}" == "1" ]; then
make -j
else
make -j4
fi
make install
CONFIG_DIR="${CURRENT_DIR}/config"
if [ ! -d "${CONFIG_DIR}" ]; then
echo "Config directory not found, will not be packaged: ${CONFIG_DIR}"
else
mkdir ${TMP_DIR}/config
cp ${CONFIG_DIR}/*.config ${TMP_DIR}/config
fi
echo "Redex installed in ${TMP_DIR}, packaging..."
cd ${TMP_DIR}
rm -f ${REDEX_ZIP}
zip -r ${REDEX_ZIP} .
echo "Created archive: ${REDEX_ZIP}"
cd ${CURRENT_DIR}
rm -rf ${TMP_DIR}
}
function packageDeb() {
DEB_BUILD_DIR=credex-ubuntu-18.04
DEB_PREFIX=opt/credex
local ZIP_PATH="$1"
pushd packages
pushd ${DEB_BUILD_DIR}
rm -rf ${DEB_PREFIX}
mkdir -p ${DEB_PREFIX}
cd ${DEB_PREFIX}
unzip ${ZIP_PATH}
popd
dpkg-deb --build ${DEB_BUILD_DIR}
popd
}
for OPT in $*; do
if [ "${OPT}" == "--deb" ]; then
PACKAGE_DEB=1
elif [ "${OPT}" == "--max-parallel" ]; then
MAX_PARALLEL=1
elif [ "${OPT}" == "--skip-build" ]; then
SKIP_BUILD=1
elif [ "${OPT}" == "--help" ]; then
echo 'Usage: make-redex-package.sh [--deb]'
echo
echo 'Options:'
echo ' --deb Generate a .deb file (on Ubuntu).'
echo ' --max-parallel Use as many parallel workers in the make job server as possible.'
echo ' --skip-build Skip the build phase.'
exit
fi
done
CURRENT_DIR="${PWD}"
HEAD_HASH=`git rev-parse HEAD`
REDEX_ZIP="${CURRENT_DIR}/credex-${HEAD_HASH}.zip"
if [ "${SKIP_BUILD}" != "1" ]; then
build
fi
if [ "${PACKAGE_DEB}" == "1" ]; then
packageDeb "$(realpath ${REDEX_ZIP})"
fi