6 # error out on failed commands whose return code wasn't explicitly
15 Builds a non-cygwin version of pcb and create a standalone
20 --debug - Omits the compiler flag which prevents
21 a command window from being opened. This
22 is useful when trying to use debug printf's
24 --disable-doc - Pass "--disable-doc" to the configure script.
26 --enable-maintainer-mode
27 - Pass "--enable-maintainer-mode" to the
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 --with-tex - Set TEX=tex
49 --with-etex - set TEX=etex
51 For the $0 script to work, you must have the gtk_win32 files
52 as well as gdlib installed on your system in very specific
53 locations. Edit $0 to change these. While you are at it, feel
54 free to provide a patch to improve the documentation about
68 while test $# -ne 0 ; do
76 config_args
="${config_args} --disable-doc"
80 --enable-maintainer-mode)
81 config_args
="${config_args} --enable-maintainer-mode"
134 echo "ERROR: Unknown option $1"
145 if test ! -f win32
/build_pcb
; then
146 echo "$0: ERROR. This script must be run from the top level of the pcb source tree."
150 # Run this under cygwin to build pcb and create a windows installer for
151 # it. Thanks to Bob Paddock for pointing me to NSIS and answering some
152 # beginner windows questions.
154 # where gtk_win32 is installed
155 gtk_win32
=c
:\\cygwin
\\home
\\${USER}\\gtk_win32
157 # where only the runtime components are installed
158 gtk_win32_runtime
=c
:\\\\cygwin
\\\\home
\\\\${USER}\\\\gtk_win32_runtime
161 # where the gdwin32.zip archive has been extracted
162 # gdwin32.zip can be downloaded from http://www.boutell.com/gd/http/gdwin32.zip
164 gd_win32
=c
:\\cygwin
\\home
\\${USER}\\gd_win32
165 gd_win32_runtime
=c
:\\\\cygwin
\\\\home
\\\\${USER}\\\\gd_win32_runtime
170 pcb_version
=`awk '/AC_INIT/ {gsub(/.*,[ \t]*\[/, ""); gsub(/\]\).*/, ""); print}' configure.ac`
171 echo "pcb_version=${pcb_version}"
173 # location of the NSIS makensis executible (see http://nsis.sourceforge.net)
174 makensis
="/cygdrive/c/Program Files/NSIS/makensis.exe"
177 # ########################################################################
179 # The rest should be ok without editing
181 # ########################################################################
184 if test ! -f configure
-o $do_autogen = yes ; then
185 echo "Bootstrapping autotools"
186 ACLOCAL_FLAGS
="-I ${gtk_win32}\\share\\aclocal" .
/autogen.sh
190 srcdir
=`pwd.exe`/win32
191 top_srcdir
=${srcdir}/..
193 src_dir
=c
:\\\\cygwin
`echo ${srcdir} | sed 's;/;\\\\\\\\;g'`
194 top_src_dir
=c
:\\\\cygwin
`echo ${top_srcdir} | sed 's;/;\\\\\\\\;g'`
197 # where to install pcb
198 pcb_inst
=`pwd`/pcb_inst
201 pcb_inst_dir
=c
:\\\\cygwin
`echo ${pcb_inst} | sed 's;/;\\\\\\\\;g'`
203 PKG_CONFIG_PATH
=${gtk_win32}\\lib
\\pkgconfig
204 export PKG_CONFIG_PATH
206 PATH
=${HOME}/gd_win32_runtime/bin:${HOME}/gtk_win32_runtime/bin:${PATH}
208 echo "Set PATH=${PATH}"
210 echo "Showing packages known to pkg-config:"
211 pkg-config
--list-all
214 # do not try to use libpng-config, it seems broken on win32
215 LIBPNG_CONFIG
=/usr
/bin
/true
217 LIBPNG_CFLAGS
="-I${HOME}/gtk_win32/include"
218 LIBPNG_LDFLAGS
="-L${HOME}/gtk_win32/lib"
221 # do not try and build the tk based QFP footprint
226 # do not try and use the gdlib-config script to
228 GDLIB_CONFIG
=/usr
/bin
/true
231 GDLIB_CFLAGS
="-I${HOME}/gd_win32/include"
232 GDLIB_LDFLAGS
="-L${HOME}/gd_win32/lib -lbgd"
234 # add the gcc options to produce a native windows binary that
235 # does not need cygwin to run
236 if test "x${debug}" = "xno" ; then
237 EXTRA_FLAGS
="-mwindows"
240 CYGWIN_CFLAGS
="-mms-bitfields -mno-cygwin ${EXTRA_FLAGS}"
243 CYGWIN_CPPFLAGS
="-mms-bitfields -mno-cygwin ${EXTRA_FLAGS}"
244 export CYGWIN_CPPFLAGS
246 # setting WIN32=yes will make sure that the desktop icon
248 if test "$do_config" = "yes" ; then
250 echo "Configuring for cygwin"
251 ( ( ( env WIN32
=yes \
253 --prefix=${pcb_inst} \
254 --docdir=${pcb_inst}/doc \
255 --pdfdir=${pcb_inst}/doc
/pdf \
256 --htmldir=${pcb_inst}/doc
/html \
257 --datadir=${pcb_inst}/share \
258 ac_cv_func_gdImageGif
="yes" \
259 ac_cv_func_gdImageJpeg
="yes" \
260 ac_cv_func_gdImagePng
="yes" \
261 --disable-dependency-tracking \
263 --disable-update-desktop-database \
264 --disable-update-mime-database \
266 CFLAGS
="${GDLIB_CFLAGS}" \
267 LDFLAGS
="${GDLIB_LDFLAGS}" \
269 2>&1 ; echo $?
>&4 ) |
tee c.log
1>&3) 4>&1 |
(read a
; exit $a)) 3>&1
271 if test $?
-ne 0 ; then
272 echo "**** ERROR **** Configure failed. See log in c.log"
276 # If the win32 pkg-config is used, then you end up with spurious CR's
277 # in the generated Makefile's and we need to get rid of them.
279 for f
in `find . -name Makefile -print`; do
281 cat $f.bak |
tr '\r' ' ' > $f
287 if test "$do_clean" = "yes" ; then
289 ( ( ( make clean
2>&1 ; echo $?
>&4) |
tee clean.log
1>&3) 4>&1 |
(read a
; exit $a) ) 3>&1
290 if test $?
-ne 0 ; then
291 echo "**** ERROR **** Clean failed. See log in clean.log"
296 if test "$do_build" = "yes" ; then
297 echo "Building for cygwin"
298 ( ( ( make $tex_flag 2>&1 ; echo $?
>&4) |
tee m.log
1>&3) 4>&1 |
(read a
; exit $a) ) 3>&1
299 if test $?
-ne 0 ; then
300 echo "**** ERROR **** Build failed. See log in m.log"
305 if test "$do_install" = "yes" ; then
306 echo "Installing for cygwin"
307 # first clean out the installation directory to make sure
308 # we don't have old junk lying around.
309 if test -d ${pcb_inst} ; then
312 ( ( ( make install 2>&1 ; echo $?
>&4) |
tee -a m.log
1>&3) 4>&1 |
(read a
; exit $a) ) 3>&1
313 if test $?
-ne 0 ; then
314 echo "**** ERROR **** Build failed. See log in m.log"
324 top_srcdir = ${top_srcdir}
325 top_src_dir = ${top_src_dir}
330 -e "s;@pcb_version@;${pcb_version};g" \
331 -e "s;@pcb_prefix@;${pcb_inst_dir};g" \
332 -e "s;@pcb_srcdir@;${top_src_dir};g" \
333 -e "s;@gtk_win32_runtime@;${gtk_win32_runtime};g" \
334 -e "s;@gd_win32@;${gd_win32};g" \
335 -e "s;@gd_win32_runtime@;${gd_win32_runtime};g" \
336 ${srcdir}/pcb.nsi.
in > ${srcdir}/pcb.nsi
338 echo "Creating windows installer"
339 "${makensis}" ${src_dir}/pcb.nsi
342 echo "Windows installer left in ${srcdir}:"
343 ls -l ${srcdir}/*.exe
349 Creating DOS batch file wrapper for the installer.
350 If you have just built this under cygwin on Vista,
351 you will need to either run the installer from
352 the Vista start menu, Windows explorer or directly from
353 the cygwin shell with
361 .\win32\pcbinst-${pcb_version}.exe