6 # error out on failed commands whose return code wasn't explicitly
15 Builds a non-cygwin version of gerbv and create a standalone
20 --build-only - Only run the 'make' part of the process. This is
21 shorthand for all of the --skip-* options except
24 --debug - Omits the compiler flag which prevents
25 a command window from being opened. This
26 is useful when trying to use debug printf's.
27 If listed twice then --enable-debug is passed
28 down to the configure script which enables
29 a good bit of debug output.
31 --help - Show this message and exit.
33 --force-autogen - Force running ./autogen.sh. Normally this is
34 only done if the configure script is not present.
36 --nsis-only - Only run NSIS to create the installer. This is
37 shorthand for all of the following --skip-* options.
39 --skip-build - Skip the "make" step of the process.
41 --skip-clean - Skip the "make clean" step of the process.
43 --skip-config - Skip the "./configure" step of the process.
45 --skip-install - Skip the "make install" step of the process.
47 --skip-nsis - Skip the NSIS step of the process.
49 For the $0 script to work, you must have the gtk_win32 files
50 as well as gdlib installed on your system in very specific
51 locations. Edit $0 to change these. While you are at it, feel
52 free to provide a patch to improve the documentation about
66 while test $# -ne 0 ; do
77 if test "X${debug}" = "Xyes" ; then
78 config_args
="${config_args} --enable-debug"
128 echo "ERROR: Unknown option $1"
139 if test ! -f win32
/build_gerbv
; then
140 echo "$0: ERROR. This script must be run from the top level of the gerbv source tree."
144 # Run this under cygwin to build gerbv and create a windows installer for
145 # it. Thanks to Bob Paddock for pointing me to NSIS and answering some
146 # beginner windows questions.
148 # where gtk_win32 is installed
149 gtk_win32
=c
:\\cygwin
\\home
\\${USER}\\gtk_win32
151 # where only the runtime components are installed
152 gtk_win32_runtime
=c
:\\\\cygwin
\\\\home
\\\\${USER}\\\\gtk_win32_runtime
156 gerbv_version
=`awk '/AC_INIT/ {gsub(/.*,[ \t]*\[/, ""); gsub(/\]\).*/, ""); print}' configure.ac`
157 echo "gerbv_version=${gerbv_version}"
159 # location of the NSIS makensis executible (see http://nsis.sourceforge.net)
160 makensis
="/cygdrive/c/Program Files/NSIS/makensis.exe"
163 # ########################################################################
165 # The rest should be ok without editing
167 # ########################################################################
170 if test ! -f configure
-o $do_autogen = yes ; then
171 echo "Bootstrapping autotools"
172 ACLOCAL_FLAGS
="-I ${gtk_win32}\\share\\aclocal" .
/autogen.sh
176 srcdir
=`pwd.exe`/win32
177 top_srcdir
=${srcdir}/..
179 src_dir
=c
:\\\\cygwin
`echo ${srcdir} | sed 's;/;\\\\\\\\;g'`
180 top_src_dir
=c
:\\\\cygwin
`echo ${top_srcdir} | sed 's;/;\\\\\\\\;g'`
183 # where to install gerbv
184 gerbv_inst
=`pwd`/gerbv_inst
187 gerbv_inst_dir
=c
:\\\\cygwin
`echo ${gerbv_inst} | sed 's;/;\\\\\\\\;g'`
189 PKG_CONFIG_PATH
=${gtk_win32}\\lib
\\pkgconfig
190 export PKG_CONFIG_PATH
192 PATH
=${gtk_win32}\\bin:${gd_win32}:${PATH}
195 echo "Showing packages known to pkg-config:"
196 pkg-config
--list-all
199 # do not try to use libpng-config, it seems broken on win32
200 LIBPNG_CONFIG
=/usr
/bin
/true
202 LIBPNG_CFLAGS
="-I${HOME}/gtk_win32/include"
203 LIBPNG_LDFLAGS
="-L${HOME}/gtk_win32/lib"
204 LIBPNG_LIBS
="-lpng12"
206 # add the gcc options to produce a native windows binary that
207 # does not need cygwin to run
208 if test "x${debug}" = "xno" ; then
209 EXTRA_FLAGS
="-mwindows"
212 CYGWIN_CFLAGS
="-mms-bitfields -mno-cygwin ${EXTRA_FLAGS}"
215 CYGWIN_CPPFLAGS
="-mms-bitfields -mno-cygwin ${EXTRA_FLAGS}"
216 export CYGWIN_CPPFLAGS
218 # setting WIN32=yes will make sure that the desktop icon
220 if test "$do_config" = "yes" ; then
222 echo "Configuring for cygwin"
223 ( ( ( env WIN32
=yes \
225 --prefix=${gerbv_inst} \
226 --disable-dependency-tracking \
227 --disable-maintainer-mode \
229 --disable-update-desktop-database \
230 --disable-update-mime-database \
232 CFLAGS
="${LIBPNG_CFLAGS}" \
233 LDFLAGS
="${LIBPNG_LDFLAGS}" \
234 LIBS
="${LIBPNG_LIBS}" \
236 2>&1 ; echo $?
>&4 ) |
tee c.log
1>&3) 4>&1 |
(read a
; exit $a)) 3>&1
238 if test $?
-ne 0 ; then
239 echo "**** ERROR **** Configure failed. See log in c.log"
243 # If the win32 pkg-config is used, then you end up with spurious CR's
244 # in the generated Makefile's and we need to get rid of them.
249 cat $f.bak |
tr '\r' ' ' > $f
252 echo "Removing spurious carriage returns in the Makefiles..."
253 for f
in `find . -name Makefile -print` ; do
257 echo "Removing spurious carriage returns in libtool..."
262 if test "$do_clean" = "yes" ; then
264 ( ( ( make clean
2>&1 ; echo $?
>&4) |
tee clean.log
1>&3) 4>&1 |
(read a
; exit $a) ) 3>&1
265 if test $?
-ne 0 ; then
266 echo "**** ERROR **** Clean failed. See log in clean.log"
271 if test "$do_build" = "yes" ; then
272 echo "Building for cygwin"
273 ( ( ( make 2>&1 ; echo $?
>&4) |
tee m.log
1>&3) 4>&1 |
(read a
; exit $a) ) 3>&1
274 if test $?
-ne 0 ; then
275 echo "**** ERROR **** Build failed. See log in m.log"
280 if test "$do_install" = "yes" ; then
281 echo "Installing for cygwin"
282 # first clean out the installation directory to make sure
283 # we don't have old junk lying around.
284 if test -d ${gerbv_inst} ; then
287 ( ( ( make install 2>&1 ; echo $?
>&4) |
tee -a m.log
1>&3) 4>&1 |
(read a
; exit $a) ) 3>&1
288 if test $?
-ne 0 ; then
289 echo "**** ERROR **** Build failed. See log in m.log"
294 if test "$do_nsis" = "yes" ; then
295 echo "Creating NSIS script"
296 echo "srcdir = ${srcdir}"
297 echo "src_dir = ${src_dir}"
298 echo "top_srcdir = ${top_srcdir}"
299 echo "top_src_dir = ${top_src_dir}"
302 -e "s;@gerbv_version@;${gerbv_version};g" \
303 -e "s;@gerbv_prefix@;${gerbv_inst_dir};g" \
304 -e "s;@gerbv_srcdir@;${top_src_dir};g" \
305 -e "s;@gtk_win32_runtime@;${gtk_win32_runtime};g" \
306 ${srcdir}/gerbv.nsi.
in > ${srcdir}/gerbv.nsi
308 echo "Creating windows installer"
309 "${makensis}" ${src_dir}/gerbv.nsi
312 echo "Windows installer left in ${srcdir}:"
313 ls -l ${srcdir}/*.exe
320 Creating DOS batch file wrapper for the installer.
321 If you have just built this under cygwin on Vista,
322 you will need to either run the installer from
323 the Vista start menu, Windows explorer or directly from
324 the cygwin shell with
332 .\win32\gerbvinst-${gerbv_version}.exe
337 echo "Skipping NSIS step per user request"