#!/bin/bash # Copyright (c) Huawei Technologies Co., Ltd. 2010-2018. All rights reserved. # description: the script that make install masstree # date: 2020-12-16 # version: 1.0 # history: # 2020-12-16 first version set -e # change compress type CUR_DIR=$(pwd) MASSTREE_PACKAGE=masstree-beta-0.9.0.tar.gz MASSTREE_PATCH=0001-masstree.patch MASSTREE_SOURCES_TMP_DIR=tmp LOCAL_DIR=$(dirname "${LOCAL_PATH}") MASSTREE_MEGRED_SOURCES_DIR=masstree-beta if [ -d ${MASSTREE_MEGRED_SOURCES_DIR} ]; then rm -rf ${MASSTREE_MEGRED_SOURCES_DIR} fi mkdir ${MASSTREE_MEGRED_SOURCES_DIR} tar -zxf $MASSTREE_PACKAGE -C $MASSTREE_MEGRED_SOURCES_DIR --strip-components 1 cd $MASSTREE_MEGRED_SOURCES_DIR patch -p1 < ../$MASSTREE_PATCH patch -p1 < ../0002-masstree_oom_fix.patch patch -p1 < ../0003-masstree_code_cleanup.patch patch -p1 < ../0004-masstree_reserved_nodes_fix.patch sed -i "s/LDFLAGS =/LDFLAGS = -fstack-protector-all -z,now/g" Makefile sed -i "s/\$(CXX) -shared/\$(CXX) -fstack-protector-all -Wl,-z,relro,-z,now -shared/g" Makefile make -sj rm -rf *.o cd .. LOCAL_DIR=$(dirname "${LOCAL_PATH}") INSTALL_DIR=${LOCAL_DIR}/../../output/kernel/dependency/masstree mkdir -p ${INSTALL_DIR}/comm/include mkdir -p ${INSTALL_DIR}/comm/lib cp ${MASSTREE_MEGRED_SOURCES_DIR}/*.h* ${INSTALL_DIR}/comm/include cp ${MASSTREE_MEGRED_SOURCES_DIR}/libmasstree.so ${INSTALL_DIR}/comm/lib