2 ## Author: Allan Rae <rae@lyx.org>
3 ## With bug fixes and improvements by Karl Nelson.
5 ## Severely hacked version of the libsigc++/win32/makevc.sh script
6 ## Builds the 'mini' libsigc++ distribution for use with LyX.
7 ## Hopefully the generated distribution is generic enough for use by
10 if test ! -f .cvsignore ; then
11 ## could also test for acconfig.h since we need that too.
12 echo "Must be run in a CVS controlled source directory"
13 echo "You can't build the lyx-sigc distribution from a tarball"
14 ## This just makes my life considerably easier.
18 if test ! -f config.status ; then
19 echo "Must be run in configured source directory"
23 version=`grep SIGC_VERSION config.status | awk -F% '{print $3}'`
24 package="libsigc++-$version"
25 tarfile="$package.tar.gz"
26 configure="$package/configure.in"
28 if test ! -f $tarfile ; then
29 echo "Must have dist file $tarfile"
34 echo "Unpack distribution."
35 if test -d $package; then
38 tar xzf $tarfile --exclude CVS
42 echo "Removing irrelevent or regeneratable files."
43 find $package -name "Makefile.in" | xargs rm
44 find $package -name "*.Makefile" | xargs rm
46 cp ../acconfig.h sigc++;
48 rm -f doc/riscos doc/ChangeLog;
49 mv ltdll.c sigc-config.in doc sigc++;
50 rm -Rf lyx win32 scripts tests riscos djgpp borland examples;
51 rm -Rf aclocal.m4 libsigc++.spec*;
53 find macros -name "*.h.m4" | sed -e 's,macros/\(.*\)\.m4,\1,' | xargs rm;
54 rm -rf README scripts/README generator.h config )
57 echo "Make autogen.sh for testing"
59 cat > autogen.sh << EOF
62 # You shouldn't need to use this script in your application unless it doesn't
63 # have its own equivalent.
68 automake --add-missing --foreign
75 echo "Limiting to Signal3"
76 # we only need up to Signal3
77 # NOTE: sigc++ needs 2 slots higher than the number of signals (see bind.h)
78 # Anyone feeling keen?
79 # How would you like to make this a parameter-controlled stripping of
80 # the headers instead?
82 for i in `ls $package/sigc++/macros/*.h.m4`; do
84 $package/sigc++/macros/slot.h.m4)
86 -e '/.*ARGS(P,[6789]).*/d'
90 -e '/.*ARGS(P,[456789]).*/d'
98 echo "Changing <sigc++config.h> to <sigc++/sigc++config.h>"
100 # This change means that if the compiler can find <sigc++/slot.h> it can also
101 # find the sigc++config.h header which is internal to the library.
103 for i in `ls $package/sigc++/macros/*.h.m4 $package/sigc++/*.h`; do
105 -e 's%\(\(sigc++\)config.h\)%\2/\1%'
111 echo "Building application level config/"
112 mkdir $package/config
113 mv $package/sigc++.m4 $package/config
116 echo "Creating custom sigc++/configure.in"
117 ## My sed doesn't seem to want to match newlines in scripts. As a result
118 ## the first two scripts haven't been merged into one.
119 ## These separate scripts are ordered approximately in the order in which
120 ## they match in the unmodified configure.in.
122 ## Note that you have to be very careful about quoting. Look at the second
123 ## script for example: '\'', \\\ and \$
125 ## Now for some explanation of what each script is supposed to change:
127 # -e 's/\(Nelson\)/\1\
128 ### Modified by makeLyXsigc.sh (Allan Rae)/'
130 # Credit where credit is due.
132 # -e 's%\(AC_INIT\)(sigc++)%\1(slot.cc)\
134 #AC_DEFUN(LYX_FIX_MAKEFILE_IN,[\
135 ### modify Makefile.in if need be -- since we still use automake\
136 #for dir in \$srcdir \$srcdir/macros ; do\
138 # sed < Makefile.in > Makefile_tmp \\\
139 # -e '\''s/all\: all-redirect/all: all-@USE_INCLUDED_SIGC@\\\
140 #all-yes: all-redirect\\\
142 # mv Makefile_tmp Makefile.in )\
146 #LYX_FIX_MAKEFILE_IN%'
148 # Change which file autoconf demands to be in the current directory.
149 # Add a way to not make anything in the sigc++ package when using an
150 # externally supplied library.
152 # -e 's%\(AUX_DIR(\)scripts%\1../config%'
154 # Use the applications auxilliary directory. Assumed to be ../config.
156 # -e 's%config/\(sigc++config\.h\)%\1%'
158 # Move sigc++config.h out of the now removed config/.
160 # -e '/.*\.spec.*/d' \
161 # -e '\%.*sigc++/Makefile.*%d' \
162 # -e '\%.*config/Makefile.*%d'
164 # Remove unnecessary files from the AC_OUTPUT list.
168 # No subdir sigc++. This also results in sigc++/macros -> macros.
170 # -e '\%.*tests/.*%d' \
171 # -e '\%.*examples/.*%d' \
172 # -e '\%.*scripts/.*%d'
174 # These directories have been completely removed and aren't relevent.
176 # -e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
178 # We want to default to static libs. Although we still need to ensure that
179 # configure is forced to only produce static libs.
181 # -e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
182 # [ --without-included-libsigc\
183 # Use the libsigc++ installed on the system\
184 # Used when libsigc++ is bundled with applications],\
185 # [sigc_use_included_libsigc=$withval],\
186 # [sigc_use_included_libsigc=yes])\
187 #if test x$sigc_use_included_libsigc = xno; then\
188 # ## just change the setting for the Makefile\
189 # USE_INCLUDED_SIGC=no\
190 # AC_SUBST(USE_INCLUDED_SIGC)\
193 #### This else..fi goes till the end of the file!\
195 # USE_INCLUDED_SIGC=yes\
196 # AC_SUBST(USE_INCLUDED_SIGC)/'
198 # Kill two birds with the one stone. We want maintainer access as standard
199 # and we want to be able to choose between using this package or the full
200 # library installed on the local system. If using the latter option we don't
201 # have to run most of the configure script so we hide it in a conditional.
203 # -e 's/\(AC_OUTPUT.*\)/\
205 #### This is the end of the massive if..then..else..fi\
211 # Close the conditional introduced in the previous script.
214 sed < configure.in > sigc++/configure.in \
216 ## Modified by makeLyXsigc.sh (Allan Rae)/' \
217 -e 's%\(AC_INIT\)(sigc++)%\1(slot.cc)\
219 AC_DEFUN(LYX_FIX_MAKEFILE_IN,[\
220 ## modify Makefile.in if need be -- since we still use automake\
221 for dir in \$srcdir \$srcdir/macros ; do\
223 sed < Makefile.in > Makefile_tmp \\\
224 -e '\''s/all\: all-redirect/all: all-@USE_INCLUDED_SIGC@\\\
225 all-yes: all-redirect\\\
227 mv Makefile_tmp Makefile.in )\
231 LYX_FIX_MAKEFILE_IN%' \
232 -e 's%\(AUX_DIR(\)scripts%\1../config%' \
233 -e 's%config/\(sigc++config\.h\)%\1%' \
235 -e '\%.*sigc++/Makefile.*%d' \
236 -e '\%.*config/Makefile.*%d' \
238 -e '\%.*tests/.*%d' \
239 -e '\%.*examples/.*%d' \
240 -e '\%.*scripts/.*%d' \
241 -e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
242 -e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
243 [ --without-included-libsigc\
244 Use the libsigc++ installed on the system\
245 Used when libsigc++ is bundled with applications],\
246 [sigc_use_included_libsigc=$withval],\
247 [sigc_use_included_libsigc=yes])\
248 if test x$sigc_use_included_libsigc = xno; then\
249 ## just change the setting for the Makefile\
250 USE_INCLUDED_SIGC=no\
251 AC_SUBST(USE_INCLUDED_SIGC)\
254 ### This else..fi goes till the end of the file!\
256 USE_INCLUDED_SIGC=yes\
257 AC_SUBST(USE_INCLUDED_SIGC)/' \
258 -e 's/\(AC_OUTPUT.*\)/\
260 ### This is the end of the massive if..then..else..fi\
266 echo "Modifying sigc++/Makefile.am"
268 # -e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
269 #DISTCLEANFILES= *.orig *.rej *~ *.bak core \
270 #MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
271 #ETAGS_ARGS = --lang=c++%'
273 # We've removed the sigc++/config/ above now we just make sure automake knows.
274 # We also want maintainer-clean to actually remove stuff. Same for distclean.
276 # -e '/^INCLUDES/{s%\(dir)\)%\1/..%;}'
278 # All the headers are included with <sigc++/xxx.h> so we need an adjustment.
280 # -e '/^M4_DIR/{s/sigc++\///;}'
282 # In the mini-dist the macros are directly under the top_srcdir which in this
285 # -e '/^libsigc.*dir/d'
287 # Not installing the headers or the library.
289 # -e 's/^libsigcinclude/noinst/'
291 # Don't install the headers.
293 # -e 's/generator.h//'
295 # We don't need generator.h.
298 # -e 's/\(LTLIB\)/noinst_\1/'
300 # These two lines make sure we don't install the library.
302 # -e '/EXTRA_DIST.*/d';
304 # We don't want the extra bits that libsigc++ does.
306 ( cd $package/sigc++;
307 sed < Makefile.am > Makefile.tmp \
308 -e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
309 DISTCLEANFILES= *.orig *.rej *~ *.bak core \
310 MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
311 ETAGS_ARGS = --lang=c++%' \
312 -e '/^INCLUDES/{s%\(dir)\)%\1/..%g;}' \
313 -e '/^M4_DIR/{s/sigc++\///;}' \
314 -e '/^libsigc.*dir/d' \
315 -e 's/^libsigcinclude/noinst/' \
316 -e 's/generator.h//' \
318 -e 's/\(LTLIB\)/noinst_\1/' \
319 -e '/EXTRA_DIST.*/d' \
320 -e 's/-version-info.*ION)//' \
321 -e 's/-release.*EASE)//';
323 mv Makefile.tmp Makefile.am )
326 echo "Modifying sigc++/macros/Makefile.am"
328 # -e '/^m4includedir/d' \
329 # -e 's/^m4include/noinst/'
331 # We're not installing any of this.
334 #MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in'
338 ( cd $package/sigc++/macros;
339 sed < Makefile.am > Makefile.tmp \
340 -e '/^m4includedir/d' \
341 -e 's/^m4include/noinst/' \
343 MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in' ;
345 mv Makefile.tmp Makefile.am )
348 echo "Adding various .cvsignore"
349 ( cd $package/sigc++;
350 cp ../../sigc++/.cvsignore . ;
351 cp ../../sigc++/macros/.cvsignore macros;
352 cp ../../doc/.cvsignore doc;
353 cat >> .cvsignore <<EOF
368 echo "Adding sigc++/DO_NOT_MODIFY_THESE_FILES"
369 ( cd $package/sigc++;
370 cat > DO_NOT_MODIFY_THESE_FILES <<EOF
371 These files are all collected together from a checked out copy of the
372 libsigc++ CVS repository by the ../development/tools/makeLyXsigc.sh file.
373 Some of these files are modified by that script. If you need to fix a bug in
374 the code then you should try to get the latest CVS libsigc++ and regenerate
375 this entire subpackage. If the problem still persists it may be necessary to
376 modify the generation script.
378 If an error is found while porting to a new platform read the doc/requirements
381 Remember to contact the LyX developers list if you are having problems.
387 echo "Packing files."
389 chmod -R a+r sigc++ config ;
390 GZIP=--best tar chozf lyx-sigc++-$version.tar.gz sigc++ config )
394 chmod a+r lyx-sigc++-$version.tar.gz