Compile requirements of Ruby and Extensions

M

Markus Kolb

Hi,

is there anywhere a list what libs ruby and a extension needs to be
configured and compiled?

Thanks.
Markus
 
S

Stephen Waits

--Apple-Mail-1-245096190
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed


is there anywhere a list what libs ruby and a extension needs to be
configured and compiled?

Unfortunately, no. I dug around until I figured it out. See
attached script for help.

--Steve


--Apple-Mail-1-245096190
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
x-unix-mode=0755;
name="go.sh"
Content-Disposition: attachment;
filename=go.sh

#!/bin/sh


FETCH="fetch -ar"
#FETCH="wget"
#FETCH="curl -O"

WORKDIR=`pwd`/work
BOOTSTRAPDIR=`pwd`/bootstrap
BUNDIR=`pwd`/bundle

rm -rf build $BUNDIR $WORKDIR $BOOTSTRAPDIR

mkdir -p build
mkdir -p pkg
mkdir -p $BUNDIR
mkdir -p $WORKDIR
mkdir -p $BOOTSTRAPDIR

export LDFLAGS="-L$WORKDIR/lib"
export CPPFLAGS="-I$WORKDIR/include"

ORIGINAL_PATH="$PATH"
export PATH="$WORKDIR/bin:$PATH"
hash -r


#################
## Downloads ##
#################
# can we auto download *latest* packages???
cd pkg
$FETCH ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
$FETCH http://www.zlib.net/zlib-1.2.3.tar.gz
$FETCH http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.1.tar.gz
$FETCH http://www.openssl.org/source/openssl-0.9.8a.tar.gz
$FETCH ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz
$FETCH ftp://ftp.gnu.org/gnu/gdbm/gdbm-1.8.3.tar.gz
$FETCH http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz
$FETCH http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
cd ..


cd build


###############
## ncurses ##
###############
tar zxvf ../pkg/ncurses-5.5.tar.gz
cd ncurses-5.5
# build once so we can get the database and infocmp
/configure \
--prefix=$BOOTSTRAPDIR \
--with-static \
--with-shared \
--without-debug \
--without-profile \
--without-ada && \
make && \
make install || exit 1
OLD_PATH="$PATH"
export PATH="$BOOTSTRAPDIR/bin:$PATH"
hash -r
# build a second time, except embed a few termcaps (needed db & infocmp 1st)
FALLBACKS="ansi,linux,screen,screen-w,vt52,vt100,vt102,vt220,xterm,xterm-color,xterm-mono"
/configure \
--prefix=$WORKDIR \
--with-static \
--without-shared \
--without-rpath \
--without-debug \
--without-profile \
--without-ada \
--without-progs \
--disable-database \
--with-fallbacks=$FALLBACKS && \
make && \
make install || exit 1
export PATH="$OLD_PATH"
hash -r
cd ..


################
## readline ##
################
tar zxvf ../pkg/readline-5.1.tar.gz
cd readline-5.1
/configure \
--prefix=$WORKDIR \
--enable-static \
--disable-shared && \
make && \
make install || exit 1
cd ..


############
## zlib ##
############
tar zxvf ../pkg/zlib-1.2.3.tar.gz
cd zlib-1.2.3/
/configure \
--prefix=$WORKDIR && \
make && \
make install || exit 1
cd ..


#############
## iconv ##
#############
tar zxvf ../pkg/libiconv-1.9.1.tar.gz
cd libiconv-1.9.1/
/configure \
--prefix=$WORKDIR \
--enable-static \
--disable-shared \
--disable-rpath && \
make && \
make install || exit 1
cd ..


###############
## OpenSSL ##
###############
# cannot link statically with openssl
# conflicts with digest extension!!!

#tar zxvf ../pkg/openssl-0.9.8a.tar.gz
#cd openssl-0.9.8a/
## cannot build with zlib b/c ruby's ext mkmf fails to add -lz
#./config \
# --prefix=$WORKDIR \
# --openssldir=$WORKDIR \
# -L$WORKDIR/lib \
# -I$WORKDIR/include \
# no-shared \
# no-asm && \
#make && \
#make install || exit 1
#cd ..


############
## gdbm ##
############
tar zxvf ../pkg/gdbm-1.8.3.tar.gz
cd gdbm-1.8.3/
/configure \
--prefix=$WORKDIR \
--enable-static \
--disable-shared && \
make && \
make install BINOWN=$USER BINGRP=$GROUP && \
make install-compat BINOWN=$USER BINGRP=$GROUP || exit 1
cd ..


############
## Ruby ##
############
tar zxvf ../pkg/ruby-1.8.4.tar.gz
cd ruby-1.8.4
/configure \
--prefix=$BUNDIR \
--enable-static \
--disable-shared \
--disable-rpath \
--with-static-linked-ext \
--enable-install-doc \
--with-curses-dir=$WORKDIR \
--with-dbm-dir=$WORKDIR \
--with-gdbm-dir=$WORKDIR \
--with-iconv-dir=$WORKDIR \
--with-openssl-dir=$WORKDIR \
--with-readline-dir=$WORKDIR \
--with-zlib-dir=$WORKDIR && \
make && \
make install || exit 1
cd ..


##############################
## Setup Ruby Environment ##
##############################
export PATH="$BUNDIR/bin:$ORIGINAL_PATH"
hash -r


########################
## Install RubyGems ##
########################
tar xzvf ../pkg/rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb
cd ..


############
## Gems ##
############
tar xzvf ../pkg/rubygems-0.8.11.tgz
gem update --system -y
gem install rails -y
gem install capistrano -y


cd ..

echo "Bundle complete!"


--Apple-Mail-1-245096190--
 
T

Timothy Goddard

Ruby seems to have very few dependencies. On my ruby 1.8.4 / linux
system it seems to require openssl for ruby itself and readline, zlib,
ncurses and gdbm for the standard libraries and other tools. Obviously
different platforms may have alternatives to these libraries instead.
 
M

Markus Kolb

Timothy said:
Ruby seems to have very few dependencies. On my ruby 1.8.4 / linux
system it seems to require openssl for ruby itself and readline, zlib,
ncurses and gdbm for the standard libraries and other tools. Obviously
different platforms may have alternatives to these libraries instead.

But that is not the end. Tk needs libtk,libtcl...
It tries to find and link with e.g. libtermcap and I don't know if it is
bad or ok if this fails.
Then I think there are replacements in Ruby script if some libs are
missing. These script replacements are of course slower in execution as
the binary code.
Shouldn't the make test check if the compilation was successful?
I've done a small C-file patch and lib/ruby/1.8/(arch)/socket.so got not
build.
The make all, make install and make test doesn't abort.
So I don't know if everything is in place after make install.
Or if it could happen that anytime in the future I use some feature and
Ruby misses a file to do its work. Or if my build is fine or it could be
done better.

It would be a very simple work for developers during development to note
the libs they try to link with.

Then I am missing --enable/disable-features in configure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top