Skip to content

Commit 0648508

Browse files
authored
feat(package): add rpm build and dpkg build script (#238)
* feat(package): add dpkg package script
1 parent 8a6b3bd commit 0648508

File tree

5 files changed

+96
-0
lines changed

5 files changed

+96
-0
lines changed

dep/build.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
BASEDIR=$(dirname "$0")
2+
if [[ ! -d ${BASEDIR}/rocketmq_amd64/usr/local/include/ ]]; then
3+
mkdir -p ${BASEDIR}/rocketmq_amd64/usr/local/include/
4+
fi
5+
6+
if [[ ! -d ${BASEDIR}/rocketmq_amd64/usr/local/lib ]]; then
7+
mkdir -p ${BASEDIR}/rocketmq_amd64/usr/local/lib
8+
fi
9+
10+
cp -R ${BASEDIR}/../include/* ${BASEDIR}/rocketmq_amd64/usr/local/include/
11+
cp ${BASEDIR}/../bin/librocketmq.so ${BASEDIR}/rocketmq_amd64/usr/local/lib/
12+
cp ${BASEDIR}/../bin/librocketmq.a ${BASEDIR}/rocketmq_amd64/usr/local/lib/
13+
14+
VERSION=`cat ${BASEDIR}/rocketmq_amd64/DEBIAN/control | grep Version | awk -F ':' '{print $2}'| sed 's/^ *//'`
15+
dpkg-deb --build ${BASEDIR}/rocketmq_amd64 rocketmq_${VERSION}_amd64.deb

dep/rocketmq_amd64/DEBIAN/control

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Package: RocketMQ
2+
Version: 1.2.5
3+
Architecture: amd64
4+
Essential: no
5+
Priority: optional
6+
Depends:
7+
Maintainer: "Apache RocketMQ" <[email protected]>
8+
Description: This package is C++ client of Apache RocketMQ for debian and its derivertives like Ubuntu.

dep/rocketmq_amd64/DEBIAN/postinst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ldconfig

rpm/build.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
BASEDIR=$(dirname "$0")
2+
if [[ ! -d ${BASEDIR}/rocketmq_x64/CENTOS/ ]]; then
3+
echo "Can not find SPEC FILE"
4+
exit 1
5+
fi
6+
if [[ ! -d /root/rpmbuild/SOURCES/rocketmq/include ]]; then
7+
mkdir -p /root/rpmbuild/SOURCES/rocketmq
8+
mkdir -p /root/rpmbuild/SOURCES/rocketmq/include
9+
mkdir -p /root/rpmbuild/SOURCES/rocketmq/bin
10+
fi
11+
cp -R ${BASEDIR}/../include/* /root/rpmbuild/SOURCES/rocketmq/include
12+
cp ${BASEDIR}/../bin/librocketmq.so /root/rpmbuild/SOURCES/rocketmq/bin
13+
cp ${BASEDIR}/../bin/librocketmq.a /root/rpmbuild/SOURCES/rocketmq/bin
14+
cp ${BASEDIR}/rocketmq_x64/CENTOS/rocketmq-client-cpp.spec /root/rpmbuild/SPECS
15+
16+
rpmbuild -bb /root/rpmbuild/SPECS/rocketmq-client-cpp.spec
17+
18+
cp /root/rpmbuild/RPMS/*.rpm ${BASEDIR}/rocketmq_x64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
Summary: A C++ Client of Apache RocketMQ
3+
4+
Name: rocketmq-client-cpp
5+
Version: 1.2.5
6+
Release: centos
7+
Group: Apache
8+
License: APLv2
9+
Source: https://github.com/apache/rocketmq-client-cpp
10+
URL: http://rocketmq.apache.org/
11+
Distribution: Linux
12+
13+
%define _prefix /usr/local
14+
15+
AutoReqProv: no
16+
17+
%description
18+
A C++ Client of Apache RocketMQ
19+
20+
%prep
21+
22+
pwd
23+
24+
cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'
25+
26+
OS_VERSION=`cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'`
27+
28+
echo "OS_VERSION=${OS_VERSION}"
29+
30+
31+
%build
32+
33+
%install
34+
# create dirs
35+
mkdir -p $RPM_BUILD_ROOT%{_prefix}
36+
37+
# create dirs
38+
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
39+
mkdir -p $RPM_BUILD_ROOT%{_prefix}/include/rocketmq
40+
41+
# copy files
42+
cp -f ${RPM_SOURCE_DIR}/rocketmq/bin/librocketmq.so $RPM_BUILD_ROOT%{_prefix}/lib
43+
cp -f ${RPM_SOURCE_DIR}/rocketmq/bin/librocketmq.a $RPM_BUILD_ROOT%{_prefix}/lib
44+
cp -rf ${RPM_SOURCE_DIR}/rocketmq/include/* $RPM_BUILD_ROOT%{_prefix}/include/rocketmq
45+
46+
# package information
47+
%files
48+
# set file attribute here
49+
%defattr(-, root, root, 0755)
50+
%{_prefix}/lib
51+
%{_prefix}/include
52+
53+
%define debug_package %{nil}
54+
%define __os_install_post %{nil}

0 commit comments

Comments
 (0)