Skip to content

Commit

Permalink
Simplify logic for rpath, the comma syntax is supported by all compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jan 15, 2025
1 parent 644d294 commit 4b363d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
7 changes: 1 addition & 6 deletions bin/ruby-build
Original file line number Diff line number Diff line change
Expand Up @@ -1216,12 +1216,7 @@ build_package_openssl() {

# Help OpenSSL find its own shared libraries on Linux.
if [ "$(uname -s)" = "Linux" ]; then
# shellcheck disable=SC2031
if [ "$CC" = "clang" ] || "${CC:-cc}" --version 2>&1 | grep -wq clang; then
package_option openssl configure -Wl,-rpath,"$OPENSSL_PREFIX_PATH/lib"
else
package_option openssl configure -Wl,-rpath="$OPENSSL_PREFIX_PATH/lib"
fi
package_option openssl configure -Wl,-rpath,"$OPENSSL_PREFIX_PATH/lib"
fi

# Disable SSLv2 and Kerberos on older OpenSSL
Expand Down
35 changes: 2 additions & 33 deletions test/build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,7 @@ OUT

stub_repeated uname '-s : echo Linux'
stub_repeated brew false
stub cc \
'-xc -E - : echo "OpenSSL 1.0.1a 1 Aug 2023"' \
'--version : echo gcc'
stub cc '-xc -E - : echo "OpenSSL 1.0.1a 1 Aug 2023"'
stub openssl "version -d : echo 'OPENSSLDIR: \"${TMP}/ssl\"'"
stub_make_install "install_sw"
stub_make_install
Expand All @@ -399,7 +397,7 @@ DEF
unstub make

assert_build_log <<OUT
openssl-1.1.1w: [--prefix=${INSTALL_ROOT}/openssl,--openssldir=${INSTALL_ROOT}/openssl/ssl,--libdir=lib,zlib-dynamic,no-ssl3,shared,-Wl,-rpath=${INSTALL_ROOT}/openssl/lib]
openssl-1.1.1w: [--prefix=${INSTALL_ROOT}/openssl,--openssldir=${INSTALL_ROOT}/openssl/ssl,--libdir=lib,zlib-dynamic,no-ssl3,shared,-Wl,-rpath,${INSTALL_ROOT}/openssl/lib]
make -j 2
make install_sw install_ssldirs
ruby-3.2.0: [--prefix=$INSTALL_ROOT,--with-openssl-dir=$INSTALL_ROOT/openssl,--with-ext=openssl,psych,+] PKG_CONFIG_PATH=${TMP}/install/openssl/lib/pkgconfig
Expand All @@ -408,35 +406,6 @@ make install
OUT
}

@test "install OpenSSL with clang" {
cached_tarball "openssl-1.1.1w" config

mkdir -p "${TMP}/ssl/certs"
touch "${TMP}/ssl/cert.pem"

stub_repeated uname '-s : echo Linux'
stub cc '--version : echo "Hello clang 1.2.3"'
stub openssl "version -d : echo 'OPENSSLDIR: \"${TMP}/ssl\"'"
stub_make_install "install_sw"

mkdir -p "$INSTALL_ROOT"/openssl/ssl # OPENSSLDIR
run_inline_definition <<DEF
install_package "openssl-1.1.1w" "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" openssl
DEF
assert_success

unstub uname
unstub cc
# unstub openssl
unstub make

assert_build_log <<OUT
openssl-1.1.1w: [--prefix=${INSTALL_ROOT}/openssl,--openssldir=${INSTALL_ROOT}/openssl/ssl,--libdir=lib,zlib-dynamic,no-ssl3,shared,-Wl,-rpath,${INSTALL_ROOT}/openssl/lib]
make -j 2
make install_sw install_ssldirs
OUT
}

@test "skip bundling OpenSSL if custom openssl dir was specified" {
cached_tarball "ruby-3.2.0" configure

Expand Down

0 comments on commit 4b363d6

Please sign in to comment.