forked from vesoft-inc/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add spec file to build rpm (vesoft-inc#244)
* add spec file to build rpm * Address sherman-the-tank's comments * Fix compilation failure * Address steppenwolfyuetong's comments
- Loading branch information
1 parent
7803e72
commit 6aa7ae6
Showing
5 changed files
with
247 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# download deps for build nebula | ||
# TODO: we should check dependence's version after adapt to different system versions | ||
|
||
sudo yum -y install gcc gcc-c++ libstdc++-static cmake make autoconf automake | ||
sudo yum -y install flex gperf libtool bison unzip boost boost-devel boost-static | ||
sudo yum -y install krb5 openssl openssl-devel libunwind libunwind-devel | ||
sudo yum -y install ncurses ncurses-devel readline readline-devel python | ||
sudo yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
# used to build nebula rpm files | ||
# ./make-srpm.sh -v <version> -p <build path>, the version should be match tag name | ||
|
||
# the format of publish version is 'version-release' | ||
version="" | ||
rpmbuilddir="" | ||
|
||
prefix="/usr/local" | ||
bindir="$prefix/bin" | ||
datadir="$prefix/scripts" | ||
sysconfdir="$prefix/etc" | ||
|
||
# parsing arguments | ||
while getopts v:p: opt; | ||
do | ||
case $opt in | ||
v) | ||
version=$OPTARG | ||
;; | ||
p) | ||
rpmbuilddir=$OPTARG | ||
;; | ||
?) | ||
echo "Invalid option, use default arguments" | ||
;; | ||
esac | ||
done | ||
|
||
# version is null, get from tag name | ||
[[ -z $version ]] && version=`git describe --match 'v*' | sed 's/^v//'` | ||
[[ -z ${rpmbuilddir} ]] && rpmbuilddir="/tmp" | ||
|
||
if [[ -z $version ]]; then | ||
echo "version is null, exit" | ||
exit -1 | ||
fi | ||
|
||
rpm_version="" | ||
rpm_release="" | ||
|
||
# get release if the version has '-' | ||
if expr index $version '-' > /dev/null; then | ||
rpm_version=`echo $version | cut -d - -f 1` | ||
rpm_release=`echo $version | cut -d - -f 2` | ||
else | ||
rpm_version=$version | ||
rpm_release=0 | ||
fi | ||
|
||
echo "current version is [ $rpm_version ], release is [$rpm_release]" | ||
echo "current rpmbuild is [ $rpmbuilddir ]" | ||
|
||
# because of use the static third-party lib, the rpmbuild can't check the file in rpm packet, so change the check to warnning | ||
sudo sed -i "s/_unpackaged_files_terminate_build.*/_unpackaged_files_terminate_build 0/g" /usr/lib/rpm/macros | ||
|
||
# modify nebula.spec's version | ||
sed -i "s/@VERSION@/$rpm_version/g" nebula.spec | ||
sed -i "s/@RELEASE@/$rpm_release/g" nebula.spec | ||
|
||
# do rpmbuild | ||
rpmbuild -D"_topdir $rpmbuilddir" -D"_bindir $bindir" -D"_datadir $datadir" -D"_sysconfdir $sysconfdir" -ba nebula.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# | ||
# Create a SRPM which can be used to build nebula | ||
# | ||
# | ||
|
||
%global project_name nebula | ||
|
||
Name: %{project_name} | ||
Version: @VERSION@ | ||
Release: @RELEASE@%{?dist} | ||
Summary: %{project_name} | ||
License: GPL | ||
# the url to get tar.gz | ||
#URL: http:// | ||
# tar name, this is a temp name | ||
Source: %{project_name}-@VERSION@.tar.gz | ||
|
||
# BuildRoot dir | ||
BuildRoot:%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) | ||
|
||
# TODO: we should check dependence's version after adapt to different system versions | ||
BuildRequires: gcc, gcc-c++ | ||
BuildRequires: libstdc++-static | ||
BuildRequires: cmake | ||
BuildRequires: make | ||
BuildRequires: autoconf | ||
BuildRequires: automake | ||
BuildRequires: flex | ||
BuildRequires: gperf | ||
BuildRequires: libtool | ||
BuildRequires: bison | ||
BuildRequires: unzip | ||
BuildRequires: boost | ||
BuildRequires: boost-devel | ||
BuildRequires: boost-static | ||
BuildRequires: openssl | ||
BuildRequires: openssl-devel | ||
BuildRequires: libunwind | ||
BuildRequires: libunwind-devel | ||
BuildRequires: ncurses | ||
BuildRequires: ncurses-devel | ||
BuildRequires: readline | ||
BuildRequires: readline-devel | ||
BuildRequires: python | ||
BuildRequires: java-1.8.0-openjdk | ||
BuildRequires: java-1.8.0-openjdk-devel | ||
Requires: krb5 | ||
|
||
%description | ||
A high performance distributed graph database | ||
|
||
%prep | ||
%setup -q | ||
|
||
%build | ||
cmake ./ | ||
make -j | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
make install DESTDIR=%{buildroot} | ||
|
||
%package metad | ||
Summary: nebula meta server daemon | ||
Group: Applications/Databases | ||
%description metad | ||
metad is a daemon for manage metadata | ||
|
||
%package graphd | ||
Summary: graph daemon | ||
Group: Applications/Databases | ||
%description graphd | ||
graphd is a daemon for handle graph data | ||
|
||
%package storaged | ||
Summary: storaged daemon | ||
Group: Applications/Databases | ||
%description storaged | ||
storaged is a daemon for storage all data | ||
|
||
%package nebula | ||
Summary: nebula console client | ||
Group: Applications/Databases | ||
%description nebula | ||
|
||
%package storage_perf | ||
Summary: tool for storage | ||
Group: Applications/Databases | ||
%description storage_perf | ||
|
||
|
||
################################################################################# | ||
# the files include exe, config file, scriptlets | ||
################################################################################# | ||
# metad rpm | ||
%files metad | ||
%defattr(-,root,root,-) | ||
%{_bindir}/nebula-metad | ||
%{_datadir}/nebula-metad.service | ||
|
||
# TODO : add daemon to systemctl | ||
|
||
# after install , arg 1:install new packet, arg 2: update exist packet | ||
#%%post metad | ||
#%%systemd_post nebula-metad.service | ||
|
||
# before uninstall, arg 0:delete arg 1:update | ||
#%%preun metad | ||
#%%systemd_preun nebula-metad.service | ||
|
||
# upgrade, arg 0:delete arg 1:update | ||
#%%postun metad | ||
#%%systemd_postun nebula-metad.service | ||
|
||
# graphd rpm | ||
%files graphd | ||
%defattr(-,root,root,-) | ||
%{_bindir}/nebula-graphd | ||
%config(noreplace) %{_sysconfdir}/nebula-graphd.conf.default | ||
%{_datadir}/nebula-graphd.service | ||
|
||
# TODO : add daemon to systemctl | ||
|
||
#%%post graphd | ||
#%%systemd_post nebula-graphd.service | ||
|
||
#%%preun graphd | ||
#%%systemd_preun nebula-graphd.service | ||
|
||
#%%postun graphd | ||
#%%systemd_postun nebula-graphd.service | ||
|
||
%files storaged | ||
%defattr(-,root,root,-) | ||
%{_bindir}/nebula-storaged | ||
%{_datadir}/nebula-storaged.service | ||
|
||
#%%post storaged | ||
#%%systemd_post nebula-storaged.service | ||
|
||
#%%preun storaged | ||
#%%systemd_preun nebula-storaged.service | ||
|
||
#%%postun storaged | ||
#%%systemd_postun nebula-storaged.service | ||
|
||
%files nebula | ||
%defattr(-,root,root,-) | ||
%{_bindir}/nebula | ||
|
||
|
||
# storage_perf rpm | ||
#%%files storage_perf | ||
#%%defattr(-,root,root,-) | ||
#%%{_bindir}/storage_perf | ||
|
||
%changelog | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# download deps | ||
# TODO: we should check dependence's version after adapt to different system versions | ||
|
||
sudo yum -y install autoconf automake libtool cmake bison unzip boost gperf | ||
sudo yum -y install krb5 openssl openssl-devel libunwind libunwind-devel | ||
sudo yum -y install ncurses ncurses-devel readline readline-devel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters