From 785d1fc8276a3ce9cd83f1031fb872f7103e7e28 Mon Sep 17 00:00:00 2001 From: "zongmei.zzm" Date: Wed, 17 Jul 2024 14:35:51 +0800 Subject: [PATCH] =?UTF-8?q?Add=20spec=20for=20hyperscan=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0hyperscan=20rpm=E5=8C=85=E6=9E=84=E5=BB=BA=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=20*=20add=20hyperscan=20deps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpm/devdeps-hyperscan-build.sh | 56 ++++++++++++++++++ rpm/devdeps-hyperscan.spec | 101 +++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 rpm/devdeps-hyperscan-build.sh create mode 100644 rpm/devdeps-hyperscan.spec diff --git a/rpm/devdeps-hyperscan-build.sh b/rpm/devdeps-hyperscan-build.sh new file mode 100644 index 0000000..9f3ae9e --- /dev/null +++ b/rpm/devdeps-hyperscan-build.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +CUR_DIR=$(dirname $(readlink -f "$0")) +ROOT_DIR=$CUR_DIR/.. +PROJECT_DIR=${1:-"$ROOT_DIR"} +PROJECT_NAME=${2:-"devdeps-hyperscan"} +VERSION=${3:-"5.4.2"} +RELEASE=${4:-"1"} + +# check source code +if [[ -z `find $ROOT_DIR -maxdepth 1 -regex ".*/hyperscan-v5.4.2.*[tar|gz|bz2|xz|zip]$"` ]]; then + echo "Download source code" + wget https://codeload.github.com/intel/hyperscan/tar.gz/refs/tags/v5.4.2 -O $ROOT_DIR/hyperscan-5.4.2.tar.gz --no-check-certificate +fi + +# download boost +if [[ -z `find $ROOT_DIR -maxdepth 1 -regex ".*/boost_1_84_0.*[tar|gz|bz2|xz|zip]$"` ]]; then + echo "Download boost library" + wget https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.gz -O $ROOT_DIR/boost_1_84_0.tar.gz --no-check-certificate +fi + +# download ragel +if [[ -z `find $ROOT_DIR -maxdepth 1 -regex ".*/rage-7.0.4.*[tar|gz|bz2|xz|zip]$"` ]]; then + echo "Download ragel source code" + wget http://www.colm.net/files/ragel/ragel-6.10.tar.gz -O $ROOT_DIR/ragel-6.10.tar.gz --no-check-certificate +fi + +os_release=`grep -Po '(?<=release )\d' /etc/redhat-release` +arch=`uname -p` + +# build dependenciescd +dep_pkgs=(obdevtools-gcc9-9.3.0-52022092914.el obdevtools-cmake-3.22.1-22022100417.el) + +target_dir_3rd=${PROJECT_DIR}/deps/3rd +pkg_dir=$target_dir_3rd/pkg +mkdir -p $pkg_dir +for dep_pkg in ${dep_pkgs[@]} +do + TEMP=$(mktemp -p "/" -u ".XXXX") + download_base_url="https://mirrors.aliyun.com/oceanbase/development-kit/el" + deps_url=${download_base_url}/${os_release}/${arch} + pkg=${dep_pkg}${os_release}.${arch}.rpm + echo "start to download pkg from "$deps_url + wget $deps_url/$pkg -O $pkg_dir/$TEMP + if [[ $? == 0 ]]; then + mv -f $pkg_dir/$TEMP $pkg_dir/$pkg + fi + (cd $target_dir_3rd && rpm2cpio $pkg_dir/$pkg | cpio -di -u --quiet) +done + +export TOOLS_DIR=$target_dir_3rd/usr/local/oceanbase/devtools +export DEP_DIR=$target_dir_3rd/usr/local/oceanbase/deps/devel + + +cd $CUR_DIR +bash $CUR_DIR/rpmbuild.sh $PROJECT_DIR $PROJECT_NAME $VERSION $RELEASE diff --git a/rpm/devdeps-hyperscan.spec b/rpm/devdeps-hyperscan.spec new file mode 100644 index 0000000..8526038 --- /dev/null +++ b/rpm/devdeps-hyperscan.spec @@ -0,0 +1,101 @@ +Name: devdeps-hyperscan +Version: 5.4.2 +Release: %(echo $RELEASE)%{?dist} +Summary: This is the repository for the Intel Hyperscan +License: https://github.com/intel/hyperscan/blob/master/LICENSE +AutoReqProv:no +%undefine _missing_build_ids_terminate_build +%define _build_id_links compat +%define _prefix /usr/local/oceanbase/deps/devel +%define _product_prefix hyperscan +%define _src hyperscan-5.4.2 +%define _boost boost_1_84_0 +%define _ragel ragel-6.10 + + +%description +This is the repository for the International Components for Unicode + +%define debug_package %{nil} +# support debuginfo package, to reduce runtime package size + +# prepare your files +%install +# create dirs +mkdir -p $RPM_BUILD_ROOT/%{_prefix}/lib +mkdir -p $RPM_BUILD_ROOT/%{_prefix}/include/%{_product_prefix} +cd $OLDPWD/../; + +export PATH=$TOOLS_DIR/bin/:$PATH +export CC=$TOOLS_DIR/bin/gcc +export CXX=$TOOLS_DIR/bin/g++ +export LD_LIBRARY_PATH=$TOOLS_DIR/lib64/:$DEP_DIR/lib/ +CPU_CORES=`grep -c ^processor /proc/cpuinfo` + +# prepare boost +rm -rf %{_boost} +tar xf %{_boost}.tar.gz +boost_dir=$(pwd)/%{_boost} +boost_install_dir=${boost_dir}/install +rm -rf ${boost_install_dir} +mkdir -p ${boost_install_dir} +cd ${boost_dir} +./bootstrap.sh --prefix=${boost_install_dir} +./b2 install + +# prepare ragel +cd ../ +rm -rf %{_ragel} +tar xf %{_ragel}.tar.gz +ragel_dir=$(pwd)/%{_ragel} +ragel_install_dir=${ragel_dir}/install +rm -rf ${ragel_install_dir} +mkdir -p ${ragel_install_dir} +cd ${ragel_dir} +./configure --prefix=${ragel_install_dir} +make -j${CPU_CORES} +make install +export PATH=${ragel_install_dir}/bin/:$PATH + +cd ../ +rm -rf %{_src} +tar xf %{_src}.tar.gz +cd %{_src} +source_dir=$(pwd) +tmp_install_dir=${source_dir}/tmp_install_dir +build_dir=${source_dir}/build +rm -rf ${tmp_install_dir} +rm -rf ${build_dir} +mkdir -p ${tmp_install_dir} +mkdir -p ${build_dir} + +# compile and install +cd ${build_dir} +cmake .. -DBOOST_ROOT=${boost_install_dir}/include -DCMAKE_POSITION_INDEPENDENT_CODE=on -DBUILD_STATIC_AND_SHARED=on -DCMAKE_INSTALL_PREFIX=${tmp_install_dir} +make -j${CPU_CORES} +make install + +# install files +cp -r ${tmp_install_dir}/lib64/*.a $RPM_BUILD_ROOT/%{_prefix}/lib +cp -r ${tmp_install_dir}/lib64/*.so.5.4.2 $RPM_BUILD_ROOT/%{_prefix}/lib +cp $RPM_BUILD_ROOT/%{_prefix}/lib/libhs.so.5.4.2 $RPM_BUILD_ROOT/%{_prefix}/lib/libhs.so.5 +cp $RPM_BUILD_ROOT/%{_prefix}/lib/libhs.so.5.4.2 $RPM_BUILD_ROOT/%{_prefix}/lib/libhs.so +cp -r ${tmp_install_dir}/include/* $RPM_BUILD_ROOT/%{_prefix}/include/%{_product_prefix} + + +# package infomation +%files +# set file attribute here +%defattr(-,root,root) +# need not list every file here, keep it as this +%{_prefix} +%exclude %dir %{_prefix} +%exclude %dir %{_prefix}/include +%exclude %dir %{_prefix}/lib + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%changelog +* Wed Nov 04 2024 zongmei.zzm +- version v5.4.2