mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-23 00:00:51 -05:00
setup.exe can be created from crosscompile.
git-svn-id: file:///svn/unbound/trunk@1723 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
43d9c09372
commit
a0d67a87f0
14 changed files with 320 additions and 456 deletions
73
Makefile.in
73
Makefile.in
|
|
@ -35,6 +35,7 @@ doxygen=@doxygen@
|
||||||
libtool=@libtool@
|
libtool=@libtool@
|
||||||
ldnsdir=@ldnsdir@
|
ldnsdir=@ldnsdir@
|
||||||
staticexe=@staticexe@
|
staticexe=@staticexe@
|
||||||
|
EXEEXT=@EXEEXT@
|
||||||
configfile=@ub_conf_file@
|
configfile=@ub_conf_file@
|
||||||
UNBOUND_RUN_DIR=@UNBOUND_RUN_DIR@
|
UNBOUND_RUN_DIR=@UNBOUND_RUN_DIR@
|
||||||
CHECKLOCK_SRC=@CHECKLOCK_SRC@
|
CHECKLOCK_SRC=@CHECKLOCK_SRC@
|
||||||
|
|
@ -46,6 +47,7 @@ PYTHON_SITE_PKG=@PYTHON_SITE_PKG@
|
||||||
SWIG=@SWIG@
|
SWIG=@SWIG@
|
||||||
YACC=@YACC@
|
YACC=@YACC@
|
||||||
LEX=@LEX@
|
LEX=@LEX@
|
||||||
|
STRIP=@STRIP@
|
||||||
CC=@CC@
|
CC=@CC@
|
||||||
CPPFLAGS=-I. @CPPFLAGS@
|
CPPFLAGS=-I. @CPPFLAGS@
|
||||||
ifneq "$(srcdir)" "."
|
ifneq "$(srcdir)" "."
|
||||||
|
|
@ -82,6 +84,7 @@ COMMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/services/*.c \
|
||||||
$(srcdir)/iterator/*.c $(srcdir)/validator/*.c $(PYTHONMOD_SRC))) \
|
$(srcdir)/iterator/*.c $(srcdir)/validator/*.c $(PYTHONMOD_SRC))) \
|
||||||
util/configparser.c util/configlexer.c $(CHECKLOCK_SRC)
|
util/configparser.c util/configlexer.c $(CHECKLOCK_SRC)
|
||||||
COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.lo))
|
COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.lo))
|
||||||
|
COMPAT_SRC=$(addprefix compat/,$(LIBOBJS:.o=.c))
|
||||||
COMPAT_OBJ=$(addprefix $(BUILD)compat/,$(LIBOBJS:.o=.lo))
|
COMPAT_OBJ=$(addprefix $(BUILD)compat/,$(LIBOBJS:.o=.lo))
|
||||||
UNITTEST_SRC=$(patsubst $(srcdir)/%,%, \
|
UNITTEST_SRC=$(patsubst $(srcdir)/%,%, \
|
||||||
$(wildcard $(srcdir)/testcode/unit*.c)) \
|
$(wildcard $(srcdir)/testcode/unit*.c)) \
|
||||||
|
|
@ -139,7 +142,8 @@ ifeq "$(UB_ON_WINDOWS)" "yes"
|
||||||
CONTROL_OBJ+=$(BUILD)winrc/rsrc_unbound_control.o
|
CONTROL_OBJ+=$(BUILD)winrc/rsrc_unbound_control.o
|
||||||
CHECKCONF_OBJ+=$(BUILD)winrc/rsrc_unbound_checkconf.o
|
CHECKCONF_OBJ+=$(BUILD)winrc/rsrc_unbound_checkconf.o
|
||||||
|
|
||||||
WINAPPS=unbound-service-install unbound-service-remove anchor-update
|
WINAPPS=$(addsuffix $(EXEEXT), unbound-service-install \
|
||||||
|
unbound-service-remove anchor-update)
|
||||||
SVCINST_SRC=winrc/unbound-service-install.c winrc/w_inst.c
|
SVCINST_SRC=winrc/unbound-service-install.c winrc/w_inst.c
|
||||||
SVCINST_OBJ=$(addprefix $(BUILD),$(SVCINST_SRC:.c=.lo)) $(COMPAT_OBJ) \
|
SVCINST_OBJ=$(addprefix $(BUILD),$(SVCINST_SRC:.c=.lo)) $(COMPAT_OBJ) \
|
||||||
$(BUILD)winrc/rsrc_svcinst.o
|
$(BUILD)winrc/rsrc_svcinst.o
|
||||||
|
|
@ -173,10 +177,10 @@ $(BUILD)%.lo: $(srcdir)/%.c
|
||||||
@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
|
@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
|
||||||
$Q$(COMPILE) -c $< -o $@
|
$Q$(COMPILE) -c $< -o $@
|
||||||
|
|
||||||
all: $(COMMON_OBJ) unbound unbound-checkconf lib unbound-host unbound-control unbound-control-setup $(WINAPPS)
|
all: $(COMMON_OBJ) unbound$(EXEEXT) unbound-checkconf$(EXEEXT) lib unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup $(WINAPPS)
|
||||||
|
|
||||||
TEST_BIN=asynclook delayer harvest lock-verify memstats perf pktview signit \
|
TEST_BIN=$(addsuffix $(EXEEXT),asynclook delayer harvest lock-verify \
|
||||||
streamtcp testbound unittest
|
memstats perf pktview signit streamtcp testbound unittest)
|
||||||
tests: all $(TEST_BIN)
|
tests: all $(TEST_BIN)
|
||||||
|
|
||||||
test: tests
|
test: tests
|
||||||
|
|
@ -193,79 +197,82 @@ ldnslib=$(ldnsdir)/lib/libldns.a
|
||||||
$(ldnslib):
|
$(ldnslib):
|
||||||
@if test ! -z "$(ldnsdir)"; \
|
@if test ! -z "$(ldnsdir)"; \
|
||||||
then (cd $(ldnsdir) && $(MAKE)); fi
|
then (cd $(ldnsdir) && $(MAKE)); fi
|
||||||
|
$(ldnsdir)/%:
|
||||||
|
@if test ! -z "$(ldnsdir)"; \
|
||||||
|
then (cd $(ldnsdir) && $(MAKE)); fi
|
||||||
else
|
else
|
||||||
ldnslib=
|
ldnslib=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
unbound: $(DAEMON_OBJ) $(ldnslib)
|
unbound$(EXEEXT): $(DAEMON_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) -lssl $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) -lssl $(LIBS)
|
||||||
|
|
||||||
unbound-checkconf: $(CHECKCONF_OBJ) $(ldnslib)
|
unbound-checkconf$(EXEEXT): $(CHECKCONF_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(LIBS)
|
||||||
|
|
||||||
unbound-control: $(CONTROL_OBJ) $(ldnslib)
|
unbound-control$(EXEEXT): $(CONTROL_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(CONTROL_OBJ)) -lssl $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(CONTROL_OBJ)) -lssl $(LIBS)
|
||||||
|
|
||||||
unbound-host: $(HOST_OBJ) libunbound.la $(ldnslib)
|
unbound-host$(EXEEXT): $(HOST_OBJ) libunbound.la $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(HOST_OBJ)) -L. -L.libs -lunbound $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(HOST_OBJ)) -L. -L.libs -lunbound $(LIBS)
|
||||||
|
|
||||||
unbound-service-install: $(SVCINST_OBJ)
|
unbound-service-install$(EXEEXT): $(SVCINST_OBJ)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(SVCINST_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(SVCINST_OBJ)) $(LIBS)
|
||||||
|
|
||||||
unbound-service-remove: $(SVCUNINST_OBJ)
|
unbound-service-remove$(EXEEXT): $(SVCUNINST_OBJ)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(SVCUNINST_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(SVCUNINST_OBJ)) $(LIBS)
|
||||||
|
|
||||||
anchor-update: $(ANCHORUPD_OBJ) libunbound.la $(ldnslib)
|
anchor-update$(EXEEXT): $(ANCHORUPD_OBJ) libunbound.la $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(ANCHORUPD_OBJ)) -L. -L.libs -lunbound $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(ANCHORUPD_OBJ)) -L. -L.libs -lunbound $(LIBS)
|
||||||
|
|
||||||
unittest: $(UNITTEST_OBJ) $(ldnslib)
|
unittest$(EXEEXT): $(UNITTEST_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)
|
||||||
|
|
||||||
testbound: $(TESTBOUND_OBJ) $(ldnslib)
|
testbound$(EXEEXT): $(TESTBOUND_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(TESTBOUND_OBJ)) -lssl $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(TESTBOUND_OBJ)) -lssl $(LIBS)
|
||||||
|
|
||||||
lock-verify: $(LOCKVERIFY_OBJ) $(ldnslib)
|
lock-verify$(EXEEXT): $(LOCKVERIFY_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(LOCKVERIFY_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(LOCKVERIFY_OBJ)) $(LIBS)
|
||||||
|
|
||||||
pktview: $(PKTVIEW_OBJ) $(ldnslib)
|
pktview$(EXEEXT): $(PKTVIEW_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(PKTVIEW_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(PKTVIEW_OBJ)) $(LIBS)
|
||||||
|
|
||||||
signit: $(SIGNIT_OBJ) $(ldnslib)
|
signit$(EXEEXT): $(SIGNIT_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(SIGNIT_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(SIGNIT_OBJ)) $(LIBS)
|
||||||
|
|
||||||
memstats: $(MEMSTATS_OBJ) $(ldnslib)
|
memstats$(EXEEXT): $(MEMSTATS_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(MEMSTATS_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(MEMSTATS_OBJ)) $(LIBS)
|
||||||
|
|
||||||
asynclook: $(ASYNCLOOK_OBJ) $(ldnslib) libunbound.la
|
asynclook$(EXEEXT): $(ASYNCLOOK_OBJ) $(ldnslib) libunbound.la
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(ASYNCLOOK_OBJ)) $(LIBS) -L. -L.libs -lunbound
|
$Q$(LINK) -o $@ $(sort $(ASYNCLOOK_OBJ)) $(LIBS) -L. -L.libs -lunbound
|
||||||
|
|
||||||
streamtcp: $(STREAMTCP_OBJ) $(ldnslib)
|
streamtcp$(EXEEXT): $(STREAMTCP_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(STREAMTCP_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(STREAMTCP_OBJ)) $(LIBS)
|
||||||
|
|
||||||
perf: $(PERF_OBJ) $(ldnslib)
|
perf$(EXEEXT): $(PERF_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(PERF_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(PERF_OBJ)) $(LIBS)
|
||||||
|
|
||||||
delayer: $(DELAYER_OBJ) $(ldnslib)
|
delayer$(EXEEXT): $(DELAYER_OBJ) $(ldnslib)
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(DELAYER_OBJ)) $(LIBS)
|
$Q$(LINK) -o $@ $(sort $(DELAYER_OBJ)) $(LIBS)
|
||||||
|
|
||||||
harvest: $(HARVEST_OBJ) $(ldnslib) libunbound.la
|
harvest$(EXEEXT): $(HARVEST_OBJ) $(ldnslib) libunbound.la
|
||||||
$(INFO) Link $@
|
$(INFO) Link $@
|
||||||
$Q$(LINK) -o $@ $(sort $(HARVEST_OBJ)) $(LIBS) -L. -L.libs -lunbound
|
$Q$(LINK) -o $@ $(sort $(HARVEST_OBJ)) $(LIBS) -L. -L.libs -lunbound
|
||||||
|
|
||||||
|
|
@ -318,7 +325,7 @@ util/configparser.c util/configparser.h: $(srcdir)/util/configparser.y
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.d *.lo *~ tags
|
rm -f *.o *.d *.lo *~ tags
|
||||||
rm -f unbound unbound-checkconf unbound-host unbound-control unbound-control-setup libunbound.la
|
rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup libunbound.la
|
||||||
rm -rf autom4te.cache .libs build doc/html doc/xml
|
rm -rf autom4te.cache .libs build doc/html doc/xml
|
||||||
|
|
||||||
realclean: clean
|
realclean: clean
|
||||||
|
|
@ -349,10 +356,10 @@ doc:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
strip:
|
strip:
|
||||||
strip unbound
|
$(STRIP) unbound$(EXEEXT)
|
||||||
strip unbound-checkconf
|
$(STRIP) unbound-checkconf$(EXEEXT)
|
||||||
strip unbound-control
|
$(STRIP) unbound-control$(EXEEXT)
|
||||||
strip unbound-host
|
$(STRIP) unbound-host$(EXEEXT)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
|
||||||
|
|
@ -363,10 +370,10 @@ install:
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
|
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
|
||||||
$(LIBTOOL) --mode=install cp unbound $(DESTDIR)$(sbindir)/unbound
|
$(LIBTOOL) --mode=install cp unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound$(EXEEXT)
|
||||||
$(LIBTOOL) --mode=install cp unbound-checkconf $(DESTDIR)$(sbindir)/unbound-checkconf
|
$(LIBTOOL) --mode=install cp unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT)
|
||||||
$(LIBTOOL) --mode=install cp unbound-control $(DESTDIR)$(sbindir)/unbound-control
|
$(LIBTOOL) --mode=install cp unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT)
|
||||||
$(LIBTOOL) --mode=install cp unbound-host $(DESTDIR)$(sbindir)/unbound-host
|
$(LIBTOOL) --mode=install cp unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT)
|
||||||
ifeq "$(WITH_PYTHONMODULE)" "yes"
|
ifeq "$(WITH_PYTHONMODULE)" "yes"
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
|
||||||
$(INSTALL) -c -m 644 pythonmod/unboundmodule.py $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
|
$(INSTALL) -c -m 644 pythonmod/unboundmodule.py $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
|
||||||
|
|
@ -389,7 +396,7 @@ endif
|
||||||
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
|
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f -- $(DESTDIR)$(sbindir)/unbound $(DESTDIR)$(sbindir)/unbound-checkconf $(DESTDIR)$(sbindir)/unbound-host $(DESTDIR)$(sbindir)/unbound-control $(DESTDIR)$(sbindir)/unbound-control-setup
|
rm -f -- $(DESTDIR)$(sbindir)/unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control-setup
|
||||||
rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8
|
rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8
|
||||||
rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
|
rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
|
||||||
rm -f -- $(DESTDIR)$(includedir)/unbound.h
|
rm -f -- $(DESTDIR)$(includedir)/unbound.h
|
||||||
|
|
@ -427,7 +434,7 @@ $(BUILD)%.d: $(srcdir)/%.c
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
ifneq ($(MAKECMDGOALS),realclean)
|
ifneq ($(MAKECMDGOALS),realclean)
|
||||||
ifeq ($(debug_enabled),yes)
|
ifeq ($(debug_enabled),yes)
|
||||||
-include $(addprefix $(BUILD),$(ALL_SRC:.c=.d))
|
-include $(addprefix $(BUILD),$(ALL_SRC:.c=.d) $(COMPAT_SRC:.c=.d))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
122
configure
vendored
122
configure
vendored
|
|
@ -819,7 +819,6 @@ NMEDIT
|
||||||
DSYMUTIL
|
DSYMUTIL
|
||||||
lt_ECHO
|
lt_ECHO
|
||||||
RANLIB
|
RANLIB
|
||||||
STRIP
|
|
||||||
OBJDUMP
|
OBJDUMP
|
||||||
LN_S
|
LN_S
|
||||||
NM
|
NM
|
||||||
|
|
@ -839,6 +838,7 @@ build_vendor
|
||||||
build_cpu
|
build_cpu
|
||||||
build
|
build
|
||||||
libtool
|
libtool
|
||||||
|
STRIP
|
||||||
doxygen
|
doxygen
|
||||||
YFLAGS
|
YFLAGS
|
||||||
YACC
|
YACC
|
||||||
|
|
@ -6446,6 +6446,98 @@ $as_echo "no" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test -n "$ac_tool_prefix"; then
|
||||||
|
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
|
||||||
|
set dummy ${ac_tool_prefix}strip; ac_word=$2
|
||||||
|
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||||
|
$as_echo_n "checking for $ac_word... " >&6; }
|
||||||
|
if test "${ac_cv_prog_STRIP+set}" = set; then
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
if test -n "$STRIP"; then
|
||||||
|
ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
|
||||||
|
else
|
||||||
|
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||||
|
for as_dir in $PATH
|
||||||
|
do
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
test -z "$as_dir" && as_dir=.
|
||||||
|
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||||
|
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||||
|
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
|
||||||
|
$as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
STRIP=$ac_cv_prog_STRIP
|
||||||
|
if test -n "$STRIP"; then
|
||||||
|
{ $as_echo "$as_me:$LINENO: result: $STRIP" >&5
|
||||||
|
$as_echo "$STRIP" >&6; }
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test -z "$ac_cv_prog_STRIP"; then
|
||||||
|
ac_ct_STRIP=$STRIP
|
||||||
|
# Extract the first word of "strip", so it can be a program name with args.
|
||||||
|
set dummy strip; ac_word=$2
|
||||||
|
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||||
|
$as_echo_n "checking for $ac_word... " >&6; }
|
||||||
|
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
if test -n "$ac_ct_STRIP"; then
|
||||||
|
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
|
||||||
|
else
|
||||||
|
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||||
|
for as_dir in $PATH
|
||||||
|
do
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
test -z "$as_dir" && as_dir=.
|
||||||
|
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||||
|
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||||
|
ac_cv_prog_ac_ct_STRIP="strip"
|
||||||
|
$as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
|
||||||
|
if test -n "$ac_ct_STRIP"; then
|
||||||
|
{ $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
|
||||||
|
$as_echo "$ac_ct_STRIP" >&6; }
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$ac_ct_STRIP" = x; then
|
||||||
|
STRIP=""
|
||||||
|
else
|
||||||
|
case $cross_compiling:$ac_tool_warned in
|
||||||
|
yes:)
|
||||||
|
{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||||
|
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||||
|
ac_tool_warned=yes ;;
|
||||||
|
esac
|
||||||
|
STRIP=$ac_ct_STRIP
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
STRIP="$ac_cv_prog_STRIP"
|
||||||
|
fi
|
||||||
|
|
||||||
ac_aux_dir=
|
ac_aux_dir=
|
||||||
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
||||||
if test -f "$ac_dir/install-sh"; then
|
if test -f "$ac_dir/install-sh"; then
|
||||||
|
|
@ -7168,13 +7260,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
|
||||||
else
|
else
|
||||||
lt_cv_nm_interface="BSD nm"
|
lt_cv_nm_interface="BSD nm"
|
||||||
echo "int some_variable = 0;" > conftest.$ac_ext
|
echo "int some_variable = 0;" > conftest.$ac_ext
|
||||||
(eval echo "\"\$as_me:7171: $ac_compile\"" >&5)
|
(eval echo "\"\$as_me:7263: $ac_compile\"" >&5)
|
||||||
(eval "$ac_compile" 2>conftest.err)
|
(eval "$ac_compile" 2>conftest.err)
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
(eval echo "\"\$as_me:7174: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
(eval echo "\"\$as_me:7266: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||||
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
(eval echo "\"\$as_me:7177: output\"" >&5)
|
(eval echo "\"\$as_me:7269: output\"" >&5)
|
||||||
cat conftest.out >&5
|
cat conftest.out >&5
|
||||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||||
lt_cv_nm_interface="MS dumpbin"
|
lt_cv_nm_interface="MS dumpbin"
|
||||||
|
|
@ -8379,7 +8471,7 @@ ia64-*-hpux*)
|
||||||
;;
|
;;
|
||||||
*-*-irix6*)
|
*-*-irix6*)
|
||||||
# Find out which ABI we are using.
|
# Find out which ABI we are using.
|
||||||
echo '#line 8382 "configure"' > conftest.$ac_ext
|
echo '#line 8474 "configure"' > conftest.$ac_ext
|
||||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
(eval $ac_compile) 2>&5
|
(eval $ac_compile) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
|
|
@ -9746,11 +9838,11 @@ else
|
||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:9749: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:9841: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>conftest.err)
|
(eval "$lt_compile" 2>conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
echo "$as_me:9753: \$? = $ac_status" >&5
|
echo "$as_me:9845: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
# So say no if there are warnings other than the usual output.
|
# So say no if there are warnings other than the usual output.
|
||||||
|
|
@ -10085,11 +10177,11 @@ else
|
||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:10088: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:10180: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>conftest.err)
|
(eval "$lt_compile" 2>conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
echo "$as_me:10092: \$? = $ac_status" >&5
|
echo "$as_me:10184: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
# So say no if there are warnings other than the usual output.
|
# So say no if there are warnings other than the usual output.
|
||||||
|
|
@ -10190,11 +10282,11 @@ else
|
||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:10193: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:10285: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>out/conftest.err)
|
(eval "$lt_compile" 2>out/conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat out/conftest.err >&5
|
cat out/conftest.err >&5
|
||||||
echo "$as_me:10197: \$? = $ac_status" >&5
|
echo "$as_me:10289: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||||
then
|
then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
|
|
@ -10245,11 +10337,11 @@ else
|
||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:10248: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:10340: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>out/conftest.err)
|
(eval "$lt_compile" 2>out/conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat out/conftest.err >&5
|
cat out/conftest.err >&5
|
||||||
echo "$as_me:10252: \$? = $ac_status" >&5
|
echo "$as_me:10344: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||||
then
|
then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
|
|
@ -13048,7 +13140,7 @@ else
|
||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 13051 "configure"
|
#line 13143 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
|
|
@ -13144,7 +13236,7 @@ else
|
||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 13147 "configure"
|
#line 13239 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ fi
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_CHECK_PROG(doxygen, doxygen, doxygen)
|
AC_CHECK_PROG(doxygen, doxygen, doxygen)
|
||||||
|
AC_CHECK_TOOL(STRIP, strip)
|
||||||
ACX_LIBTOOL_C_ONLY
|
ACX_LIBTOOL_C_ONLY
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
15 July 2009: Wouter
|
||||||
|
- dependencies for compat items, for crosscompile.
|
||||||
|
- mingw32 crosscompile changes, dependencies and zipfile creation.
|
||||||
|
and with System.dll from the windows NSIS you can make setup.exe.
|
||||||
|
|
||||||
14 July 2009: Wouter
|
14 July 2009: Wouter
|
||||||
- updated ldns tarball for solaris x64 compile assistance.
|
- updated ldns tarball for solaris x64 compile assistance.
|
||||||
- no need to define RAND_MAX from config.h.
|
- no need to define RAND_MAX from config.h.
|
||||||
|
|
|
||||||
36
makedist.sh
36
makedist.sh
|
|
@ -165,11 +165,26 @@ if [ "$DOWIN" = "yes" ]; then
|
||||||
rm -r autom4te* || echo "ignored"
|
rm -r autom4te* || echo "ignored"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# detect crosscompile, from Fedora11 at this point.
|
||||||
|
if test "`uname`" = "Linux"; then
|
||||||
|
cross="yes"
|
||||||
|
configure="mingw32-configure"
|
||||||
|
strip="i686-pc-mingw32-strip"
|
||||||
|
makensis="makensis" # from mingw32-nsis package
|
||||||
|
# on a re-configure the cache may no longer be valid...
|
||||||
|
if test -f mingw32-config.cache; then rm mingw32-config.cache; fi
|
||||||
|
else
|
||||||
|
cross="no" # mingw and msys
|
||||||
|
configure="./configure"
|
||||||
|
strip="strip"
|
||||||
|
makensis="c:/Program Files/NSIS/makensis.exe" # http://nsis.sf.net
|
||||||
|
fi
|
||||||
|
|
||||||
# procedure for making unbound installer on mingw.
|
# procedure for making unbound installer on mingw.
|
||||||
info "Creating windows dist unbound $version"
|
info "Creating windows dist unbound $version"
|
||||||
info "Calling configure"
|
info "Calling configure"
|
||||||
echo './configure --enable-debug --enable-static-exe '"$*"
|
echo "$configure"' --enable-debug --enable-static-exe '"$*"
|
||||||
./configure --enable-debug --enable-static-exe $* \
|
$configure --enable-debug --enable-static-exe $* \
|
||||||
|| error_cleanup "Could not configure"
|
|| error_cleanup "Could not configure"
|
||||||
info "Calling make"
|
info "Calling make"
|
||||||
make || error_cleanup "Could not make"
|
make || error_cleanup "Could not make"
|
||||||
|
|
@ -180,13 +195,13 @@ if [ "$DOWIN" = "yes" ]; then
|
||||||
rm -f $file
|
rm -f $file
|
||||||
info "Creating $file"
|
info "Creating $file"
|
||||||
mkdir tmp.$$
|
mkdir tmp.$$
|
||||||
strip unbound.exe
|
$strip unbound.exe
|
||||||
strip anchor-update.exe
|
$strip anchor-update.exe
|
||||||
strip unbound-control.exe
|
$strip unbound-control.exe
|
||||||
strip unbound-host.exe
|
$strip unbound-host.exe
|
||||||
strip unbound-checkconf.exe
|
$strip unbound-checkconf.exe
|
||||||
strip unbound-service-install.exe
|
$strip unbound-service-install.exe
|
||||||
strip unbound-service-remove.exe
|
$strip unbound-service-remove.exe
|
||||||
cd tmp.$$
|
cd tmp.$$
|
||||||
cp ../doc/example.conf example.conf
|
cp ../doc/example.conf example.conf
|
||||||
cp ../unbound.exe ../unbound-host.exe ../unbound-control.exe ../unbound-checkconf.exe ../unbound-service-install.exe ../unbound-service-remove.exe ../LICENSE ../winrc/unbound-website.url ../winrc/service.conf ../winrc/README.txt .
|
cp ../unbound.exe ../unbound-host.exe ../unbound-control.exe ../unbound-checkconf.exe ../unbound-service-install.exe ../unbound-service-remove.exe ../LICENSE ../winrc/unbound-website.url ../winrc/service.conf ../winrc/README.txt .
|
||||||
|
|
@ -198,8 +213,7 @@ if [ "$DOWIN" = "yes" ]; then
|
||||||
info "Creating installer"
|
info "Creating installer"
|
||||||
quadversion=`cat ../config.h | grep RSRC_PACKAGE_VERSION | sed -e 's/#define RSRC_PACKAGE_VERSION //' -e 's/,/\\./g'`
|
quadversion=`cat ../config.h | grep RSRC_PACKAGE_VERSION | sed -e 's/#define RSRC_PACKAGE_VERSION //' -e 's/,/\\./g'`
|
||||||
cat ../winrc/setup.nsi | sed -e 's/define VERSION.*$/define VERSION "'$version'"/' -e 's/define QUADVERSION.*$/define QUADVERSION "'$quadversion'"/' > ../winrc/setup_ed.nsi
|
cat ../winrc/setup.nsi | sed -e 's/define VERSION.*$/define VERSION "'$version'"/' -e 's/define QUADVERSION.*$/define QUADVERSION "'$quadversion'"/' > ../winrc/setup_ed.nsi
|
||||||
# get tool from http://nsis.sf.net
|
"$makensis" ../winrc/setup_ed.nsi
|
||||||
c:/Program\ Files/NSIS/makensis.exe ../winrc/setup_ed.nsi
|
|
||||||
info "Created installer"
|
info "Created installer"
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf tmp.$$
|
rm -rf tmp.$$
|
||||||
|
|
|
||||||
|
|
@ -1034,12 +1034,14 @@ char* cfg_ptr_reverse(char* str)
|
||||||
* IPv6: (h.){32}.ip6.arpa. */
|
* IPv6: (h.){32}.ip6.arpa. */
|
||||||
|
|
||||||
if(addr_is_ip6(&addr, addrlen)) {
|
if(addr_is_ip6(&addr, addrlen)) {
|
||||||
void* ad = &((struct sockaddr_in6*)&addr)->sin6_addr;
|
uint8_t ad[16];
|
||||||
const char* hex = "0123456789abcdef";
|
const char* hex = "0123456789abcdef";
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
int i;
|
int i;
|
||||||
|
memmove(ad, &((struct sockaddr_in6*)&addr)->sin6_addr,
|
||||||
|
sizeof(ad));
|
||||||
for(i=15; i>=0; i--) {
|
for(i=15; i>=0; i--) {
|
||||||
uint8_t b = ((uint8_t*)ad)[i];
|
uint8_t b = ad[i];
|
||||||
*p++ = hex[ (b&0x0f) ];
|
*p++ = hex[ (b&0x0f) ];
|
||||||
*p++ = '.';
|
*p++ = '.';
|
||||||
*p++ = hex[ (b&0xf0) >> 4 ];
|
*p++ = hex[ (b&0xf0) >> 4 ];
|
||||||
|
|
@ -1047,10 +1049,12 @@ char* cfg_ptr_reverse(char* str)
|
||||||
}
|
}
|
||||||
snprintf(buf+16*4, sizeof(buf)-16*4, "ip6.arpa. ");
|
snprintf(buf+16*4, sizeof(buf)-16*4, "ip6.arpa. ");
|
||||||
} else {
|
} else {
|
||||||
struct in_addr* ad = &((struct sockaddr_in*)&addr)->sin_addr;
|
uint8_t ad[4];
|
||||||
|
memmove(ad, &((struct sockaddr_in*)&addr)->sin_addr,
|
||||||
|
sizeof(ad));
|
||||||
snprintf(buf, sizeof(buf), "%u.%u.%u.%u.in-addr.arpa. ",
|
snprintf(buf, sizeof(buf), "%u.%u.%u.%u.in-addr.arpa. ",
|
||||||
(unsigned)((uint8_t*)ad)[3], (unsigned)((uint8_t*)ad)[2],
|
(unsigned)ad[3], (unsigned)ad[2],
|
||||||
(unsigned)((uint8_t*)ad)[1], (unsigned)((uint8_t*)ad)[0]);
|
(unsigned)ad[1], (unsigned)ad[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printed the reverse address, now the between goop and name on end */
|
/* printed the reverse address, now the between goop and name on end */
|
||||||
|
|
|
||||||
|
|
@ -83,17 +83,16 @@ you prefer.
|
||||||
|
|
||||||
You can crosscompile unbound. This results in .exe files.
|
You can crosscompile unbound. This results in .exe files.
|
||||||
Install the packages: mingw32-binutils mingw32-cpp mingw32-filesystem
|
Install the packages: mingw32-binutils mingw32-cpp mingw32-filesystem
|
||||||
mingw32-gcc mingw32-openssl mingw32-openssl-static mingw32-runtime
|
mingw32-gcc mingw32-openssl mingw32-openssl-static mingw32-runtime zip
|
||||||
mingw32-termcap mingw32-w32api mingw32-zlib mingw32-zlib-static
|
mingw32-termcap mingw32-w32api mingw32-zlib mingw32-zlib-static mingw32-nsis
|
||||||
(package names for fedora 11).
|
(package names for fedora 11).
|
||||||
|
|
||||||
Then run:
|
Then run:
|
||||||
$ mingw32-configure
|
$ mingw32-configure
|
||||||
$ make
|
$ make
|
||||||
|
|
||||||
It may be a good idea to pass --enable-static-exe --enable-debug to
|
Copy System.dll from the windows dist of NSIS to /usr/share/nsis/Plugins/
|
||||||
the mingw32-configure line. This enables statically linked executables
|
Then do ./makedist.sh -w and the setup.exe is created using nsis.
|
||||||
so you do not need to pilfer dlls together, and debug has assertions.
|
|
||||||
|
|
||||||
|
|
||||||
+++ CREDITS
|
+++ CREDITS
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ SetCompressor /solid /final lzma
|
||||||
|
|
||||||
!include LogicLib.nsh
|
!include LogicLib.nsh
|
||||||
!include MUI2.nsh
|
!include MUI2.nsh
|
||||||
!include setup_servicelib.nsh
|
|
||||||
|
|
||||||
!define VERSION "0.0.0"
|
!define VERSION "0.0.0"
|
||||||
!define QUADVERSION "0.0.0.0"
|
!define QUADVERSION "0.0.0.0"
|
||||||
|
|
@ -33,8 +32,8 @@ Var StartMenuFolder
|
||||||
#ReserveFile "System.dll"
|
#ReserveFile "System.dll"
|
||||||
#ReserveFile "NsExec.dll"
|
#ReserveFile "NsExec.dll"
|
||||||
|
|
||||||
!define MUI_ICON "${NSISDIR}\contrib\graphics\icons\orange-install-nsis.ico"
|
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install-nsis.ico"
|
||||||
!define MUI_UNICON "${NSISDIR}\contrib\graphics\icons\orange-uninstall-nsis.ico"
|
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall-nsis.ico"
|
||||||
|
|
||||||
!define MUI_HEADERIMAGE
|
!define MUI_HEADERIMAGE
|
||||||
!define MUI_HEADERIMAGE_RIGHT
|
!define MUI_HEADERIMAGE_RIGHT
|
||||||
|
|
@ -144,7 +143,7 @@ section "-hidden.postinstall"
|
||||||
# install service entry
|
# install service entry
|
||||||
nsExec::ExecToLog '"$INSTDIR\unbound-service-install.exe"'
|
nsExec::ExecToLog '"$INSTDIR\unbound-service-install.exe"'
|
||||||
# start unbound service
|
# start unbound service
|
||||||
!insertmacro SERVICE "start" "unbound" ""
|
nsExec::ExecToLog '"$INSTDIR\unbound-service-install.exe" start'
|
||||||
sectionEnd
|
sectionEnd
|
||||||
|
|
||||||
# set section descriptions
|
# set section descriptions
|
||||||
|
|
@ -157,13 +156,15 @@ LangString DESC_dlv ${LANG_ENGLISH} "Set up to use DLV with dlv.isc.org. Downloa
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
|
|
||||||
# setup macros for uninstall functions.
|
# setup macros for uninstall functions.
|
||||||
|
!ifdef UN
|
||||||
!undef UN
|
!undef UN
|
||||||
|
!endif
|
||||||
!define UN "un."
|
!define UN "un."
|
||||||
|
|
||||||
# uninstaller section
|
# uninstaller section
|
||||||
section "un.Unbound"
|
section "un.Unbound"
|
||||||
# stop unbound service
|
# stop unbound service
|
||||||
!insertmacro SERVICE "stop" "unbound" ""
|
nsExec::ExecToLog '"$INSTDIR\unbound-service-remove.exe" stop'
|
||||||
# uninstall service entry
|
# uninstall service entry
|
||||||
nsExec::ExecToLog '"$INSTDIR\unbound-service-remove.exe"'
|
nsExec::ExecToLog '"$INSTDIR\unbound-service-remove.exe"'
|
||||||
# deregister uninstall
|
# deregister uninstall
|
||||||
|
|
|
||||||
|
|
@ -1,372 +0,0 @@
|
||||||
; Taken from http://nsis.sourceforge.net/NSIS_Service_Lib on 10-mar-2009
|
|
||||||
;
|
|
||||||
|
|
||||||
; NSIS SERVICE LIBRARY - servicelib.nsh
|
|
||||||
; Version 1.5 - Jun 25th, 2008
|
|
||||||
; Questions/Comments - dselkirk@hotmail.com
|
|
||||||
;
|
|
||||||
; Description:
|
|
||||||
; Provides an interface to window services
|
|
||||||
;
|
|
||||||
; Inputs:
|
|
||||||
; action - systemlib action ie. create, delete, start, stop, pause,
|
|
||||||
; continue, installed, running, status
|
|
||||||
; name - name of service to manipulate
|
|
||||||
; param - action parameters; usage: var1=value1;var2=value2;...etc.
|
|
||||||
; (don't forget to add a ';' after the last value!)
|
|
||||||
;
|
|
||||||
; Actions:
|
|
||||||
; create - creates a new windows service
|
|
||||||
; Parameters:
|
|
||||||
; path - path to service executable
|
|
||||||
; autostart - automatically start with system ie. 1|0
|
|
||||||
; interact - interact with the desktop ie. 1|0
|
|
||||||
; depend - service dependencies
|
|
||||||
; user - user that runs the service
|
|
||||||
; password - password of the above user
|
|
||||||
; display - display name in service's console
|
|
||||||
; description - Description of service
|
|
||||||
;
|
|
||||||
; delete - deletes a windows service
|
|
||||||
; start - start a stopped windows service
|
|
||||||
; stop - stops a running windows service
|
|
||||||
; pause - pauses a running windows service
|
|
||||||
; continue - continues a paused windows service
|
|
||||||
; installed - is the provided service installed
|
|
||||||
; Parameters:
|
|
||||||
; action - if true then invokes the specified action
|
|
||||||
; running - is the provided service running
|
|
||||||
; Parameters:
|
|
||||||
; action - if true then invokes the specified action
|
|
||||||
; status - check the status of the provided service
|
|
||||||
;
|
|
||||||
; If run from uninstall define "UN" as "un." before running.
|
|
||||||
;
|
|
||||||
; Usage:
|
|
||||||
; Method 1:
|
|
||||||
; Push "action"
|
|
||||||
; Push "name"
|
|
||||||
; Push "param"
|
|
||||||
; Call Service
|
|
||||||
; Pop $0 ;response
|
|
||||||
;
|
|
||||||
; Method 2:
|
|
||||||
; !insertmacro SERVICE "action" "name" "param"
|
|
||||||
;
|
|
||||||
; History:
|
|
||||||
; 1.0 - 09/15/2003 - Initial release
|
|
||||||
; 1.1 - 09/16/2003 - Changed &l to i, thx brainsucker
|
|
||||||
; 1.2 - 02/29/2004 - Fixed documentation.
|
|
||||||
; 1.3 - 01/05/2006 - Fixed interactive flag and pop order (Kichik)
|
|
||||||
; 1.4 - 12/07/2006 - Added display and depend, fixed datatypes (Vitoco)
|
|
||||||
; 1.5 - 06/25/2008 - Added description of service.(DeSafe.com/liuqixing#gmail.com)
|
|
||||||
|
|
||||||
!ifndef SERVICELIB
|
|
||||||
!define SERVICELIB
|
|
||||||
|
|
||||||
!define SC_MANAGER_ALL_ACCESS 0x3F
|
|
||||||
!define SERVICE_ALL_ACCESS 0xF01FF
|
|
||||||
|
|
||||||
!define SERVICE_CONTROL_STOP 1
|
|
||||||
!define SERVICE_CONTROL_PAUSE 2
|
|
||||||
!define SERVICE_CONTROL_CONTINUE 3
|
|
||||||
|
|
||||||
!define SERVICE_STOPPED 0x1
|
|
||||||
!define SERVICE_START_PENDING 0x2
|
|
||||||
!define SERVICE_STOP_PENDING 0x3
|
|
||||||
!define SERVICE_RUNNING 0x4
|
|
||||||
!define SERVICE_CONTINUE_PENDING 0x5
|
|
||||||
!define SERVICE_PAUSE_PENDING 0x6
|
|
||||||
!define SERVICE_PAUSED 0x7
|
|
||||||
|
|
||||||
!ifndef UN
|
|
||||||
!define UN ""
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!macro SERVICE ACTION NAME PARAM
|
|
||||||
Push '${ACTION}'
|
|
||||||
Push '${NAME}'
|
|
||||||
Push '${PARAM}'
|
|
||||||
Call ${UN}Service
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro FUNC_GETPARAM
|
|
||||||
Push $0
|
|
||||||
Push $1
|
|
||||||
Push $2
|
|
||||||
Push $3
|
|
||||||
Push $4
|
|
||||||
Push $5
|
|
||||||
Push $6
|
|
||||||
Push $7
|
|
||||||
Exch 8
|
|
||||||
Pop $1 ;name
|
|
||||||
Exch 8
|
|
||||||
Pop $2 ;source
|
|
||||||
StrCpy $0 ""
|
|
||||||
StrLen $7 $2
|
|
||||||
StrCpy $3 0
|
|
||||||
lbl_loop:
|
|
||||||
IntCmp $3 $7 0 0 lbl_done
|
|
||||||
StrLen $4 "$1="
|
|
||||||
StrCpy $5 $2 $4 $3
|
|
||||||
StrCmp $5 "$1=" 0 lbl_next
|
|
||||||
IntOp $5 $3 + $4
|
|
||||||
StrCpy $3 $5
|
|
||||||
lbl_loop2:
|
|
||||||
IntCmp $3 $7 0 0 lbl_done
|
|
||||||
StrCpy $6 $2 1 $3
|
|
||||||
StrCmp $6 ";" 0 lbl_next2
|
|
||||||
IntOp $6 $3 - $5
|
|
||||||
StrCpy $0 $2 $6 $5
|
|
||||||
Goto lbl_done
|
|
||||||
lbl_next2:
|
|
||||||
IntOp $3 $3 + 1
|
|
||||||
Goto lbl_loop2
|
|
||||||
lbl_next:
|
|
||||||
IntOp $3 $3 + 1
|
|
||||||
Goto lbl_loop
|
|
||||||
lbl_done:
|
|
||||||
Pop $5
|
|
||||||
Pop $4
|
|
||||||
Pop $3
|
|
||||||
Pop $2
|
|
||||||
Pop $1
|
|
||||||
Exch 2
|
|
||||||
Pop $6
|
|
||||||
Pop $7
|
|
||||||
Exch $0
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro CALL_GETPARAM VAR NAME DEFAULT LABEL
|
|
||||||
Push $1
|
|
||||||
Push ${NAME}
|
|
||||||
Call ${UN}GETPARAM
|
|
||||||
Pop $6
|
|
||||||
StrCpy ${VAR} "${DEFAULT}"
|
|
||||||
StrCmp $6 "" "${LABEL}" 0
|
|
||||||
StrCpy ${VAR} $6
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro FUNC_SERVICE UN
|
|
||||||
Push $0
|
|
||||||
Push $1
|
|
||||||
Push $2
|
|
||||||
Push $3
|
|
||||||
Push $4
|
|
||||||
Push $5
|
|
||||||
Push $6
|
|
||||||
Push $7
|
|
||||||
Exch 8
|
|
||||||
Pop $1 ;param
|
|
||||||
Exch 8
|
|
||||||
Pop $2 ;name
|
|
||||||
Exch 8
|
|
||||||
Pop $3 ;action
|
|
||||||
;$0 return
|
|
||||||
;$4 OpenSCManager
|
|
||||||
;$5 OpenService
|
|
||||||
|
|
||||||
StrCpy $0 "false"
|
|
||||||
System::Call 'advapi32::OpenSCManagerA(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.r4'
|
|
||||||
IntCmp $4 0 lbl_done
|
|
||||||
StrCmp $3 "create" lbl_create
|
|
||||||
System::Call 'advapi32::OpenServiceA(i r4, t r2, i ${SERVICE_ALL_ACCESS}) i.r5'
|
|
||||||
IntCmp $5 0 lbl_done
|
|
||||||
|
|
||||||
lbl_select:
|
|
||||||
StrCmp $3 "delete" lbl_delete
|
|
||||||
StrCmp $3 "start" lbl_start
|
|
||||||
StrCmp $3 "stop" lbl_stop
|
|
||||||
StrCmp $3 "pause" lbl_pause
|
|
||||||
StrCmp $3 "continue" lbl_continue
|
|
||||||
StrCmp $3 "installed" lbl_installed
|
|
||||||
StrCmp $3 "running" lbl_running
|
|
||||||
StrCmp $3 "status" lbl_status
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
; create service
|
|
||||||
lbl_create:
|
|
||||||
Push $R1 ;depend
|
|
||||||
Push $R2 ;user
|
|
||||||
Push $R3 ;password
|
|
||||||
Push $R4 ;interact
|
|
||||||
Push $R5 ;autostart
|
|
||||||
Push $R6 ;path
|
|
||||||
Push $R7 ;display
|
|
||||||
Push $R8 ;description
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R1 "depend" "n" "lbl_depend"
|
|
||||||
StrCpy $R1 't "$R1"'
|
|
||||||
lbl_depend:
|
|
||||||
StrCmp $R1 "n" 0 lbl_machine ;old name of depend param
|
|
||||||
!insertmacro CALL_GETPARAM $R1 "machine" "n" "lbl_machine"
|
|
||||||
StrCpy $R1 't "$R1"'
|
|
||||||
lbl_machine:
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R2 "user" "n" "lbl_user"
|
|
||||||
StrCpy $R2 't "$R2"'
|
|
||||||
lbl_user:
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R3 "password" "n" "lbl_password"
|
|
||||||
StrCpy $R3 't "$R3"'
|
|
||||||
lbl_password:
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R4 "interact" "0x10" "lbl_interact"
|
|
||||||
StrCpy $6 0x10
|
|
||||||
IntCmp $R4 0 +2
|
|
||||||
IntOp $6 $6 | 0x100
|
|
||||||
StrCpy $R4 $6
|
|
||||||
lbl_interact:
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R5 "autostart" "0x3" "lbl_autostart"
|
|
||||||
StrCpy $6 0x3
|
|
||||||
IntCmp $R5 0 +2
|
|
||||||
StrCpy $6 0x2
|
|
||||||
StrCpy $R5 $6
|
|
||||||
lbl_autostart:
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R6 "path" "n" "lbl_path"
|
|
||||||
lbl_path:
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R7 "display" "$2" "lbl_display"
|
|
||||||
lbl_display:
|
|
||||||
|
|
||||||
!insertmacro CALL_GETPARAM $R8 "description" "$2" "lbl_description"
|
|
||||||
lbl_description:
|
|
||||||
|
|
||||||
System::Call 'advapi32::CreateServiceA(i r4, t r2, t R7, i ${SERVICE_ALL_ACCESS}, \
|
|
||||||
i R4, i R5, i 0, t R6, n, n, $R1, $R2, $R3) i.r6'
|
|
||||||
|
|
||||||
; write description of service
|
|
||||||
WriteRegStr HKLM "SYSTEM\ControlSet001\Services\$2" "Description" $R8
|
|
||||||
|
|
||||||
Pop $R8
|
|
||||||
Pop $R7
|
|
||||||
Pop $R6
|
|
||||||
Pop $R5
|
|
||||||
Pop $R4
|
|
||||||
Pop $R3
|
|
||||||
Pop $R2
|
|
||||||
Pop $R1
|
|
||||||
StrCmp $6 0 lbl_done lbl_good
|
|
||||||
|
|
||||||
; delete service
|
|
||||||
lbl_delete:
|
|
||||||
System::Call 'advapi32::DeleteService(i r5) i.r6'
|
|
||||||
StrCmp $6 0 lbl_done lbl_good
|
|
||||||
|
|
||||||
; start service
|
|
||||||
lbl_start:
|
|
||||||
System::Call 'advapi32::StartServiceA(i r5, i 0, i 0) i.r6'
|
|
||||||
StrCmp $6 0 lbl_done lbl_good
|
|
||||||
|
|
||||||
; stop service
|
|
||||||
lbl_stop:
|
|
||||||
Push $R1
|
|
||||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
|
||||||
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_STOP}, i $R1) i'
|
|
||||||
System::Free $R1
|
|
||||||
Pop $R1
|
|
||||||
StrCmp $6 0 lbl_done lbl_good
|
|
||||||
|
|
||||||
; pause service
|
|
||||||
lbl_pause:
|
|
||||||
Push $R1
|
|
||||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
|
||||||
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_PAUSE}, i $R1) i'
|
|
||||||
System::Free $R1
|
|
||||||
Pop $R1
|
|
||||||
StrCmp $6 0 lbl_done lbl_good
|
|
||||||
|
|
||||||
; continue service
|
|
||||||
lbl_continue:
|
|
||||||
Push $R1
|
|
||||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
|
||||||
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_CONTINUE}, i $R1) i'
|
|
||||||
System::Free $R1
|
|
||||||
Pop $R1
|
|
||||||
StrCmp $6 0 lbl_done lbl_good
|
|
||||||
|
|
||||||
; is installed
|
|
||||||
lbl_installed:
|
|
||||||
!insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
|
|
||||||
StrCpy $3 $7
|
|
||||||
Goto lbl_select
|
|
||||||
|
|
||||||
; is service running
|
|
||||||
lbl_running:
|
|
||||||
Push $R1
|
|
||||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
|
||||||
System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
|
|
||||||
System::Call '*$R1(i, i.r6)'
|
|
||||||
System::Free $R1
|
|
||||||
Pop $R1
|
|
||||||
IntFmt $6 "0x%X" $6
|
|
||||||
StrCmp $6 ${SERVICE_RUNNING} 0 lbl_done
|
|
||||||
!insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
|
|
||||||
StrCpy $3 $7
|
|
||||||
Goto lbl_select
|
|
||||||
|
|
||||||
lbl_status:
|
|
||||||
Push $R1
|
|
||||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
|
||||||
System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
|
|
||||||
System::Call '*$R1(i, i .r6)'
|
|
||||||
System::Free $R1
|
|
||||||
Pop $R1
|
|
||||||
IntFmt $6 "0x%X" $6
|
|
||||||
StrCpy $0 "running"
|
|
||||||
IntCmp $6 ${SERVICE_RUNNING} lbl_done
|
|
||||||
StrCpy $0 "stopped"
|
|
||||||
IntCmp $6 ${SERVICE_STOPPED} lbl_done
|
|
||||||
StrCpy $0 "start_pending"
|
|
||||||
IntCmp $6 ${SERVICE_START_PENDING} lbl_done
|
|
||||||
StrCpy $0 "stop_pending"
|
|
||||||
IntCmp $6 ${SERVICE_STOP_PENDING} lbl_done
|
|
||||||
StrCpy $0 "running"
|
|
||||||
IntCmp $6 ${SERVICE_RUNNING} lbl_done
|
|
||||||
StrCpy $0 "continue_pending"
|
|
||||||
IntCmp $6 ${SERVICE_CONTINUE_PENDING} lbl_done
|
|
||||||
StrCpy $0 "pause_pending"
|
|
||||||
IntCmp $6 ${SERVICE_PAUSE_PENDING} lbl_done
|
|
||||||
StrCpy $0 "paused"
|
|
||||||
IntCmp $6 ${SERVICE_PAUSED} lbl_done
|
|
||||||
StrCpy $0 "unknown"
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_good:
|
|
||||||
StrCpy $0 "true"
|
|
||||||
lbl_done:
|
|
||||||
IntCmp $5 0 +2
|
|
||||||
System::Call 'advapi32::CloseServiceHandle(i r5) n'
|
|
||||||
IntCmp $4 0 +2
|
|
||||||
System::Call 'advapi32::CloseServiceHandle(i r4) n'
|
|
||||||
Pop $4
|
|
||||||
Pop $3
|
|
||||||
Pop $2
|
|
||||||
Pop $1
|
|
||||||
Exch 3
|
|
||||||
Pop $5
|
|
||||||
Pop $7
|
|
||||||
Pop $6
|
|
||||||
Exch $0
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
Function Service
|
|
||||||
!insertmacro FUNC_SERVICE ""
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
Function un.Service
|
|
||||||
!insertmacro FUNC_SERVICE "un."
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
Function GetParam
|
|
||||||
!insertmacro FUNC_GETPARAM
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
Function un.GetParam
|
|
||||||
!insertmacro FUNC_GETPARAM
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
!endif
|
|
||||||
|
|
@ -47,9 +47,19 @@
|
||||||
#include "winrc/w_inst.h"
|
#include "winrc/w_inst.h"
|
||||||
|
|
||||||
/** Install service main */
|
/** Install service main */
|
||||||
int main(int ATTR_UNUSED(argc), char** ATTR_UNUSED(argv))
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
/*FILE* out = fopen("unbound-service-install.log", "w");*/
|
FILE* out = stdout;
|
||||||
wsvc_install(NULL, "unbound-service-install.exe");
|
/* out = fopen("unbound-service-install.log", "w");*/
|
||||||
|
if(argc == 2 && strcmp(argv[1], "start")==0) {
|
||||||
|
wsvc_rc_start(out);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(argc != 1) {
|
||||||
|
if(out) fprintf(out, "Usage: %s [start]\n", argv[0]);
|
||||||
|
else printf("Usage: %s [start]\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
wsvc_install(out, "unbound-service-install.exe");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* winrc/unbound-service-install.c - windows services installation util
|
* winrc/unbound-service-remove.c - windows services installation util
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009, NLnet Labs. All rights reserved.
|
* Copyright (c) 2009, NLnet Labs. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|
@ -46,10 +46,20 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "winrc/w_inst.h"
|
#include "winrc/w_inst.h"
|
||||||
|
|
||||||
/** Install service main */
|
/** Remove service main */
|
||||||
int main(int ATTR_UNUSED(argc), char** ATTR_UNUSED(argv))
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
/*FILE* out = fopen("unbound-service-remove.log", "w");*/
|
FILE* out = stdout;
|
||||||
|
/* out = fopen("unbound-service-remove.log", "w");*/
|
||||||
|
if(argc == 2 && strcmp(argv[1], "stop")==0) {
|
||||||
|
wsvc_rc_stop(out);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(argc != 1) {
|
||||||
|
if(out) fprintf(out, "Usage: %s [stop]\n", argv[0]);
|
||||||
|
else printf("Usage: %s [stop]\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
wsvc_remove(NULL);
|
wsvc_remove(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,28 @@
|
||||||
#include "winrc/w_inst.h"
|
#include "winrc/w_inst.h"
|
||||||
#include "winrc/win_svc.h"
|
#include "winrc/win_svc.h"
|
||||||
|
|
||||||
|
void wsvc_err2str(char* str, size_t len, const char* fixed, DWORD err)
|
||||||
|
{
|
||||||
|
LPTSTR buf;
|
||||||
|
if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
|
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
||||||
|
NULL, err, 0, (LPTSTR)&buf, 0, NULL) == 0) {
|
||||||
|
/* could not format error message */
|
||||||
|
snprintf(str, len, "%s GetLastError=%d", fixed, (int)err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
snprintf(str, len, "%s (err=%d): %s", fixed, (int)err, buf);
|
||||||
|
LocalFree(buf);
|
||||||
|
}
|
||||||
|
|
||||||
/** exit with windows error */
|
/** exit with windows error */
|
||||||
static void
|
static void
|
||||||
fatal_win(FILE* out, const char* str)
|
fatal_win(FILE* out, const char* str)
|
||||||
{
|
{
|
||||||
if(out) fprintf(out, "%s (%d)\n", str, (int)GetLastError());
|
char e[256];
|
||||||
|
wsvc_err2str(e, sizeof(e), str, (int)GetLastError());
|
||||||
|
if(out) fprintf(out, "%s\n", e);
|
||||||
|
else fprintf(stderr, "%s\n", e);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,6 +230,7 @@ wsvc_install(FILE* out, const char* rename)
|
||||||
if(out) fprintf(out, "unbound service installed\n");
|
if(out) fprintf(out, "unbound service installed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Remove installed service from servicecontrolmanager */
|
/* Remove installed service from servicecontrolmanager */
|
||||||
void
|
void
|
||||||
wsvc_remove(FILE* out)
|
wsvc_remove(FILE* out)
|
||||||
|
|
@ -228,6 +246,8 @@ wsvc_remove(FILE* out)
|
||||||
fatal_win(out, "could not OpenService");
|
fatal_win(out, "could not OpenService");
|
||||||
}
|
}
|
||||||
if(!DeleteService(sv)) {
|
if(!DeleteService(sv)) {
|
||||||
|
CloseServiceHandle(sv);
|
||||||
|
CloseServiceHandle(scm);
|
||||||
fatal_win(out, "could not DeleteService");
|
fatal_win(out, "could not DeleteService");
|
||||||
}
|
}
|
||||||
CloseServiceHandle(sv);
|
CloseServiceHandle(sv);
|
||||||
|
|
@ -235,3 +255,54 @@ wsvc_remove(FILE* out)
|
||||||
event_reg_remove(out);
|
event_reg_remove(out);
|
||||||
if(out) fprintf(out, "unbound service removed\n");
|
if(out) fprintf(out, "unbound service removed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Start daemon */
|
||||||
|
void
|
||||||
|
wsvc_rc_start(FILE* out)
|
||||||
|
{
|
||||||
|
SC_HANDLE scm;
|
||||||
|
SC_HANDLE sv;
|
||||||
|
if(out) fprintf(out, "start unbound service\n");
|
||||||
|
scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||||
|
if(!scm) fatal_win(out, "could not OpenSCManager");
|
||||||
|
sv = OpenService(scm, SERVICE_NAME, SERVICE_START);
|
||||||
|
if(!sv) {
|
||||||
|
CloseServiceHandle(scm);
|
||||||
|
fatal_win(out, "could not OpenService");
|
||||||
|
}
|
||||||
|
if(!StartService(sv, 0, NULL)) {
|
||||||
|
CloseServiceHandle(sv);
|
||||||
|
CloseServiceHandle(scm);
|
||||||
|
fatal_win(out, "could not StartService");
|
||||||
|
}
|
||||||
|
CloseServiceHandle(sv);
|
||||||
|
CloseServiceHandle(scm);
|
||||||
|
if(out) fprintf(out, "unbound service started\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Stop daemon */
|
||||||
|
void
|
||||||
|
wsvc_rc_stop(FILE* out)
|
||||||
|
{
|
||||||
|
SC_HANDLE scm;
|
||||||
|
SC_HANDLE sv;
|
||||||
|
SERVICE_STATUS st;
|
||||||
|
if(out) fprintf(out, "stop unbound service\n");
|
||||||
|
scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||||
|
if(!scm) fatal_win(out, "could not OpenSCManager");
|
||||||
|
sv = OpenService(scm, SERVICE_NAME, SERVICE_STOP);
|
||||||
|
if(!sv) {
|
||||||
|
CloseServiceHandle(scm);
|
||||||
|
fatal_win(out, "could not OpenService");
|
||||||
|
}
|
||||||
|
if(!ControlService(sv, SERVICE_CONTROL_STOP, &st)) {
|
||||||
|
CloseServiceHandle(sv);
|
||||||
|
CloseServiceHandle(scm);
|
||||||
|
fatal_win(out, "could not ControlService");
|
||||||
|
}
|
||||||
|
CloseServiceHandle(sv);
|
||||||
|
CloseServiceHandle(scm);
|
||||||
|
if(out) fprintf(out, "unbound service stopped\n");
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,4 +56,25 @@ void wsvc_install(FILE* out, const char* rename);
|
||||||
*/
|
*/
|
||||||
void wsvc_remove(FILE* out);
|
void wsvc_remove(FILE* out);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the service from servicecontrolmanager, tells OS to start daemon.
|
||||||
|
* @param out: debug output printed here (errors). or NULL.
|
||||||
|
*/
|
||||||
|
void wsvc_rc_start(FILE* out);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop the service from servicecontrolmanager, tells OS to stop daemon.
|
||||||
|
* @param out: debug output printed here (errors). or NULL.
|
||||||
|
*/
|
||||||
|
void wsvc_rc_stop(FILE* out);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert windows GetLastError() value to a neat string.
|
||||||
|
* @param str: destination buffer
|
||||||
|
* @param len: length of dest buffer
|
||||||
|
* @param fixed: fixed text to prepend to string.
|
||||||
|
* @param err: the GetLastError() value.
|
||||||
|
*/
|
||||||
|
void wsvc_err2str(char* str, size_t len, const char* fixed, DWORD err);
|
||||||
|
|
||||||
#endif /* WINRC_W_INST_H */
|
#endif /* WINRC_W_INST_H */
|
||||||
|
|
|
||||||
|
|
@ -127,11 +127,12 @@ static void
|
||||||
reportev(const char* str)
|
reportev(const char* str)
|
||||||
{
|
{
|
||||||
char b[256];
|
char b[256];
|
||||||
|
char e[256];
|
||||||
HANDLE* s;
|
HANDLE* s;
|
||||||
LPCTSTR msg = b;
|
LPCTSTR msg = b;
|
||||||
/* print quickly to keep GetLastError value */
|
/* print quickly to keep GetLastError value */
|
||||||
snprintf(b, sizeof(b), "%s: %s (%d)", SERVICE_NAME,
|
wsvc_err2str(e, sizeof(e), str, GetLastError());
|
||||||
str, (int)GetLastError());
|
snprintf(b, sizeof(b), "%s: %s", SERVICE_NAME, e);
|
||||||
s = RegisterEventSource(NULL, SERVICE_NAME);
|
s = RegisterEventSource(NULL, SERVICE_NAME);
|
||||||
if(!s) return;
|
if(!s) return;
|
||||||
ReportEvent(s, /* event log */
|
ReportEvent(s, /* event log */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue