This repository has been archived by the owner on Nov 14, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
package.sh
executable file
·50 lines (36 loc) · 1.27 KB
/
package.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
#!/bin/bash
echo "This script packages mcsema into a .deb package"
echo "Cleaning old diretories"
rm -rf ./deb-build
GIT_DATE=$(git log -n 1 --format="%ai")
DATE=$(date --utc --date="${GIT_DATE}" +%Y%m%d%H%M)
VERSION=0.1-${DATE}
echo "CodeReason Version is: ${VERSION}"
mkdir -p ./deb-build/codereason_${VERSION}/opt/codereason/bin/
cp -R ./debian ./deb-build/codereason_${VERSION}/DEBIAN
echo "Version: ${VERSION}" | cat - ./debian/control > ./deb-build/codereason_${VERSION}/DEBIAN/control
CR_BINS=$(find ./build/bin -executable -type f)
if [ "${CR_BINS}" == "" ]
then
echo "Could not find mcsema binaries. Did you build CodeReason?"
exit -1
fi
for BINFILE in ${CR_BINS}
do
echo "Packaging ${BINFILE}..."
cp ${BINFILE} ./deb-build/codereason_${VERSION}/opt/codereason/bin/
done
LLVM_BINS=$(find ./build/llvm-3.2.src/build/bin -executable -type f ! -name '*.so')
if [ "${LLVM_BINS}" == "" ]
then
echo "Could not find LLVM binaries. Did you build CodeReason?"
exit -1
fi
for BINFILE in ${LLVM_BINS}
do
echo "Packaging ${BINFILE}..."
cp ${BINFILE} ./deb-build/codereason_${VERSION}/opt/codereason/bin/
done
strip -s ./deb-build/codereason_${VERSION}/opt/codereason/bin/*
echo "Building .deb file..."
dpkg-deb -v --build ./deb-build/codereason_${VERSION}