-
Notifications
You must be signed in to change notification settings - Fork 3
/
do_SRPM.sh
executable file
·109 lines (87 loc) · 2.81 KB
/
do_SRPM.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
set -euxo pipefail
# upstream revision to checkout (use `git describe --tags`)
SYMBIOTIC_REV="v8.0.0-36-g46db2df"
rm -rf srpm
mkdir srpm
cd srpm
# clone symbiotic git repo, including its submodules
git clone --recurse-submodules --shallow-submodules \
https://github.com/staticafi/symbiotic.git
# checkout the specified upstream revision
git -C symbiotic checkout --recurse-submodules "$SYMBIOTIC_REV"
# package version
PKG=symbiotic
NV=$(grep 'VERSION=' symbiotic/lib/symbioticpy/symbiotic/options.py \
| cut -d "'" -f 2 | head -n 1 | sed 's/-/\./g')
TIMESTAMP=$(git log --pretty="%cd" --date=iso -1 | tr -d ':-' \
| tr ' ' . | cut -d . -f 1,2)
VER="$NV.$TIMESTAMP"
cat > $PKG.spec << EOF
Name: $PKG
Version: $VER
Release: 1%{?dist}
Summary: Tool for analysis of sequential computer programs written in C
License: MIT
URL: https://github.com/staticafi/%{name}
Source0: %{name}-%{version}.tar.xz
Source1: symbiotic2cs.py
Source2: csexec-symbiotic.sh
Patch0: build.patch
Patch1: hotfix.patch
Patch2: llvm-dynamic-link.patch
Patch3: llvm-11.patch
Patch4: llvm-13.patch
Patch5: llvm-14.patch
BuildRequires: gcc
BuildRequires: gcc-c++
# a bit hacky, but we tar the whole repository structure, so we can use git
# to generate all version tags during the build
BuildRequires: git
BuildRequires: clang
BuildRequires: cmake
BuildRequires: glibc-devel
BuildRequires: glibc-devel(x86-32)
BuildRequires: jsoncpp-devel
BuildRequires: llvm-devel
BuildRequires: make
BuildRequires: ncurses-devel
BuildRequires: python3
BuildRequires: sqlite-devel
BuildRequires: z3-devel
BuildRequires: zlib-devel
Requires: clang
Requires: llvm
Requires: python3
%description
Symbiotic is a tool for analysis of sequential computer programs written in the
programming language C. It can check all common safety properties like assertion
violations, invalid pointer dereference, double free, memory leaks, etc.
%prep
%autosetup -p1
%build
%set_build_flags
./system-build.sh %{?_smp_mflags}
%install
mkdir -p %{buildroot}/opt/%{name}
cp -pr install/* %{buildroot}/opt/%{name}
mkdir -p %{buildroot}%{_bindir}
install -m 755 %{SOURCE1} %{buildroot}%{_bindir}/symbiotic2cs
install -m 755 %{SOURCE2} %{buildroot}%{_bindir}/csexec-symbiotic
ln -sf /opt/symbiotic/bin/symbiotic %{buildroot}%{_bindir}/symbiotic
%check
cd tests
./run_tests.sh --with-integrity-check
%files
/opt/%{name}/
%{_bindir}/%{name}
%{_bindir}/symbiotic2cs
%{_bindir}/csexec-symbiotic
EOF
echo "Making $PKG-$VER.tar.xz"
mv symbiotic "$PKG-$VER"
tar -Jcf "$PKG-$VER.tar.xz" "$PKG-$VER"
cp ../{symbiotic2cs.py,csexec-symbiotic.sh,{build,hotfix,llvm-*}.patch} .
# Needed to build the SRPM with correct patches included
mock --buildsrpm --spec "$PKG.spec" --sources "$PWD" -r fedora-rawhide-x86_64 \
--resultdir "$PWD"