oln-0.10 10.241: Adjust Swilena to Libtool.

2006-07-11 Roland Levillain <roland@lrde.epita.fr> Adjust Swilena to Libtool. * expand.sh (INCLUDES): Merge with... (AM_CPPFLAGS): ...this. Add -I\$(srcdir)/../meta. (AM_LDFLAGS): Remove $(SHARED_LDFLAGS). Add -avoid-version -module -shared (for Libtool). (AM_SWIG_FLAGS): New. Adjust the generation of the SWIG wrapper. Create wrappers with extension `.cc' instead of `.cxx'. Build `.la' modules instead of `.so'. (pyexec_PROGRAMS): Rename as... (pyexec_LTLIBRARIES): ...this. (python_PYTHON): Rename as... (nodist_python_PYTHON): ...this. (CLEANFILES): Clean `.pyc' files and Rblena wrappers. (ruby_PROGRAMS): Rename as... (ruby_LTLIBRARIES): ...this. (ruby_DATA): New. * python/ltihooks.py: New file. * python/Makefile.am (EXTRA_DIST): Add ltihooks.py. ($(srcdir)/makefile.swig): New target. * python/tests/arith.py, python/tests/conversions.py, * python/tests/morpho.py, python/tests/sanity.py, * python/tests/simple1.py: Import ltihooks. * python/tests/Makefile.am (TESTS_ENVIRONMENT): Adjust PYTHONPATH. * ruby/ltrequire.rb: New file. * ruby/Makefile.am (EXTRA_DIST): Add ltrequire.rb. ($(srcdir)/makefile.swig): New target. * ruby/tests/sanity.rb, ruby/tests/simple1.rb: Adjust `$:' Require ltrequire. * ruby/tests/Makefile.am (TESTS_ENVIRONMENT): Adjust SWILENA_PATH. --- 10.240/tools/swilena/expand.sh Fri, 07 Jul 2006 18:29:56 +0200 levill_r (oln/s/25_expand.sh 1.19 700) +++ 10.241/tools/swilena/expand.sh Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/s/25_expand.sh 1.20 700) @@ -85,26 +85,28 @@ ## NOTE: this file was generated automatically by expand.sh ## -INCLUDES = \$(PYTHON_CPPFLAGS) -I\$(srcdir)/../src -AM_CPPFLAGS = -DOLN_EXCEPTIONS +AM_CPPFLAGS = -DOLN_EXCEPTIONS \$(PYTHON_CPPFLAGS) \\ + -I\$(srcdir)/../src -I\$(srcdir)/../meta AM_CXXFLAGS = \$(CXXFLAGS_OPTIMIZE) \$(DOC_CPPFLAGS) -AM_LDFLAGS = \$(SHARED_LDFLAGS) \$(ZLIB_LDFLAGS) +## We build modules, not plain libs. +AM_LDFLAGS = -avoid-version -module -shared \$(ZLIB_LDFLAGS) +AM_SWIG_FLAGS = -c++ -python \$(AM_CPPFLAGS) EOF } dump_python() { - echo -n "pyexec_PROGRAMS =" + echo -n "pyexec_LTLIBRARIES =" ilist=0 for mod in $MODULES; do if [ `expr $ilist % 4` = 0 ]; then echo " \\"; echo -ne "\t" fi - echo -n " _swilena_$mod.so" + echo -n " _swilena_$mod.la" ilist=`expr $ilist + 1` done echo; echo - echo -n "python_PYTHON +=" + echo -n "nodist_python_PYTHON =" ilist=0 for mod in $MODULES; do if [ `expr $ilist % 4` = 0 ]; then @@ -115,19 +117,21 @@ done echo; echo for mod in $MODULES; do - echo "_swilena_${mod}_so_SOURCES = swilena_${mod}_wrap.cxx" + echo "nodist__swilena_${mod}_la_SOURCES = swilena_${mod}_wrap.cc" done echo; echo echo -ne "CLEANFILES= " - echo -e " swilena_all1d_wrap.cxx \\" - echo -e " swilena_all2d_wrap.cxx \\" - echo -e " swilena_all3d_wrap.cxx \\" - echo -ne " swilena_display_wrap.cxx" + echo -e " swilena_all1d_wrap.cc \\" + echo -e " swilena_all2d_wrap.cc \\" + echo -e " swilena_all3d_wrap.cc \\" + echo -ne " swilena_display_wrap.cc" for mod in $MODULES; do echo -e "\\" echo -ne "\t swilena_$mod.py" echo -e "\\" - echo -ne "\t swilena_${mod}_wrap.cxx" + echo -ne "\t swilena_$mod.pyc" + echo -e "\\" + echo -ne "\t swilena_${mod}_wrap.cc" done echo; echo @@ -147,10 +151,10 @@ # here. base="swilena_${mod}" src="\$(srcdir)/../$sdir/$base.i" - dest="${base}_wrap.cxx" + dest="${base}_wrap.cc" cat <<EOF $dest: $src - if \$(SWIG) \$(SWIG_FLAGS) -MD -MF \$(DEPDIR)/${base}_wrap.Tcc -c++ -python -I\$(srcdir)/../src -I\$(srcdir)/../meta \$(CPPFLAGS) -o $dest $src; \\ + if \$(SWIG) \$(AM_SWIG_FLAGS) \$(SWIG_FLAGS) -MD -MF \$(DEPDIR)/${base}_wrap.Tcc \$(CPPFLAGS) -o \$@ \$<; \\ then \\ mv -f "\$(DEPDIR)/${base}_wrap.Tcc" "\$(DEPDIR)/${base}_wrap.Pcc"; \\ else \\ @@ -177,30 +181,45 @@ ## NOTE: this file was generated automatically by expand.sh ## -INCLUDES = \$(RUBY_CPPFLAGS) -I\$(srcdir)/../src -AM_CPPFLAGS = -DOLN_EXCEPTIONS +AM_CPPFLAGS = -DOLN_EXCEPTIONS \$(RUBY_CPPFLAGS) \\ + -I\$(srcdir)/../src -I\$(srcdir)/../meta AM_CXXFLAGS = \$(CXXFLAGS_OPTIMIZE) \$(DOC_CPPFLAGS) -AM_LDFLAGS = \$(SHARED_LDFLAGS) \$(ZLIB_LDFLAGS) - +## We build modules, not plain libs. +AM_LDFLAGS = -avoid-version -module -shared \$(ZLIB_LDFLAGS) +AM_SWIG_FLAGS = -c++ -ruby \$(AM_CPPFLAGS) EOF } dump_ruby() { - echo -n "ruby_PROGRAMS =" + echo -n "ruby_LTLIBRARIES =" ilist=0 for mod in $MODULES; do if [ `expr $ilist % 4` = 0 ]; then echo " \\"; echo -ne "\t" fi - echo -n " swilena_$mod.so" + echo -n " swilena_$mod.la" ilist=`expr $ilist + 1` done echo; echo for mod in $MODULES; do - echo "swilena_${mod}_so_SOURCES = swilena_${mod}_wrap.cxx" + echo "nodist_swilena_${mod}_la_SOURCES = swilena_${mod}_wrap.cc" done echo + echo -ne "CLEANFILES= " + echo -e " swilena_all1d_wrap.cc \\" + echo -e " swilena_all2d_wrap.cc \\" + echo -e " swilena_all3d_wrap.cc \\" + echo -ne " swilena_display_wrap.cc" + for mod in $MODULES; do + echo -e "\\" + echo -ne "\t swilena_${mod}_wrap.cc" + done + echo; echo + + echo "ruby_DATA =" + echo + ilist=0 for mod in $MODULES; do if [ -r "$SWILENA/src/swilena_${mod}.i" ]; then @@ -212,10 +231,10 @@ # interface. base="swilena_${mod}" src="\$(srcdir)/../$sdir/$base.i" - dest="${base}_wrap.cxx" + dest="${base}_wrap.cc" cat <<EOF $dest: $src - if \$(SWIG) \$(SWIG_FLAGS) -MD -MF \$(DEPDIR)/${base}_wrap.Tcc -c++ -ruby -I\$(srcdir)/../src -I\$(srcdir)/../meta \$(CPPFLAGS) -o $dest $src; \\ + if \$(SWIG) \$(AM_SWIG_FLAGS) \$(SWIG_FLAGS) -MD -MF \$(DEPDIR)/${base}_wrap.Tcc \$(CPPFLAGS) -o \$@ \$<; \\ then \\ mv -f "\$(DEPDIR)/${base}_wrap.Tcc" "\$(DEPDIR)/${base}_wrap.Pcc"; \\ else \\ @@ -225,7 +244,22 @@ @AMDEP_TRUE@@am__include@ @am__quote@./\$(DEPDIR)/${base}_wrap.Pcc@am__quote@ EOF + +# Work around an issue between Libtool and Ruby on Mac OS X. +# Libtool generates dynamic modules ending in `.so', but the Ruby +# interpreter accepts only files ending in `.bundle' (and obviously +# `.rb') as arguments of the `require' method. Hence we create +# aliases for the .so files to make them appear as .bundle's +# to ruby. + cat <<EOF +ruby_DATA+ = .libs/$base.bundle +.libs/$base.bundle: .libs/$base.so $base.la + cd .libs && \$(LN_S) -f $base.so $base.bundle + +EOF done + + echo -n "CLEANFILES += \$(ruby_DATA)" } ############ Generic stuff ########### --- 10.240/tools/swilena/python/tests/Makefile.am Fri, 30 Jun 2006 17:26:15 +0200 levill_r (oln/v/15_Makefile.a 1.7 644) +++ 10.241/tools/swilena/python/tests/Makefile.am Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/v/15_Makefile.a 1.8 644) @@ -6,7 +6,7 @@ dist_noinst_DATA = sanity.py arith.py conversions.py simple1.py morpho.py TESTS_ENVIRONMENT = \ - PYTHONPATH="$(PYTHONPATH):..:$(srcdir)/.." \ + PYTHONPATH="..:$(srcdir)/..:$(PYTHONPATH):" \ IMGDIR="$(top_srcdir)/olena/img" TESTS = $(dist_noinst_DATA) --- 10.240/tools/swilena/python/tests/simple1.py Thu, 09 Oct 2003 16:21:55 +0200 burrus_n (oln/v/16_simple1.py 1.4 744) +++ 10.241/tools/swilena/python/tests/simple1.py Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/v/16_simple1.py 1.5 744) @@ -2,6 +2,7 @@ import os import sys +import ltihooks from swilena_image2d import * from swilena_ntg import * --- 10.240/tools/swilena/ruby/Makefile.am Wed, 28 Apr 2004 14:20:16 +0200 van-vl_n (oln/v/17_Makefile.a 1.7 600) +++ 10.241/tools/swilena/ruby/Makefile.am Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/v/17_Makefile.a 1.8 600) @@ -7,6 +7,9 @@ rubydir = $(libdir)/ruby -include makefile.swig +# ltrequire.rb: Extension of the `require' understanding Libtool libraries. +EXTRA_DIST = ltrequire.rb -CLEANFILES = *.cxx +$(srcdir)/makefile.swig: $(top_srcdir)/tools/swilena/expand.sh + top_srcdir="$(top_srcdir)" $< $(top_srcdir)/tools/swilena/ +include $(srcdir)/makefile.swig --- 10.240/tools/swilena/ruby/tests/Makefile.am Fri, 30 Jun 2006 17:26:15 +0200 levill_r (oln/v/18_Makefile.a 1.6 644) +++ 10.241/tools/swilena/ruby/tests/Makefile.am Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/v/18_Makefile.a 1.7 644) @@ -4,7 +4,7 @@ ## TESTS_ENVIRONMENT = \ - SWILENA_PATH=".." \ + SWILENA_PATH="$(srcdir)/..:..:../.libs" \ IMGDIR="$(top_srcdir)/olena/img" dist_noinst_DATA = sanity.rb simple1.rb --- 10.240/tools/swilena/ruby/tests/simple1.rb Thu, 09 Oct 2003 16:21:55 +0200 burrus_n (oln/v/19_simple1.rb 1.4 755) +++ 10.241/tools/swilena/ruby/tests/simple1.rb Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/v/19_simple1.rb 1.5 755) @@ -1,8 +1,11 @@ #!/usr/bin/env ruby # Set swilena_path to the location where swilena ruby modules are -$: << ENV["SWILENA_PATH"] if ENV.has_key? "SWILENA_PATH" +if ENV.has_key? "SWILENA_PATH" + $:.concat ENV["SWILENA_PATH"].split(":") +end +require "ltrequire" require "swilena_image2d" require "swilena_ntg" --- 10.240/tools/swilena/python/tests/morpho.py Wed, 14 Apr 2004 20:42:25 +0200 thivol_d (oln/v/47_morpho.py 1.2 744) +++ 10.241/tools/swilena/python/tests/morpho.py Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/v/47_morpho.py 1.3 744) @@ -2,6 +2,7 @@ import os import sys +import ltihooks from swilena_all2d import * imgdir = os.environ['IMGDIR'] --- 10.240/tools/swilena/python/tests/arith.py Fri, 30 Jun 2006 17:26:15 +0200 levill_r (oln/w/0_arith.py 1.2 744) +++ 10.241/tools/swilena/python/tests/arith.py Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/w/0_arith.py 1.3 744) @@ -2,6 +2,7 @@ import os import sys +import ltihooks from swilena_image2d import * from swilena_arith2d import * --- 10.240/tools/swilena/python/tests/conversions.py Mon, 10 Nov 2003 14:09:27 +0100 burrus_n (oln/w/1_conversion 1.1 744) +++ 10.241/tools/swilena/python/tests/conversions.py Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/w/1_conversion 1.2 744) @@ -2,6 +2,7 @@ import os import sys +import ltihooks from swilena_all2d import * imgdir = os.environ['IMGDIR'] --- 10.240/tools/swilena/python/Makefile.am Tue, 20 Apr 2004 18:09:05 +0200 van-vl_n (oln/w/2_Makefile.a 1.7 600) +++ 10.241/tools/swilena/python/Makefile.am Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/w/2_Makefile.a 1.8 600) @@ -5,7 +5,13 @@ SUBDIRS = . tests -python_PYTHON = swilena_display.py swilena_all1d.py swilena_all2d.py swilena_all3d.py +# ltihooks.py: Python import hooks understanding Libtool libraries. +EXTRA_DIST = ltihooks.py -include makefile.swig +python_PYTHON = \ + swilena_display.py \ + swilena_all1d.py swilena_all2d.py swilena_all3d.py +$(srcdir)/makefile.swig: $(top_srcdir)/tools/swilena/expand.sh + top_srcdir="$(top_srcdir)" $< $(top_srcdir)/tools/swilena/ +include $(srcdir)/makefile.swig --- 10.240/tools/swilena/ruby/tests/sanity.rb Fri, 30 Jun 2006 17:48:53 +0200 levill_r (oln/w/38_sanity.rb 1.1 755) +++ 10.241/tools/swilena/ruby/tests/sanity.rb Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/w/38_sanity.rb 1.2 755) @@ -4,8 +4,11 @@ # Set swilena_path to the location where swilena ruby modules are. -$: << ENV["SWILENA_PATH"] if ENV.has_key? "SWILENA_PATH" +if ENV.has_key? "SWILENA_PATH" + $:.concat ENV["SWILENA_PATH"].split(":") +end +require "ltrequire" # Integre types. require "swilena_ntg" --- 10.240/tools/swilena/python/tests/sanity.py Fri, 30 Jun 2006 17:48:53 +0200 levill_r (oln/w/39_sanity.py 1.1 744) +++ 10.241/tools/swilena/python/tests/sanity.py Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/w/39_sanity.py 1.2 744) @@ -2,6 +2,7 @@ # Sanity check: include all Python modules, but do nothing. +import ltihooks # Integre types. import swilena_ntg
participants (1)
-
Roland Levillain