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 's/--dis\(able-threads\)/--en\1/' \
161 # -e 's;dis\(ables.*threading\);en\1;' \
162 # -e 's;\(^enable.*threads=\"\)yes;\1no;' \
166 # -e '/.*\.spec.*/d' \
167 # -e '\%.*sigc++/Makefile.*%d' \
168 # -e '\%.*config/Makefile.*%d'
170 # Remove unnecessary files from the AC_OUTPUT list.
174 # No subdir sigc++. This also results in sigc++/macros -> macros.
176 # -e '\%.*tests/.*%d' \
177 # -e '\%.*examples/.*%d' \
178 # -e '\%.*scripts/.*%d'
180 # These directories have been completely removed and aren't relevent.
182 # -e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
184 # We want to default to static libs. Although we still need to ensure that
185 # configure is forced to only produce static libs.
187 # -e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
188 # [ --without-included-libsigc\
189 # Use the libsigc++ installed on the system\
190 # Used when libsigc++ is bundled with applications],\
191 # [sigc_use_included_libsigc=$withval],\
192 # [sigc_use_included_libsigc=yes])\
193 #if test x$sigc_use_included_libsigc = xno; then\
194 # ## just change the setting for the Makefile\
195 # USE_INCLUDED_SIGC=no\
196 # AC_SUBST(USE_INCLUDED_SIGC)\
199 #### This else..fi goes till the end of the file!\
201 # USE_INCLUDED_SIGC=yes\
202 # AC_SUBST(USE_INCLUDED_SIGC)/'
204 # Kill two birds with the one stone. We want maintainer access as standard
205 # and we want to be able to choose between using this package or the full
206 # library installed on the local system. If using the latter option we don't
207 # have to run most of the configure script so we hide it in a conditional.
209 # -e 's/\(AC_OUTPUT.*\)/\
211 #### This is the end of the massive if..then..else..fi\
217 # Close the conditional introduced in the previous script.
220 sed < configure.in > sigc++/configure.in \
222 ## Modified by makeLyXsigc.sh (Allan Rae)/' \
223 -e 's%\(AC_INIT\)(sigc++)%\1(slot.cc)\
225 AC_DEFUN(LYX_FIX_MAKEFILE_IN,[\
226 ## modify Makefile.in if need be -- since we still use automake\
227 for dir in \$srcdir \$srcdir/macros ; do\
229 sed < Makefile.in > Makefile_tmp \\\
230 -e '\''s/all\: all-redirect/all: all-@USE_INCLUDED_SIGC@\\\
231 all-yes: all-redirect\\\
233 mv Makefile_tmp Makefile.in )\
237 LYX_FIX_MAKEFILE_IN%' \
238 -e 's%\(AUX_DIR(\)scripts%\1../config%' \
239 -e 's%config/\(sigc++config\.h\)%\1%' \
240 -e 's/--dis\(able-threads\)/--en\1/' \
241 -e 's;dis\(ables.*threading\);en\1;' \
242 -e 's;\(^enable.*threads=\"\)yes;\1no;' \
244 -e '\%.*sigc++/Makefile.*%d' \
245 -e '\%.*config/Makefile.*%d' \
247 -e '\%.*tests/.*%d' \
248 -e '\%.*examples/.*%d' \
249 -e '\%.*scripts/.*%d' \
250 -e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
251 -e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
252 [ --without-included-libsigc\
253 Use the libsigc++ installed on the system\
254 Used when libsigc++ is bundled with applications],\
255 [sigc_use_included_libsigc=$withval],\
256 [sigc_use_included_libsigc=yes])\
257 if test x$sigc_use_included_libsigc = xno; then\
258 ## just change the setting for the Makefile\
259 USE_INCLUDED_SIGC=no\
260 AC_SUBST(USE_INCLUDED_SIGC)\
263 ### This else..fi goes till the end of the file!\
265 USE_INCLUDED_SIGC=yes\
266 AC_SUBST(USE_INCLUDED_SIGC)/' \
267 -e 's/\(AC_OUTPUT.*\)/\
269 ### This is the end of the massive if..then..else..fi\
275 echo "Modifying sigc++/Makefile.am"
277 # -e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
278 #DISTCLEANFILES= *.orig *.rej *~ *.bak core \
279 #MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
280 #ETAGS_ARGS = --lang=c++%'
282 # We've removed the sigc++/config/ above now we just make sure automake knows.
283 # We also want maintainer-clean to actually remove stuff. Same for distclean.
285 # -e '/^INCLUDES/{s%\(dir)\)%\1/..%;}'
287 # All the headers are included with <sigc++/xxx.h> so we need an adjustment.
289 # -e '/^M4_DIR/{s/sigc++\///;}'
291 # In the mini-dist the macros are directly under the top_srcdir which in this
294 # -e '/^libsigc.*dir/d'
296 # Not installing the headers or the library.
298 # -e 's/^libsigcinclude/noinst/'
300 # Don't install the headers.
302 # -e 's/generator.h//'
304 # We don't need generator.h.
307 # -e 's/\(LTLIB\)/noinst_\1/'
309 # These two lines make sure we don't install the library.
311 # -e '/EXTRA_DIST.*/d';
313 # We don't want the extra bits that libsigc++ does.
315 # -e 's/\(libsigc_la_SOURCES=\)\(.*\)/\1 $(BUILT_SOURCES)\2/' \
317 #Makefile: $(BUILT_SOURCES)\
319 # Make sure the built sources are built.
321 ( cd $package/sigc++;
322 sed < Makefile.am > Makefile.tmp \
323 -e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
324 DISTCLEANFILES= *.orig *.rej *~ *.bak core \
325 MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
326 ETAGS_ARGS = --lang=c++%' \
327 -e '/^INCLUDES/{s%\(dir)\)%\1/..%g;}' \
328 -e '/^M4_DIR/{s/sigc++\///;}' \
329 -e '/^libsigc.*dir/d' \
330 -e 's/^libsigcinclude/noinst/' \
331 -e 's/generator.h//' \
333 -e 's/\(LTLIB\)/noinst_\1/' \
334 -e '/EXTRA_DIST.*/d' \
335 -e 's/-version-info.*ION)//' \
336 -e 's/-release.*EASE)//' \
337 -e 's/\(libsigc_la_SOURCES=\)\(.*\)/\1 $(BUILT_SOURCES)\2/' \
339 Makefile: $(BUILT_SOURCES)\
342 mv Makefile.tmp Makefile.am )
345 echo "Modifying sigc++/macros/Makefile.am"
347 # -e '/^m4includedir/d' \
348 # -e 's/^m4include/noinst/'
350 # We're not installing any of this.
353 #MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in'
357 ( cd $package/sigc++/macros;
358 sed < Makefile.am > Makefile.tmp \
359 -e '/^m4includedir/d' \
360 -e 's/^m4include/noinst/' \
362 MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in' ;
364 mv Makefile.tmp Makefile.am )
367 echo "Adding various .cvsignore"
368 ( cd $package/sigc++;
369 cp ../../sigc++/.cvsignore . ;
370 cp ../../sigc++/macros/.cvsignore macros;
371 cp ../../doc/.cvsignore doc;
372 cat >> .cvsignore <<EOF
387 echo "Adding sigc++/DO_NOT_MODIFY_THESE_FILES"
388 ( cd $package/sigc++;
389 cat > DO_NOT_MODIFY_THESE_FILES <<EOF
390 These files are all collected together from a checked out copy of the
391 libsigc++ CVS repository by the ../development/tools/makeLyXsigc.sh file.
392 Some of these files are modified by that script. If you need to fix a bug in
393 the code then you should try to get the latest CVS libsigc++ and regenerate
394 this entire subpackage. If the problem still persists it may be necessary to
395 modify the generation script.
397 If an error is found while porting to a new platform read the doc/requirements
400 Remember to contact the LyX developers list if you are having problems.
406 echo "Packing files."
408 chmod -R a+r sigc++ config ;
409 GZIP=--best tar chozf lyx-sigc++-$version.tar.gz sigc++ config )
413 chmod a+r lyx-sigc++-$version.tar.gz