From 1296097e804477f7359ee6572202b208246f46f5 Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Tue, 1 Oct 2019 19:05:14 +0200 Subject: [PATCH] correct issue #46 error when build with static option on debian buster --- .gitlab-ci.yml | 86 ++++++++++++++++++++++++++++-- code/CMakeLists.txt | 3 +- code/CMakeModules/FindMySQL.cmake | 9 ++++ code/CMakeModules/Findgnutls.cmake | 60 +++++++++++++++++++++ 4 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 code/CMakeModules/Findgnutls.cmake diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8323a6963..170d346ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,7 @@ # gitlab-runner exec docker --timeout=3600 'Linux client build' # gitlab-runner exec docker --timeout=3600 'Linux server debian_amd64_strech build' # gitlab-runner exec docker --timeout=3600 'Linux server_static debian_amd64_strech build' +# gitlab-runner exec docker --timeout=3600 'Linux server_static_debug debian_amd64_buster build' # gitlab-runner exec docker --timeout=3600 'Linux server debian_amd64_buster build' # gitlab-runner exec docker --timeout=3600 'Linux client debian_amd64_strech build' # gitlab-runner exec docker --timeout=3600 --docker-volumes $PWD/builds:/builds 'Linux client debian_amd64_buster build' @@ -403,7 +404,7 @@ Linux client_static debian_amd64_strech build: name: "khanat-client_static-debian_amd64_strech-$CI_COMMIT_REF_NAME" paths: - code/build/bin - expire_in: 2 week +# expire_in: 2 week Linux client_static_debug debian_amd64_strech build: @@ -709,6 +710,83 @@ Linux server_static_debug debian_amd64_strech build: # expire_in: 2 week +Linux server_static_debug debian_amd64_buster build: + stage: build + except: + - mac-ci-build + tags: + - Docker + image: amd64/debian:10 + script: + # Calcul le nombre de cpu désactivé (on ne laisse que 4 au maximum) + #- disableproc=$(( $(nproc) - 4 )) + #- if [[ $disableproc -le 0 ]] ; then disableproc=0; fi + #- optionproc="-j$(nproc --ignore=$disableproc)" + - optionproc="-j $(nproc)" + # Prepare environment + - DEBIAN_FRONTEND=noninteractive apt-get update + - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y + - DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils autoconf autogen automake bison build-essential cmake cpputest default-libmysqlclient-dev fakeroot git libapache2-mod-php libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblua5.2-0 liblua5.2-dev liblzma-dev libogg-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libvorbis-dev libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial default-mysql-server php php-gd php-imagick php-mysql python3 python3-pip python3-bcrypt python3-venv rrdtool unzip wget zlib1g-dev python3-coverage python3-pep8 xsltproc rsync libogg-dev libvorbis-dev libgnutls28-dev libgnutlsxx28 libunistring-dev + # Apply patch + - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) + # Build & Install cpptest + # Impossible to build release 1.1.0, 1.1.1, 1.1.2 + - mkdir -p /opt/src/cpptest + - wget -q https://github.com/cpptest/cpptest/archive/1.0.5.tar.gz -O /opt/src/cpptest.tar.gz || exit 2 + - tar xf /opt/src/cpptest.tar.gz -C /opt/src --strip 1 || exit 2 + - (cd /opt/src/cpptest && ./autogen.sh && ./configure && make -j && make install) || exit 2 + # Build debug & install (cpptestd) + - (cd /opt/src/cpptest && make clean && CXXFLAGS="-g -O0" ./configure && make && for file in src/.libs/lib*.so* src/.libs/lib*.a;do extension=${file##*/libcpptest} ; cp -L $file /usr/local/lib/libcpptestd${extension}; done) + # Build & Install squish + - mkdir -p squish + - (cd squish; wget -c https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libsquish/squish-1.11.zip) + - (cd squish; unzip squish-1.11.zip) + - (cd squish/squish-1.11; patch -i ../../patch/squish-limit.patch) + - (cd squish/squish-1.11; make -j) + - (cd squish/squish-1.11; make install) + # Build & Install CURL - 7.58.0 + - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz + - mkdir -p curl/build + - tar xvf curl.tar.gz -C curl --strip 1 + - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CURL_TESTS=OFF -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) + - (cd curl/build; make -j) + - (cd curl/build; make install) + # Build & Install luabind + - mkdir -p luabind + - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz + - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz + - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 + - tar xvf luabind-debian.tar.xz -C luabind || exit 2 + - cd luabind + - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done + - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" + - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" + - cd .. + # Action + - mkdir -p code/build + - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF -DWITH_SYMBOLS=ON ..) + - (cd code/build; make $optionproc) + - (cd code/build/bin; ls -lh) + artifacts: + name: "khanat-server_static_debug-debian_amd64_strech-$CI_COMMIT_REF_NAME" + paths: + - code/build/bin + - code/ryzom/server/shard.screen.rc + - code/web + - code/ryzom/server/*.cfg + - code/ryzom/server/data_shard + - code/ryzom/common/data_common + - code/ryzom/common/data_leveldesign + - code/ryzom/client/*.cfg + - code/ryzom/client/cfg + - code/ryzom/client/data + - code/ryzom/client/macosx + - code/ryzom/client/unix + - code/ryzom/client/windows + - code/ryzom/tools/scripts/linux +# expire_in: 2 week + + Linux client_static debian_i386_strech build: stage: build except: @@ -1176,7 +1254,7 @@ Linux server debian_amd64_buster build: - code/ryzom/client/unix - code/ryzom/client/windows - code/ryzom/tools/scripts/linux - expire_in: 2 week +# expire_in: 2 week Linux client debian_amd64_buster build: @@ -1243,7 +1321,7 @@ Linux client debian_amd64_buster build: name: "khanat-client-debian_buster-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID" paths: - code/build/bin - expire_in: 2 week +# expire_in: 2 week @@ -1334,7 +1412,7 @@ Linux client_appimage debian_amd64_buster build: name: "khanat-client_appimage-debian_buster-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID" paths: - code/build/Khanat-x86_64.AppImage - expire_in: 2 week +# expire_in: 2 week diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4e5292f2a..110b802f3 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -150,8 +150,9 @@ IF(WITH_STATIC) IF(UNIX) # under Linux and OS X, recent libxml2 versions are linked against liblzma FIND_PACKAGE(LibLZMA) + FIND_PACKAGE(gnutls) IF(LIBLZMA_LIBRARIES) - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES} ${GNUTLS_LIBRARY}) ENDIF() ENDIF() ENDIF() diff --git a/code/CMakeModules/FindMySQL.cmake b/code/CMakeModules/FindMySQL.cmake index 631a96224..069625f02 100644 --- a/code/CMakeModules/FindMySQL.cmake +++ b/code/CMakeModules/FindMySQL.cmake @@ -80,6 +80,15 @@ ELSE() ENDIF() ENDIF() + IF(WITH_STATIC) + IF(UNIX) + FIND_PACKAGE(gnutls) + IF(GNUTLS_FOUND) + SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${GNUTLS_LIBRARY}) + ENDIF() + ENDIF() + ENDIF() + IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) SET(MYSQL_FOUND TRUE) MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") diff --git a/code/CMakeModules/Findgnutls.cmake b/code/CMakeModules/Findgnutls.cmake new file mode 100644 index 000000000..aae551039 --- /dev/null +++ b/code/CMakeModules/Findgnutls.cmake @@ -0,0 +1,60 @@ +# - Locate gnutls library +# This module defines +# GNUTLS_LIBRARY, the library to link against +# GNUTLS_FOUND, if false, do not try to link to JPEG +# GNUTLS_INCLUDE_DIR, where to find headers. + +IF(GNUTLS_LIBRARY AND GNUTLS_INCLUDE_DIR) + # in cache already + SET(GNUTLS_FIND_QUIETLY TRUE) +ENDIF() + +# Save default suffixes +SET(_OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + +# Define specific suffixes +SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) + +FIND_PATH(GNUTLS_INCLUDE_DIR + gnutls.h + PATHS + $ENV{GNUTLS_DIR}/include + /usr/local/include + /usr/include/gnutls + /usr/include + /sw/include + /opt/local/include + /opt/csw/include + /opt/include + PATH_SUFFIXES gnutls +) + +FIND_LIBRARY(GNUTLS_LIBRARY + NAMES gnutls libgnutls + PATHS + $ENV{GNUTLS_DIR}/lib + /usr/local/lib + /usr/lib + /usr/lib/x86_64-linux-gnu/ + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + +# Restore default suffixes +SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_SUFFIXES}) + +IF(GNUTLS_LIBRARY AND GNUTLS_INCLUDE_DIR) + SET(GNUTLS_FOUND "YES") + IF(NOT GNUTLS_FIND_QUIETLY) + MESSAGE(STATUS "Found gnutls: ${GNUTLS_LIBRARY}") + ENDIF() +ELSE() + IF(NOT GNUTLS_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find gnutls!") + ENDIF() +ENDIF()