This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gbs: not relying on ./configure --srcdir





The gbs patches keep coming...

Problem: the --srcdir switch doesn't work in many configure scripts.  Of
the three packages I've built, one didn't have a configure script at
all, and in the other two the --srcdir switch didn't work as it was
supposed to.  As a result the build step would fail.  I had to set up a
tree of symlinks to the main source tree before I could build.

Solution: give up on --srcdir, and provide a function that automatically
creates a tree of symlinks in ${objdir} to the files in ${srcdir}.  I
call this function stow(), after the stow(1) utility that does the same
thing.  The patch is below.  This method is slower, because you have to
wait while the script stows the source tree.  But it always succeeds,
without relying on a working 'configure --srcdir'.  And I provide some
visual feedback while you're waiting, so it doesn't seem so long.

The stow() function as written below uses some features specific to bash
and GNU find, xargs, and ln, but this shouldn't be a problem for Cygwin.

Andrew.

--- generic-build-script.orig   2004-10-09 04:03:14.000000000 -0400
+++ generic-build-script        2004-10-12 14:37:56.000000000 -0400
@@ -129,7 +129,21 @@
   rm -fr ${objdir} ${instdir} ${srcinstdir} && \
   mkdir -p ${objdir} && \
   mkdir -p ${instdir} && \
-  mkdir -p ${srcinstdir} )
+  mkdir -p ${srcinstdir} && \
+  stow ${srcdir} ${objdir} )
+}
+stow() {
+  # create in $2 a symlinked copy of the file tree in $1
+  (srcdir=$1 tgtdir=$2 && \
+  for sd in $(find ${srcdir} \
+    \( -path ${objdir} -o -path ${instdir} -o -path ${srcinstdir} \) \
+    -prune -o -type d -print ) ; do \
+    td=${tgtdir}${sd#${srcdir}} && \
+    echo "stowing ${td#${topdir}/}" && \
+    mkdir -p ${td} && \
+    find ${sd} -maxdepth 1 \! -type d | \
+    xargs --no-run-if-empty ln -fs --target-dir=${td} ; \
+  done )
 }
 prep() {
   (cd ${topdir} && \
@@ -143,8 +157,7 @@
 conf() {
   (cd ${objdir} && \
   CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
-  ${srcdir}/configure \
-  --srcdir=${srcdir} --prefix="${prefix}" \
+  ./configure --prefix="${prefix}" \
   --exec-prefix='${prefix}' --sysconfdir="${sysconfdir}" \
   --libdir='${prefix}/lib' --includedir='${prefix}/include' \
   --mandir='${prefix}/share/man' --infodir='${prefix}/share/info' \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]