[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Ruby makefile maker (not really [PATCH] INSTALL...)

From: Yoshiki Hayashi <yoshiki_at_xemacs.org>
Date: 2002-01-30 14:37:23 CET

Sean Russell <ser@germane-software.com> writes:

> > There are libsvn_fs and libsvn_repos missing. And apr stuff
> > should come from apr-config --libs. Also, CFLAGS should
> > come from apr-config --cflags instead of hardcoding -pthread and -O.
>
> The library compiled without complaint sans those libraries; doesn't linking
> against libsvn_fs limit the Ruby binding to server installations?

Yes, but the native Ruby binding currently requires them. I
didn't try it out but if you run Ruby script with require
'svn', I think it'll complain about missing libsvn_fs and
libsvn_repos. It's not hard to conditionalize fs and repos
thing, though. You just need to ifdef svn_ruby_init_fs
family and svn_ruby_init_repos. It's just that it isn't
high on my TODO list because I don't use Subversion without
those libraries.

> I've attached the revised extconf.rb; I've made the rest of the changes you
> suggested. I also took out the second code block that added special flags
> based on the platform, since that's apr's domain.

Thanks. Since it didn't work on my system, I took the
liberty of fixing it. I also changed some other places.
The new file and the description of changes are attached
below. If you are fine with this, I'll commit it.

> Question: apr-config --libs doesn't include libapr or libpthreads; yet
> apr-config --cflags specifies --pthread. I'm not an apr-config expert, but
> this seems ... wrong. In any case, I left the pthread library in the list of
> dependencies.

-pthread flag of gcc is magical. It properly imports
symbols from libpthread to compiling library yet ldd doesn't
show libpthread. This is the place where it bit me before
and the conclusion is that apr is doing right job. If you
are compiling another library or executable and not
compiling DSO, the option apr gives works fine.

> Last question: were you planning on documenting the API, or should I give
> that a shot?

Not at the moment and I'd really appreciate if you write
them. I have very old and incomplete docs somewhere on my
disk so I can dig it up and send it to this list tomorrow if
you like.

Here's the new extconf.rb. What I changed are:

* Removed version information and your email address from
  header. The consensus is that we don't put email address
  in source files. You'll get proper credit in the log
  message.

* Removed non-svn libraries from libraries. Those should be
  automatically pulled in from libsvn_ra etc. It is also
  likely to become out of date. Your script contained mm
  which has been removed from APR for quite some time.

* Added apr-config --ldflags.

* apr-config --libs is added to LOCAL_LIBS.

* Add workaround for -lpthread issue on linux.

* Changed double quote to single quote where string doesn't
  need to be expanded.

# Creates a makefile for building the svn library for Ruby.
# Assumes SVN has already been successfully installed
#
# Options: --with-svn-dir=<path to svn install>
#

if /mswin32/ =~ PLATFORM then
  require 'env'
else
  require 'Env'
end

require 'mkmf' # Here's the ruby module that does the grunt work

dir_config('svn')

$CFLAGS << ' -I. '

# Extra libraries needed to compile
libraries = %w{svn_subr svn_delta svn_client svn_wc svn_ra}
libraries.each do |lib|
  unless have_library(lib, nil)
    puts "You seem to be missing the #{lib} library.\nI can't compile the "+
      "svn library without this."
    exit(1)
  end
end
# These aren't required, but we'll link them if we have them
have_library('svn_fs')
have_library('svn_repos')

$LDFLAGS << `apr-config --ldflags`.chop
$LOCAL_LIBS << `apr-config --libs`.chop
$CFLAGS << `apr-config --cflags`.chop

# Linux needs -lpthread.
if PLATFORM =~ /linux/ && $CFLAGS =~ /-pthread/ then
  have_library('pthread')
end

with_config('svn')

create_makefile('svn')

-- 
Yoshiki Hayashi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:01 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.