diff --git a/package/build_deps.sh b/package/build_deps.sh new file mode 100755 index 00000000000..db8927798b7 --- /dev/null +++ b/package/build_deps.sh @@ -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 + diff --git a/package/make_srpm.sh b/package/make_srpm.sh new file mode 100755 index 00000000000..8006da13437 --- /dev/null +++ b/package/make_srpm.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# used to build nebula rpm files +# ./make-srpm.sh -v -p , 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 diff --git a/package/nebula.spec b/package/nebula.spec new file mode 100755 index 00000000000..0aa401e0573 --- /dev/null +++ b/package/nebula.spec @@ -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 + diff --git a/package/rpm_deps.sh b/package/rpm_deps.sh new file mode 100755 index 00000000000..746ee0a24e6 --- /dev/null +++ b/package/rpm_deps.sh @@ -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 + diff --git a/src/daemons/CMakeLists.txt b/src/daemons/CMakeLists.txt index 3e0e3f01b0b..4a5e864ce66 100644 --- a/src/daemons/CMakeLists.txt +++ b/src/daemons/CMakeLists.txt @@ -30,7 +30,7 @@ install(TARGETS nebula-graphd DESTINATION bin) add_executable( - storaged + nebula-storaged StorageDaemon.cpp $ $ @@ -51,17 +51,18 @@ add_executable( $ ) nebula_link_libraries( - storaged + nebula-storaged proxygenhttpserver proxygenlib ${ROCKSDB_LIBRARIES} ${THRIFT_LIBRARIES} wangle ) +install(TARGETS nebula-storaged DESTINATION bin) add_executable( - metad + nebula-metad MetaDaemon.cpp $ $ @@ -80,10 +81,11 @@ add_executable( $ ) nebula_link_libraries( - metad + nebula-metad proxygenhttpserver proxygenlib ${ROCKSDB_LIBRARIES} ${THRIFT_LIBRARIES} wangle ) +install(TARGETS nebula-metad DESTINATION bin)