iSulad/0144-update-centos-build-script.patch
liuxu 4e2be1f070 upgrade from upstream
Signed-off-by: liuxu <liuxu156@huawei.com>
2024-11-26 13:11:19 +08:00

190 lines
6.5 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 10aa1ba26eecdf044c1a97e05db53d286e19a3af Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Sat, 26 Oct 2024 18:24:21 +1400
Subject: [PATCH 144/156] update centos build script
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
CI/dockerfiles/Dockerfile-centos | 10 ++-
docs/build_docs/README_zh.md | 4 +
.../script/install_iSulad_on_Centos_7.sh | 83 +++----------------
3 files changed, 23 insertions(+), 74 deletions(-)
diff --git a/CI/dockerfiles/Dockerfile-centos b/CI/dockerfiles/Dockerfile-centos
index af3ce035..0b11014b 100644
--- a/CI/dockerfiles/Dockerfile-centos
+++ b/CI/dockerfiles/Dockerfile-centos
@@ -24,6 +24,11 @@
FROM centos:7.6.1810
MAINTAINER LiFeng <lifeng68@huawei.com>
+RUN sed -i 's/mirror.centos.org/archive.kernel.org\/centos-vault/g' /etc/yum.repos.d/*.repo
+RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
+RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
+RUN echo "sslverify=false" | tee -a /etc/yum.conf
+
# Install dependency package
RUN yum clean all && yum makecache && yum install -y epel-release && yum swap -y fakesystemd systemd && \
yum update -y && \
@@ -113,6 +118,9 @@ RUN git config --global http.sslverify false
# install rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+RUN mkdir -p /root/.cargo/
+RUN touch ${HOME}/.cargo/config
+
# configure rust
RUN echo "[source.crates-io]" >> ${HOME}/.cargo/config && \
echo "[source.local-registry]" >> ${HOME}/.cargo/config && \
@@ -286,7 +294,7 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
make install && \
ldconfig
-RUN dnf install -y ncurses-devel && dnf clean all
+RUN yum install -y ncurses-devel && yum clean all
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]
diff --git a/docs/build_docs/README_zh.md b/docs/build_docs/README_zh.md
index f27fbc4f..6450bf7e 100644
--- a/docs/build_docs/README_zh.md
+++ b/docs/build_docs/README_zh.md
@@ -40,6 +40,8 @@ $ cd iSulad/docs/build_docs/guide/script
$ sudo ./install_iSulad_on_Centos_7.sh
```
+若需要在centos容器中编译iSulad可参照iSulad编译可使用的镜像dockerfile[Dockerfile-ubuntu](../../CI/dockerfiles/Dockerfile-ubuntu)。
+
### Ubuntu
我们同样在代码仓中提供了在Ubuntu上自动化安装的脚本: [install_iSulad_on_Ubuntu_20_04_LTS](./guide/script/install_iSulad_on_Ubuntu_20_04_LTS.sh)您只需要执行这个脚本就可以自动编译安装iSulad以及其依赖的组件。
@@ -51,6 +53,8 @@ $ sudo chmod +x ./install_iSulad_on_Ubuntu_20_04_LTS.sh
$ sudo ./install_iSulad_on_Ubuntu_20_04_LTS.sh
```
+若需要在ubuntu容器中编译iSulad可参照iSulad编译可使用的镜像dockerfile[Dockerfile-centos](../../CI/dockerfiles/)。
+
## 构建指南
我们提供了多种构建iSulad的方式
diff --git a/docs/build_docs/guide/script/install_iSulad_on_Centos_7.sh b/docs/build_docs/guide/script/install_iSulad_on_Centos_7.sh
index b268d777..d83520e1 100755
--- a/docs/build_docs/guide/script/install_iSulad_on_Centos_7.sh
+++ b/docs/build_docs/guide/script/install_iSulad_on_Centos_7.sh
@@ -5,93 +5,29 @@ set -x
set -e
# install neccessary packages
-yum install -y patch automake autoconf libtool cmake make libcap libcap-devel libselinux libselinux-devel libseccomp libseccomp-devel yajl-devel git libcgroup tar python3 python3-pip device-mapper-devel libcurl-devel zlib-devel glibc-headers openssl-devel gcc gcc-c++ systemd-devel systemd-libs golang libtar libtar-devel which
+# yum install -y patch automake autoconf libtool cmake make libcap libcap-devel libselinux libselinux-devel libseccomp libseccomp-devel yajl-devel git libcgroup tar python3 python3-pip device-mapper-devel libcurl-devel zlib-devel glibc-headers openssl-devel gcc gcc-c++ systemd-devel systemd-libs golang libtar libtar-devel which
# export LDFLAGS
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH
- echo "/usr/local/lib" >> /etc/ld.so.conf
+echo "/usr/local/lib" >> /etc/ld.so.conf
BUILD_DIR=/tmp/build_isulad
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
-# build libarchive
-cd $BUILD_DIR
-git clone https://gitee.com/src-openeuler/libarchive.git
-cd libarchive
-git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag
-tar -zxvf libarchive-3.4.1.tar.gz
-cd libarchive-3.4.1
-patch -p1 -F1 -s < ../libarchive-uninitialized-value.patch
-cd build
-cmake -DCMAKE_USE_SYSTEM_LIBRARIES=ON ../
-make -j $(nproc)
-make install
-ldconfig
-
-# build protobuf
-cd $BUILD_DIR
-git clone https://gitee.com/src-openeuler/protobuf.git
-cd protobuf
-git checkout openEuler-20.03-LTS-tag
-tar -xzvf protobuf-all-3.9.0.tar.gz
-cd protobuf-3.9.0
-./autogen.sh
-./configure
-make -j $(nproc)
-make install
-ldconfig
-
-# build c-ares
-cd $BUILD_DIR
-git clone https://gitee.com/src-openeuler/c-ares.git
-cd c-ares
-git checkout openEuler-20.03-LTS-tag
-tar -xzvf c-ares-1.15.0.tar.gz
-cd c-ares-1.15.0
-autoreconf -if
-./configure --enable-shared --disable-dependency-tracking
-make -j $(nproc)
-make install
-ldconfig
-
-# build grpc
-cd $BUILD_DIR
-git clone https://gitee.com/src-openeuler/grpc.git
-cd grpc
-git checkout openEuler-20.03-LTS-tag
-tar -xzvf grpc-1.22.0.tar.gz
-cd grpc-1.22.0
-make -j $(nproc)
-make install
-ldconfig
-
-# build libwebsockets
-cd $BUILD_DIR
-git clone https://gitee.com/src-openeuler/libwebsockets.git
-cd libwebsockets
-git checkout openEuler-20.03-LTS-tag
-tar -xzvf libwebsockets-2.4.2.tar.gz
-cd libwebsockets-2.4.2
-patch -p1 -F1 -s < ../libwebsockets-fix-coredump.patch
-mkdir build
-cd build
-cmake -DLWS_WITH_SSL=0 -DLWS_MAX_SMP=32 -DCMAKE_BUILD_TYPE=Debug ../
-make -j $(nproc)
-make install
-ldconfig
-
# build lxc
cd $BUILD_DIR
git clone https://gitee.com/src-openeuler/lxc.git
cd lxc
+git config --global --add safe.directory $BUILD_DIR/lxc/lxc-5.0.2
./apply-patches
-cd lxc-4.0.3
-./autogen.sh
-./configure
-make -j
+cd lxc-5.0.2
+sed -i 's/return open(rpath, (int)((unsigned int)flags | O_CLOEXEC));/return open(rpath, (int)((unsigned int)flags | O_CLOEXEC), 0);/g' src/lxc/isulad_utils.c
+meson setup -Disulad=true \
+ -Dprefix=/usr build
+meson compile -C build
make install
# build lcr
@@ -118,8 +54,9 @@ make install
cd $BUILD_DIR
git clone https://gitee.com/openeuler/iSulad.git
cd iSulad
+sed -i 's/-O2 -Wall -fPIE/-O2 -Wall -fPIE -std=gnu99/g' cmake/set_build_flags.cmake
mkdir build
cd build
-cmake ..
+cmake -DDISABLE_WERROR=on ../
make
make install
--
2.34.1