Updated varnish patches for cygwin 1.7.8
Tollef Fog Heen
tfheen at varnish-software.com
Tue Mar 8 11:07:37 CET 2011
]] jdzstz - gmail dot com
Hi,
| I have updated my varnish patches for new cygwin versión 1.7.8
Thanks,
| * Version 2.1.5:
| http://www.varnish-cache.org/trac/attachment/wiki/VarnishOnCygwinWindows/varnish-2.1.5-cygwin.patch
While you're of course free to keep this around, I'm not going to merge
any cygwin support to the 2.1 branch.
| * Trunk: http://www.varnish-cache.org/trac/attachment/wiki/VarnishOnCygwinWindows/varnish-githead-cygwin.patch
In general, I'm a bit unhappy with most of this patch as it leaks too
much cygwin stuff across the build system. I'll comment some issues
inline.
| diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
| index b8db6e0..f920b42 100644
| --- a/bin/varnishd/Makefile.am
| +++ b/bin/varnishd/Makefile.am
| +
| +EXTRA_SCRIPTS =
| +
| +sbin_SCRIPTS = ${CYGWIN_libvarnishd_OBJECTS}
| +
| +
| DISTCLEANFILES = default_vcl.h
Why the extra EXTRA_SCRIPTS? I'd also like to not have to care about
gcc on cygwin having problems linking a DLL with unresolved symbols in it.
| #
| diff --git a/configure.ac b/configure.ac
| index f574764..9f7753e 100644
| --- a/configure.ac
| +++ b/configure.ac
This bit has been merged.
| @@ -457,6 +488,19 @@ else
| *-*-darwin*)
| VCC_CC="exec cc $OCFLAGS -dynamiclib -Wl,-undefined,dynamic_lookup -o %o %s"
| ;;
| + *-*-cygwin*)
| + #calculate ${exec_prefix}/lib, because it is asigned later, and we need now
| + prefix_aux=`eval echo ${prefix}`
| + test "x$prefix_aux" = xNONE && prefix_aux=`eval echo ${ac_default_prefix}`
| + # Let make expand exec_prefix.
| + exec_prefix_aux=`eval echo ${exec_prefix}`
| + test "x$exec_prefix_aux" = xNONE && exec_prefix_aux=`eval echo ${prefix_aux}`
| + # Remove "/" if we are in Root
| + test "x$exec_prefix_aux" = "x/" && exec_prefix_aux=""
| + #calculate compilation path
| + comp_prefix=`pwd`
| + VCC_CC="$PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -shared %s -L${comp_prefix}/lib/libvarnish/.libs -L${comp_prefix}/bin/varnishd -L${exec_prefix_aux}/lib -L${exec_prefix_aux}/sbin -L${exec_prefix_aux}/bin -lvarnish -lvarnishd -o %o"
| + ;;
Adding those -L bits here looks a bit odd. Doesn't libtool just add the
necessary rpath if that's needed?
| +# Add library dependencies with libvarnish (linker needs it in CYGWIN during compilation time)
| +# Generate fake library libvarnishd.dll.a in order to successful linking DLL when resolving varnishd.exe simbols
| +case $target in
| +*-*-cygwin*)
| + CYGWIN_varnishd_LDFLAGS=' -Wl,-out-implib,libvarnishd.dll.a'
| + CYGWIN_libvarnishd_OBJECTS='libvarnishd.dll.a'
| + CYGWIN_libvmod_std_la_LIBADD='$(top_builddir)/lib/libvarnish/libvarnish.la -lvarnishd -L$(top_builddir)/bin/varnishd'
| + AC_SUBST(CYGWIN_varnishd_LDFLAGS)
| + AC_SUBST(CYGWIN_libvarnishd_OBJECTS)
| + AC_SUBST(CYGWIN_libvmod_std_la_LIBADD)
| + cygwin=true
| + ;;
| +*)
| + cygwin=false
| + ;;
| +esac
| +
| +AM_CONDITIONAL([CYGWIN_COMPILATION], test x$cygwin = xtrue)
Can we get rid of that fake library? Also, doesn't cygwin support
inter-library dependencies properly?
| --- a/lib/libvarnishapi/Makefile.am
| +++ b/lib/libvarnishapi/Makefile.am
| @@ -26,4 +26,6 @@ libvarnishapi_la_SOURCES = \
| libvarnishapi_la_CFLAGS = \
| -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"'
|
| -libvarnishapi_la_LIBADD = @PCRE_LIBS@
| +libvarnishapi_la_LIBADD = \
| + $(top_builddir)/lib/libvarnish/libvarnish.la \
| + @PCRE_LIBS@
Why is this?
| diff --git a/lib/libvcl/Makefile.am b/lib/libvcl/Makefile.am
| index aab8749..4645bba 100644
| --- a/lib/libvcl/Makefile.am
| +++ b/lib/libvcl/Makefile.am
| @@ -33,6 +33,8 @@ libvcl_la_SOURCES = \
| vcc_vmod.c \
| vcc_xref.c
|
| +libvcl_la_LIBADD = $(top_builddir)/lib/libvarnish/libvarnish.la
| +
| EXTRA_DIST = \
| generate.py
What does this solve for you?
| diff --git a/lib/libvmod_std/Makefile.am b/lib/libvmod_std/Makefile.am
| index 36147fe..41c32c8 100644
| --- a/lib/libvmod_std/Makefile.am
| +++ b/lib/libvmod_std/Makefile.am
| @@ -13,9 +13,16 @@ libvmod_std_la_SOURCES = \
| vmod_std.c \
| vmod_std_fileread.c
|
| +libvmod_std_la_LIBADD = ${CYGWIN_libvmod_std_la_LIBADD}
| +
| vcc_if.c vcc_if.h: $(top_srcdir)/lib/libvmod_std/vmod.py $(top_srcdir)/lib/libvmod_std/vmod.vcc
| @PYTHON@ $(top_srcdir)/lib/libvmod_std/vmod.py $(top_srcdir)/lib/libvmod_std/vmod.vcc
|
| EXTRA_DIST = vmod.py vmod.vcc
|
| CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h
| +
| +if CYGWIN_COMPILATION
| +install-exec-hook:
| + $(LN_S) -f cygvmod_std-1.dll .libs/libvmod_std.so.1
| +endif
What? You shouldn't symlink stuff into .libs directories.
--
Tollef Fog Heen
Varnish Software
t: +47 21 98 92 64
More information about the varnish-dev
mailing list