diff --git a/recipes/libs/openssl.yaml b/recipes/libs/openssl.yaml index f3f75c21..09720272 100644 --- a/recipes/libs/openssl.yaml +++ b/recipes/libs/openssl.yaml @@ -1,7 +1,7 @@ inherit: [make, install] metaEnvironment: - PKG_VERSION: "1.1.1d" + PKG_VERSION: "1.1.1i" depends: - libs::zlib-dev @@ -13,25 +13,70 @@ depends: checkoutSCM: scm: url url: https://www.openssl.org/source/openssl-${PKG_VERSION}.tar.gz - digestSHA256: 1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2 + digestSHA256: e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242 extract: False buildTools: [target-toolchain] -buildVars: [PKG_VERSION, CC, AR, RANLIB, ARCH, AUTOCONF_BUILD, AUTOCONF_HOST] +buildVars: [PKG_VERSION, CC, AR, RANLIB, ARCH, AUTOCONF_BUILD, AUTOCONF_HOST, BASEMENT_LIBS] buildScript: | export TARGETMACH=${AUTOCONF_HOST} - export LDFLAGS="-Wl,-rpath-link=${BOB_DEP_PATHS[libs::zlib-dev]}/usr/lib" mkdir -p install tar -xzf $1/openssl-${PKG_VERSION}.tar.gz pushd openssl-${PKG_VERSION} + + SHARED_ONLY="false" + if [[ -n "${BASEMENT_LIBS:-}" ]] ; then + case "$BASEMENT_LIBS" in + static) + SHARED_STATIC=( "-static" "zlib" ) + ;; + shared) + SHARED_STATIC=( "shared" "zlib-dynamic" ) + SHARED_ONLY="true" + ;; + both) + SHARED_STATIC=( "shared" "zlib-dynamic" ) + ;; + *) + echo "Invalid BASEMENT_LIBS value: $BASEMENT_LIBS" >&2 + exit 1 + ;; + esac + elif [[ "${AUTOCONF_BUILD:-unknown}" == "${AUTOCONF_HOST:-${AUTOCONF_BUILD:-unknown}}" ]]; then + SHARED_STATIC=( "-static" "zlib" ) + else + SHARED_STATIC=( "shared" "zlib-dynamic" ) + SHARED_ONLY="true" + fi + + # refer: https://github.com/openssl/openssl/blob/master/Configurations/10-main.conf + case "$ARCH" in + arm) + ARCH="armv4" + ;; + arm64) + ARCH="aarch64" + ;; + i386) + ARCH="x86" + ;; + x86_64) + ;; + *) + echo "Architecture $ARCH currently not supported." >&2 + exit 1 + ;; + esac + ./Configure \ --prefix=/usr \ --openssldir=/etc/ssl \ --libdir=lib \ - shared \ - zlib-dynamic \ + "${SHARED_STATIC[@]}" \ "-I${BOB_DEP_PATHS[libs::zlib-dev]}/usr/include" \ + "-Wl,-L${BOB_DEP_PATHS[libs::zlib-dev]}/usr/lib" \ + "-Wl,-rpath-link=${BOB_DEP_PATHS[libs::zlib-dev]}/usr/lib" \ linux-${ARCH} #make depend @@ -40,6 +85,10 @@ buildScript: | popd + if [[ "$SHARED_ONLY" == "true" ]] ; then + find install -iname "*.a" -exec rm -rf {} \; + fi + multiPackage: dev: packageScript: installPackageDev "$1/install/" diff --git a/recipes/libs/zlib.yaml b/recipes/libs/zlib.yaml index 20ccf37f..bb6b24ff 100644 --- a/recipes/libs/zlib.yaml +++ b/recipes/libs/zlib.yaml @@ -11,7 +11,7 @@ checkoutSCM: extract: False buildTools: [target-toolchain] -buildVars: [CROSS_COMPILE, AUTOCONF_BUILD, AUTOCONF_HOST, CFLAGS, LDFLAGS] +buildVars: [CROSS_COMPILE, AUTOCONF_BUILD, AUTOCONF_HOST, CFLAGS, LDFLAGS, BASEMENT_LIBS] buildScript: | # zlib uses CROSS_PREFIX instead of CROSS_COMPILE if [[ ${CROSS_COMPILE:+true} ]] ; then @@ -24,8 +24,26 @@ buildScript: | ) # compile static on native builds - if [[ ${AUTOCONF_BUILD} == ${AUTOCONF_HOST:-${AUTOCONF_BUILD}} ]] ; then + SHARED_ONLY="false" + if [[ -n "${BASEMENT_LIBS:-}" ]] ; then + case "$BASEMENT_LIBS" in + static) + CONFIGURE_OPTS+=( --static ) + ;; + shared) + SHARED_ONLY="true" + ;; + both) + ;; + *) + echo "Invalid BASEMENT_LIBS value: $BASEMENT_LIBS" >&2 + exit 1 + ;; + esac + elif [[ "${AUTOCONF_BUILD:-unknown}" == "${AUTOCONF_HOST:-${AUTOCONF_BUILD:-unknown}}" ]]; then CONFIGURE_OPTS+=( --static ) + else + SHARED_ONLY="true" fi mkdir -p install @@ -35,6 +53,10 @@ buildScript: | make install DESTDIR=${PWD}/../install popd + if [[ "$SHARED_ONLY" == "true" ]] ; then + find install -iname "*.a" -exec rm -rf {} \; + fi + multiPackage: dev: packageScript: installPackageDev "$1/install/"