From 7465a3548eba138b49a2ed3f7707fca1435bc7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20H=C3=BCbner?= Date: Mon, 14 Nov 2022 10:57:10 +0100 Subject: [PATCH] fix(*): build libxslt as part of base image --- docker/Dockerfile | 6 ++++-- docker/build.sh | 27 +++++++++++++++++++++++---- gojira.sh | 13 +++++++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fe3c760..b2e5e46 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -48,6 +48,7 @@ ARG KONG_LIBNETTLE ARG KONG_LIBJQ ARG KONG_EXPAT ARG KONG_LIBXML2 +ARG KONG_LIBXSLT ARG RESTY_LMDB ARG RESTY_WEBSOCKET ARG ATC_ROUTER @@ -61,6 +62,7 @@ ENV LIBNETTLE_INSTALL=${BUILD_PREFIX}/libnettle ENV LIBJQ_INSTALL=${BUILD_PREFIX}/libjq ENV EXPAT_INSTALL=${BUILD_PREFIX}/expat ENV LIBXML2_INSTALL=${BUILD_PREFIX}/libxml2 +ENV LIBXSLT_INSTALL=${BUILD_PREFIX}/libxslt RUN mkdir -p ${BUILD_PREFIX} COPY build.sh ${BUILD_PREFIX} @@ -72,8 +74,8 @@ ENV OPENSSL_LIBDIR=${OPENSSL_INSTALL} ENV PATH=$PATH:${OPENRESTY_INSTALL}/nginx/sbin:${OPENRESTY_INSTALL}/bin:${LUAROCKS_INSTALL}/bin ENV PATH=${OPENSSL_INSTALL}/bin:$PATH -ENV LD_LIBRARY_PATH=${OPENSSL_INSTALL}/lib:${LIBGMP_INSTALL}/lib:${LIBNETTLE_INSTALL}/lib:${LIBJQ_INSTALL}/lib:${EXPAT_INSTALL}/lib:${LIBXML2_INSTALL}/lib:${LD_LIBRARY_PATH} -ENV C_INCLUDE_PATH=${EXPAT_INSTALL}/include:${LIBXML2_INSTALL}/include +ENV LD_LIBRARY_PATH=${OPENSSL_INSTALL}/lib:${LIBGMP_INSTALL}/lib:${LIBNETTLE_INSTALL}/lib:${LIBJQ_INSTALL}/lib:${EXPAT_INSTALL}/lib:${LIBXML2_INSTALL}/lib:${LIBXSLT_INSTALL}/lib:${LD_LIBRARY_PATH} +ENV C_INCLUDE_PATH=${EXPAT_INSTALL}/include:${LIBXML2_INSTALL}/include:${LIBXSLT_INSTALL}/include # Extra tools RUN apt-get update --fix-missing && \ diff --git a/docker/build.sh b/docker/build.sh index 5d59df2..e1997d7 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -58,6 +58,12 @@ function download_libxml2 { | tar -C "${LIBXML2_INSTALL}" -xJ --strip-components=1 } +function download_libxslt { + mkdir -p "${LIBXSLT_INSTALL}" + curl -sSL "https://download.gnome.org/sources/libxslt/$(echo ${KONG_LIBXSLT} | sed -e 's/\.[0-9]*$//')/libxslt-${KONG_LIBXSLT}.tar.xz" \ + | tar -C "${LIBXSLT_INSTALL}" -xJ --strip-components=1 +} + function make_kong_ngx_module { make -C ${KONG_NGX_MODULE_INSTALL} LUA_LIB_DIR=${OPENRESTY_INSTALL}/lualib install } @@ -121,14 +127,10 @@ function make_libxml2 { --prefix="${LIBXML2_INSTALL}" \ --without-catalog \ --without-debug \ - --without-html \ --without-http \ --without-iconv \ --without-python \ --without-sax1 \ - --without-schemas \ - --without-schematron \ - --without-valid \ --without-xinclude \ --without-xptr \ --without-modules @@ -138,6 +140,19 @@ function make_libxml2 { ) } +function make_libxslt { + ( + cd "${LIBXSLT_INSTALL}" || return + PATH=${LIBXML2_INSTALL}/bin:$PATH \ + ./configure --disable-static \ + --without-python \ + --prefix="${LIBXSLT_INSTALL}" + + make + make install + ) +} + function build { local flags=( "--prefix ${BUILD_PREFIX}" @@ -211,6 +226,10 @@ function build { download_libxml2 after+=(make_libxml2) fi + if [[ -n "$KONG_LIBXSLT" ]]; then + download_libxslt + after+=(make_libxslt) + fi # `rustc` for atc-router if [[ -n "$ATC_ROUTER" ]]; then diff --git a/gojira.sh b/gojira.sh index f5ebd29..9a18eda 100755 --- a/gojira.sh +++ b/gojira.sh @@ -569,6 +569,7 @@ function image_name { KONG_LIBJQ=${JQ_VERSION:-$(req_find $req_file KONG_DEP_LIBJQ_VERSION)} KONG_EXPAT=${EXPAT_VERSION:-$(req_find $req_file KONG_DEP_EXPAT_VERSION)} KONG_LIBXML2=${LIBXML2_VERSION:-$(req_find $req_file KONG_DEP_LIBXML2_VERSION)} + KONG_LIBXSLT=${LIBXSLT_VERSION:-$(req_find $req_file KONG_DEP_LIBXSLT_VERSION)} RESTY_LMDB=${RESTY_LMDB:-$(req_find $req_file RESTY_LMDB_VERSION)} RESTY_WEBSOCKET=${RESTY_WEBSOCKET:-$(req_find $req_file RESTY_WEBSOCKET_VERSION)} ATC_ROUTER=${ATC_ROUTER:-$(req_find $req_file ATC_ROUTER_VERSION)} @@ -632,6 +633,11 @@ function image_name { "libxml2-$KONG_LIBXML2" ) fi + if [[ -n "$KONG_LIBXSLT" ]]; then + components+=( + "libxslt-$KONG_LIBXSLT" + ) + fi if [[ -n "$RESTY_LMDB" ]]; then components+=( "resty-lmdb-$RESTY_LMDB" @@ -758,6 +764,13 @@ function build { ) >&2 echo " * libxml2: $KONG_LIBXML2" fi + if [[ -n "$KONG_LIBXSLT" ]]; then + BUILD_ARGS+=( + "--build-arg KONG_LIBXSLT=$KONG_LIBXSLT" + "--label KONG_LIBXSLT=$KONG_LIBXSLT" + ) + >&2 echo " * libxslt: $KONG_LIBXSLT" + fi >&2 echo "==========================" >&2 echo ""