From 840d7fd34f0b196b8fb3d8474d3f6ee206b48f96 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 26 Feb 2009 16:17:46 +0000 Subject: [PATCH] makedist windows distro feature. git-svn-id: file:///svn/unbound/trunk@1498 be551aaa-1e26-0410-a405-d3ace91eadb9 --- Makefile.in | 6 ++-- configure | 59 ++++++++++++++++++--------------- configure.ac | 13 +++++--- makedist.sh | 30 ++++++++++++++--- winrc/rsrc_unbound.rc | 2 -- winrc/rsrc_unbound_checkconf.rc | 2 -- winrc/rsrc_unbound_control.rc | 2 -- winrc/rsrc_unbound_host.rc | 2 -- 8 files changed, 70 insertions(+), 46 deletions(-) diff --git a/Makefile.in b/Makefile.in index e8c306f52..8254b30ba 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,6 +57,7 @@ ifeq "$(QUIET)" "yes" endif BUILD=build/ +WINDRES=windres LINT=splint LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list # compat with openssl linux edition. @@ -126,12 +127,11 @@ ifeq "$(UB_ON_WINDOWS)" "yes" CONTROL_OBJ+=$(BUILD)winrc/rsrc_unbound_control.o CHECKCONF_OBJ+=$(BUILD)winrc/rsrc_unbound_checkconf.o -$(BUILD)%.o: $(srcdir)/%.rc +$(BUILD)%.o: $(srcdir)/%.rc $(srcdir)/config.h $(INFO) Resource $< @if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \ then (cd $(ldnsdir); $(MAKE) copy-headers); fi - @-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); - fi + @-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi $Q$(WINDRES) $(CPPFLAGS) $< $@ endif diff --git a/configure b/configure index 6cf79110e..e1d319846 100755 --- a/configure +++ b/configure @@ -2663,9 +2663,11 @@ if test "${with_conf_file+set}" = set; then ub_conf_file="$withval" fi; +# escape backslashes in the path for the C preprocessor +hdr_config="`echo $ub_conf_file | sed -e 's/\\\\/\\\\\\\\/g'`" cat >>confdefs.h <<_ACEOF -#define CONFIGFILE "$ub_conf_file" +#define CONFIGFILE "$hdr_config" _ACEOF @@ -2679,9 +2681,10 @@ else UNBOUND_RUN_DIR=`dirname "$ub_conf_file"` fi; +hdr_run="`echo $UNBOUND_RUN_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" cat >>confdefs.h <<_ACEOF -#define RUN_DIR "$UNBOUND_RUN_DIR" +#define RUN_DIR "$hdr_run" _ACEOF @@ -2694,9 +2697,10 @@ else UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR" fi; +hdr_chroot="`echo $UNBOUND_CHROOT_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" cat >>confdefs.h <<_ACEOF -#define CHROOT_DIR "$UNBOUND_CHROOT_DIR" +#define CHROOT_DIR "$hdr_chroot" _ACEOF @@ -2709,9 +2713,10 @@ else UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid" fi; +hdr_pid="`echo $UNBOUND_PIDFILE | sed -e 's/\\\\/\\\\\\\\/g'`" cat >>confdefs.h <<_ACEOF -#define PIDFILE "$UNBOUND_PIDFILE" +#define PIDFILE "$hdr_pid" _ACEOF @@ -5461,7 +5466,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5464 "configure"' > conftest.$ac_ext + echo '#line 5469 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6717,11 +6722,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6720: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6725: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6724: \$? = $ac_status" >&5 + echo "$as_me:6729: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7007,11 +7012,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7010: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7015: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7014: \$? = $ac_status" >&5 + echo "$as_me:7019: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7111,11 +7116,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7114: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7119: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7118: \$? = $ac_status" >&5 + echo "$as_me:7123: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9381,7 +9386,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11893: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11892: \$? = $ac_status" >&5 + echo "$as_me:11897: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11989,11 +11994,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11992: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11997: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11996: \$? = $ac_status" >&5 + echo "$as_me:12001: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13553,11 +13558,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13556: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13561: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13560: \$? = $ac_status" >&5 + echo "$as_me:13565: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13657,11 +13662,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13660: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13665: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13664: \$? = $ac_status" >&5 + echo "$as_me:13669: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15829,11 +15834,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15832: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15837: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15836: \$? = $ac_status" >&5 + echo "$as_me:15841: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16119,11 +16124,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16122: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16127: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16126: \$? = $ac_status" >&5 + echo "$as_me:16131: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16223,11 +16228,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16226: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16231: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16230: \$? = $ac_status" >&5 + echo "$as_me:16235: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized diff --git a/configure.ac b/configure.ac index 7d5829872..8aa912b67 100644 --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,9 @@ AC_ARG_WITH([conf_file], [Pathname to the Unbound configuration file]), [ub_conf_file="$withval"]) AC_SUBST(ub_conf_file) -AC_DEFINE_UNQUOTED(CONFIGFILE, ["$ub_conf_file"], [Pathname to the Unbound configuration file]) +# escape backslashes in the path for the C preprocessor +hdr_config="`echo $ub_conf_file | sed -e 's/\\\\/\\\\\\\\/g'`" +AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file]) # Determine run, chroot directory and pidfile locations AC_ARG_WITH(run-dir, @@ -68,7 +70,8 @@ AC_ARG_WITH(run-dir, UNBOUND_RUN_DIR="$withval", UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`) AC_SUBST(UNBOUND_RUN_DIR) -AC_DEFINE_UNQUOTED(RUN_DIR, ["$UNBOUND_RUN_DIR"], [Directory to chdir to]) +hdr_run="`echo $UNBOUND_RUN_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" +AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to]) AC_ARG_WITH(chroot-dir, AC_HELP_STRING([--with-chroot-dir=path], @@ -76,7 +79,8 @@ AC_ARG_WITH(chroot-dir, UNBOUND_CHROOT_DIR="$withval", UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR") AC_SUBST(UNBOUND_CHROOT_DIR) -AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$UNBOUND_CHROOT_DIR"], [Directory to chroot to]) +hdr_chroot="`echo $UNBOUND_CHROOT_DIR | sed -e 's/\\\\/\\\\\\\\/g'`" +AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to]) AC_ARG_WITH(pidfile, AC_HELP_STRING([--with-pidfile=filename], @@ -84,7 +88,8 @@ AC_ARG_WITH(pidfile, UNBOUND_PIDFILE="$withval", UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid") AC_SUBST(UNBOUND_PIDFILE) -AC_DEFINE_UNQUOTED(PIDFILE, ["$UNBOUND_PIDFILE"], [default pidfile location]) +hdr_pid="`echo $UNBOUND_PIDFILE | sed -e 's/\\\\/\\\\\\\\/g'`" +AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location]) AC_ARG_WITH(username, AC_HELP_STRING([--with-username=user], diff --git a/makedist.sh b/makedist.sh index 67085fbe4..441c0a66a 100755 --- a/makedist.sh +++ b/makedist.sh @@ -42,11 +42,10 @@ cwd=`pwd` # Utility functions. usage () { cat >&2 < Build a release candidate, the given string will be added @@ -55,6 +54,7 @@ Generate a distribution tar file for NSD. -d SVN_root Retrieve the NSD source from the specified repository. Detected from svn working copy if not specified. -l ldnsdir Directory where ldns resides. Detected from Makefile. + -w ... Build windows snapshot binary zip. last args put to configure. EOF exit 1 } @@ -128,6 +128,8 @@ while [ "$1" ]; do ;; "-w") DOWIN="yes" + shift + break ;; "-l") LDNSDIR="$2" @@ -147,6 +149,26 @@ done if [ "$DOWIN" = "yes" ]; then version=`./configure --version | head -1 | awk '{ print $3 }'` || \ error_cleanup "Cannot determine version number." + if [ "$RC" != "no" ]; then + version2="${version}rc$RC" + replace_text "configure.ac" "AC_INIT(unbound, $version" "AC_INIT(unbound, $version2" + version="$version2" + info "Rebuilding configure script (autoconf) snapshot." + autoreconf || error_cleanup "Autoconf failed." + rm -r autom4te* || error_cleanup "Failed to remove autoconf cache directory." + fi + + info "Creating windows dist unbound $version" + info "Calling configure" + echo './configure --enable-debug --enable-static-exe "--with-conf-file=C:\Program Files\Unbound\service.conf" "--with-run-dir=C:\Program Files\Unbound" '"$*" + ./configure --enable-debug --enable-static-exe \ + "--with-conf-file=C:\Program Files\Unbound\service.conf" \ + "--with-run-dir=C:\Program Files\Unbound" $* \ + || error_cleanup "Could not configure" + info "Calling make" + make || error_cleanup "Could not make" + info "Make complete" + info "Unbound version: $version" file="unbound-$version.zip" rm -f $file @@ -160,8 +182,8 @@ if [ "$DOWIN" = "yes" ]; then cp ../unbound-checkconf.exe unbound-checkconf.exe cp ../LICENSE LICENSE cp ../winrc/unbound-website.url unbound-website.url - zip ../$file LICENSE unbound.exe unbound-host.exe unbound-control.exe unbound-checkconf.exe example.conf unbound-website.url - rm -f example.conf + cp ../winrc/service.conf service.conf + zip ../$file LICENSE unbound.exe unbound-host.exe unbound-control.exe unbound-checkconf.exe example.conf service.conf unbound-website.url info "Testing $file" cd .. rm -rf tmp.$$ diff --git a/winrc/rsrc_unbound.rc b/winrc/rsrc_unbound.rc index bd4b37f02..08dc77022 100644 --- a/winrc/rsrc_unbound.rc +++ b/winrc/rsrc_unbound.rc @@ -10,8 +10,6 @@ 4 ICON "winrc/unbound16.ico" 1 VERSIONINFO -/*FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0*/ FILEVERSION RSRC_PACKAGE_VERSION PRODUCTVERSION RSRC_PACKAGE_VERSION FILEFLAGSMASK 0 diff --git a/winrc/rsrc_unbound_checkconf.rc b/winrc/rsrc_unbound_checkconf.rc index 850ce2e20..7a000a962 100644 --- a/winrc/rsrc_unbound_checkconf.rc +++ b/winrc/rsrc_unbound_checkconf.rc @@ -10,8 +10,6 @@ 4 ICON "winrc/unbound16.ico" 1 VERSIONINFO -/*FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0*/ FILEVERSION RSRC_PACKAGE_VERSION PRODUCTVERSION RSRC_PACKAGE_VERSION FILEFLAGSMASK 0 diff --git a/winrc/rsrc_unbound_control.rc b/winrc/rsrc_unbound_control.rc index c346aad5a..312702ea6 100644 --- a/winrc/rsrc_unbound_control.rc +++ b/winrc/rsrc_unbound_control.rc @@ -10,8 +10,6 @@ 4 ICON "winrc/unbound16.ico" 1 VERSIONINFO -/*FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0*/ FILEVERSION RSRC_PACKAGE_VERSION PRODUCTVERSION RSRC_PACKAGE_VERSION FILEFLAGSMASK 0 diff --git a/winrc/rsrc_unbound_host.rc b/winrc/rsrc_unbound_host.rc index 7b460ebda..5a801e292 100644 --- a/winrc/rsrc_unbound_host.rc +++ b/winrc/rsrc_unbound_host.rc @@ -10,8 +10,6 @@ 4 ICON "winrc/unbound16.ico" 1 VERSIONINFO -/*FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0*/ FILEVERSION RSRC_PACKAGE_VERSION PRODUCTVERSION RSRC_PACKAGE_VERSION FILEFLAGSMASK 0 -- 2.47.3