Skip to content

Instantly share code, notes, and snippets.

@vbatts
Created July 11, 2012 14:58
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vbatts/3090949 to your computer and use it in GitHub Desktop.
Save vbatts/3090949 to your computer and use it in GitHub Desktop.
building ruby with a specific openssl
#!/bin/sh
t_dir="$HOME/tmp"
mkdir -p ${t_dir}
pushd ${t_dir}
for url in \
ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.9.3-p194.tar.bz2 \
http://openssl.org/source/openssl-1.0.1c.tar.gz
do
if [ ! -f $(basename "${url}") ] ;then
wget "${url}"
fi
done
tar zxf openssl-1.0.1c.tar.gz
tar jxf ruby-1.9.3-p194.tar.bz2
cd ${t_dir}/openssl-1.0.1c
./config \
no-shared \
--prefix=${t_dir}/static && \
make depend && \
make && \
make install
cd ${t_dir}/ruby-1.9.3-p194
CFLAGS=" -I${t_dir}/static/include -L${t_dir}/static/include " \
LDFLAGS=" -L${t_dir}/static/include " \
./configure \
--prefix=${t_dir}/static \
--disable-install-doc && \
make && \
make install
${t_dir}/static/bin/ruby -r openssl -e 'puts OpenSSL::OPENSSL_VERSION'
popd
@michaelfranzl
Copy link

Note that building Ruby with a specific OpenSSL version does not guarantee that Ruby uses the same version during runtime. For this you need to check OpenSSL::OPENSSL_LIBRARY_VERSION. So in the example above, Ruby despite everything uses a shared library from the OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment