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

Re: Fixing swig-pl to work in VPATH setups

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-12-17 23:07:58 CET

Philip Martin <philip@codematters.co.uk> writes:

> David James <james82@gmail.com> writes:
>
>> On 12/16/05, Jani Averbach <jaa@jaa.iki.fi> wrote:
>>> On 2005-12-16 20:40+0000, Philip Martin wrote:
>>> > > Please see: http://svn.haxx.se/dev/archive-2005-11/1324.shtml
>>> > So it fails shortly after r17497 "Always generate SWIG/C files and
>>> > SWIG headers in the source directory", are you using a VPATH build?
>>> Yes, the test system is using vpath setup.
>>
>> I've committed a fix for this bug in r17818. Does this help?
>
> Yes, that works. 'make clean-swig' doesn't delete the symlinks but
> that doesn't seem to cause a problem.

What's not clear from the original thread is why the generated files
should go in the source directory instead of the build directory. The
thread includes some arguments about why it is acceptable, but not why
it is necessary--it looks like a rather drastic side-effect of a bug
fix.

The build system appears to have all the bits necessary to allow the
build directory to be used. With the patch below I can run autogen
with or without --release and the VPATH build puts the generated files
in the build directory, no symlinking or copying is necessary. Am I
missing something? Is there any reason the build doesn't work like
this? Perhaps I am abusing the source_generated stuff, I'm not quite
sure what's intended for that flag.

Index: Makefile.in
===================================================================
--- Makefile.in (revision 17820)
+++ Makefile.in (working copy)
@@ -623,9 +623,6 @@
   libsvn_fs libsvn_ra libsvn_repos libsvn_subr libsvn_wc libsvn_swig_perl \
   $(SWIG_PL_DIR)/native/Makefile
 swig-pl: $(swig-pl_DEPS)
- if test "$(SWIG_PL_DIR)" != "$(SWIG_PL_SRC_DIR)"; then \
- ln -sf $(SWIG_PL_SRC_DIR)/native/*.c $(SWIG_PL_DIR)/native; \
- fi
         cd $(SWIG_PL_DIR)/native; $(MAKE)
 
 check-swig-pl: swig-pl swig-pl-lib
@@ -659,11 +656,8 @@
 $(SWIG_PY_DIR)/libsvn:
         mkdir $(SWIG_PY_DIR)/libsvn
 
-copy-swig-py: autogen-swig-py $(SWIG_PY_DIR)/libsvn
- @cp -pf $(SWIG_PY_SRC_DIR)/*.py $(SWIG_PY_DIR)/libsvn
+swig-py: autogen-swig-py
 
-swig-py: autogen-swig-py copy-swig-py
-
 check-swig-py: swig-py
         cd $(SWIG_PY_DIR); \
           $(PYTHON) $(SWIG_PY_SRC_DIR)/tests/run_all.py
Index: build/generator/gen_base.py
===================================================================
--- build/generator/gen_base.py (revision 17820)
+++ build/generator/gen_base.py (working copy)
@@ -264,13 +264,14 @@
     self.source_generated = 0
 
 class SWIGObject(ObjectFile):
- def __init__(self, filename, lang):
+ def __init__(self, filename, lang, release_mode):
     ObjectFile.__init__(self, filename)
     self.lang = lang
     self.lang_abbrev = lang_abbrev[lang]
     ### hmm. this is Makefile-specific
     self.compile_cmd = '$(COMPILE_%s_WRAPPER)' % string.upper(self.lang_abbrev)
- self.source_generated = 1
+ if not release_mode:
+ self.source_generated = 1
 
 class HeaderFile(DependencyNode):
   def __init__(self, filename, classname = None, compile_cmd = None):
@@ -518,6 +519,7 @@
     self.lang = lang
     self.desc = self.desc + ' for ' + lang_full_name[lang]
     self.include_runtime = options.get('include-runtime') == 'yes'
+ self.release_mode = gen_obj.release_mode
 
     ### hmm. this is Makefile-specific
     self.link_cmd = '$(LINK_%s_WRAPPER)' % string.upper(lang_abbrev[lang])
@@ -552,12 +554,14 @@
     self.path = build_path_join(self.path, self.lang)
     if self.lang == "perl":
       self.path = build_path_join(self.path, "native")
+ self.gen_obj.target_dirs.append(self.path)
     self.filename = build_path_join(self.path, lib_filename)
 
     ifile = SWIGSource(ipath)
- cfile = SWIGObject(build_path_join('$(top_srcdir)', self.path, cname),
- self.lang)
- ofile = SWIGObject(build_path_join(self.path, oname), self.lang)
+ cfile = SWIGObject(build_path_join(self.path, cname), self.lang,
+ self.release_mode)
+ ofile = SWIGObject(build_path_join(self.path, oname), self.lang,
+ self.release_mode)
 
     # the .c file depends upon the .i file
     self.gen_obj.graph.add(DT_SWIG_C, cfile, ifile)
Index: build/generator/gen_make.py
===================================================================
--- build/generator/gen_make.py (revision 17820)
+++ build/generator/gen_make.py (working copy)
@@ -138,8 +138,8 @@
       if not self.release_mode:
         self.ofile.write(
           '%s: %s %s\n' % (wrapper_fname, fname, python_script) +
- '\tcd $(top_srcdir) && $(PYTHON) %s' % (python_script) +
- ' build.conf $(SWIG) %s\n\n' % (fname)
+ '\t$(PYTHON) %s' % (python_script) +
+ ' $(abs_srcdir)/build.conf $(SWIG) $(abs_srcdir)/%s\n\n' % (fname)
         )
     self.ofile.write('\n')
 
@@ -150,8 +150,8 @@
     if not self.release_mode:
       self.ofile.write(
         '%s:\n' % " ".join(swig_runtime_fnames) +
- '\tcd $(top_srcdir) && $(PYTHON)' +
- ' build/generator/swig/external_runtime.py build.conf "$(SWIG)"\n\n'
+ '\t$(PYTHON) $(abs_srcdir)/build/generator/swig/external_runtime.py' +
+ ' $(abs_srcdir)/build.conf "$(SWIG)"\n\n'
       )
 
     self.ofile.write(

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Dec 17 23:08:43 2005

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