2018-05-14 18:15:53 +00:00
|
|
|
#!/bin/bash -e
|
2015-11-26 07:41:06 +00:00
|
|
|
|
|
|
|
OUTPUT_DIR=$PWD
|
|
|
|
|
2019-11-01 08:24:03 +00:00
|
|
|
SOURCE_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]})/..)
|
2015-11-26 07:41:06 +00:00
|
|
|
|
2019-11-01 18:36:57 +00:00
|
|
|
VERSION=$(cd "$SOURCE_DIR" && git describe --tags --abbrev=8 --dirty | tr - .)~upstream_centos7
|
2017-08-19 07:47:27 +00:00
|
|
|
|
2018-05-14 18:15:53 +00:00
|
|
|
DOCKER_TAG=$(docker build -q - <<EOS
|
|
|
|
FROM centos:7
|
2018-07-20 11:15:59 +00:00
|
|
|
RUN yum -y install epel-release centos-release-scl && yum-config-manager --enable rhel-server-rhscl-7-rpms && yum -y install rpm-build cmake3 make devtoolset-7-gcc-c++ wget sqlite-devel boost-devel zlib-devel
|
2018-05-14 18:15:53 +00:00
|
|
|
EOS
|
|
|
|
)
|
2015-11-26 07:41:06 +00:00
|
|
|
|
2018-05-14 18:15:53 +00:00
|
|
|
docker run --rm -i -v $SOURCE_DIR:/root/rpmbuild/SOURCES/laminar-$VERSION:ro -v $OUTPUT_DIR:/output $DOCKER_TAG bash -xe <<EOS
|
2018-07-20 11:15:59 +00:00
|
|
|
# for new gcc
|
|
|
|
export PATH=/opt/rh/devtoolset-7/root/usr/bin:\$PATH
|
2015-11-26 07:41:06 +00:00
|
|
|
|
|
|
|
mkdir /build
|
|
|
|
cd /build
|
|
|
|
|
2018-09-14 07:50:09 +00:00
|
|
|
wget -O capnproto.tar.gz https://github.com/capnproto/capnproto/archive/v0.7.0.tar.gz
|
2017-07-31 05:58:06 +00:00
|
|
|
wget -O rapidjson.tar.gz https://github.com/miloyip/rapidjson/archive/v1.1.0.tar.gz
|
2015-11-26 07:41:06 +00:00
|
|
|
md5sum -c <<EOF
|
2018-09-14 07:50:09 +00:00
|
|
|
a9de5f042f4cf05515c2d7dfc7f5df21 capnproto.tar.gz
|
2017-07-31 05:58:06 +00:00
|
|
|
badd12c511e081fec6c89c43a7027bce rapidjson.tar.gz
|
2015-11-26 07:41:06 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
tar xzf capnproto.tar.gz
|
|
|
|
tar xzf rapidjson.tar.gz
|
|
|
|
|
2018-09-14 07:50:09 +00:00
|
|
|
cd /build/capnproto-0.7.0/c++/
|
2017-07-31 05:58:06 +00:00
|
|
|
cmake3 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=off .
|
2015-11-26 07:41:06 +00:00
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
|
2017-07-31 05:58:06 +00:00
|
|
|
cd /build/rapidjson-1.1.0/
|
|
|
|
cmake3 -DRAPIDJSON_BUILD_EXAMPLES=off .
|
2015-11-26 07:41:06 +00:00
|
|
|
make install
|
|
|
|
|
|
|
|
cd
|
|
|
|
cat <<EOF > laminar.spec
|
|
|
|
Summary: Lightweight Continuous Integration Service
|
|
|
|
Name: laminar
|
|
|
|
Version: $VERSION
|
|
|
|
Release: 1
|
|
|
|
License: GPL
|
|
|
|
BuildRequires: systemd-units
|
2018-09-28 07:36:10 +00:00
|
|
|
Requires: sqlite zlib
|
2015-11-26 07:41:06 +00:00
|
|
|
|
|
|
|
%description
|
|
|
|
Lightweight Continuous Integration Service
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
|
|
|
%build
|
2018-05-14 18:09:23 +00:00
|
|
|
cmake3 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/ -DSYSTEMD_UNITDIR=%{_unitdir} %{_sourcedir}/laminar-$VERSION
|
2015-11-26 07:41:06 +00:00
|
|
|
pwd
|
|
|
|
make
|
|
|
|
|
|
|
|
%install
|
|
|
|
%make_install
|
|
|
|
|
|
|
|
%files
|
|
|
|
%{_bindir}/laminarc
|
|
|
|
%{_bindir}/laminard
|
|
|
|
%{_unitdir}/laminar.service
|
|
|
|
%config(noreplace) %{_sysconfdir}/laminar.conf
|
2018-10-16 17:20:43 +00:00
|
|
|
%{_datarootdir}/bash-completion/completions/laminarc
|
|
|
|
%{_datarootdir}/zsh/site-functions/_laminarc
|
2015-11-26 07:41:06 +00:00
|
|
|
|
|
|
|
%post
|
|
|
|
echo Creating laminar user with home in %{_sharedstatedir}/laminar
|
|
|
|
useradd -r -d %{_sharedstatedir}/laminar -s %{_sbindir}/nologin laminar
|
2019-11-09 19:59:37 +00:00
|
|
|
mkdir -p %{_sharedstatedir}/laminar/cfg/{jobs,contexts,scripts}
|
2015-11-26 07:41:06 +00:00
|
|
|
chown -R laminar: %{_sharedstatedir}/laminar
|
|
|
|
EOF
|
|
|
|
|
|
|
|
rpmbuild -ba laminar.spec
|
2015-12-06 13:07:16 +00:00
|
|
|
mv rpmbuild/RPMS/x86_64/laminar-$VERSION-1.x86_64.rpm /output/
|
2015-12-06 10:41:46 +00:00
|
|
|
EOS
|