Hey list,

I spent the last half a day or so learning the autoconf/automake toolset and going through the build system of pulseaudio to get it to compile under cygwin rather then native. (I wanted module-x11-publish with Cygwin/X).

The patch is against the 0.9.5 tree rather then SVN as I didn't know if I would get it done when I started, but I figured I'll share it anyway to see if it gets any use.

The pulseaudio patch moves the win32api header detection up into the determine build environment section, this can be relocated back down to the other part but the cygwin test needs to stay for this to work. (The alternative is to go through every source file and modify where the winsock.h header file gets included from, it needs to go before the cygwin includes so that the cygwin headers can ifdef around the already defined functions from win32api. This was beyond the scope of what I wanted to do, which was to just get it compiled and running.) I also added the --disable-cygwin option for building which should revert the behavior under the cygwin compiler back to the mingw settings.

I had to add in another conditional for automake, OS_IS_CYGWIN. Mostly setting OS_IS_WIN32 under Cygwin compiles the right things, however it was breaking the PG_DEFAULT_CONFIG_DIR, but mostly everything else was fine. I added the other conditional at first to fix this, but then I noticed that if I did it, I could clean up some of the other things in the automake file as well. (Rather specific Win32 compiler options that Cygwin doesn't really use) These fixes can look rather nasty but automake only supports checking one variable at a time in a conditional branch as far as I can tell from the manual.

I also made a fix which may or may not have already been fixed in SVN with the module_x11_publish_la_LIBADD line where it was missing the include of libpulsecore.la, that's about the only thing in the pulseaudio patch that I can see that might already be done (unless I've gone and reinvented the wheel (again) and cygwin build support was already added).

I also sent a patch off to the liboil list to fix a small compile bug with it which I'll attach here too.

Short list of steps for compiling it under Cygwin:

Download and install the IPv6 extension to Cygwin from http://win6.jp/Cygwin/index.html export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig (I've got this one in my /etc/bash.bashrc) Download libsndfile from http://www.mega-nerd.com/libsndfile/, if you have all the Cygwin devel prereq packages it should just be a ./configure && make && make install for this one Download libsamplerate from http://www.mega-nerd.com/SRC/, this one needs to be configured like: LDFLAGS='-no-undefined' ./configure && make && make install Download liboil from http://liboil.freedesktop.org/, apply the liboiltmp stub patch (patch -p1 -i liboil-0.3.10-liboiltmp-stub-cygwin-fix.patch from in the liboil folder), then ./configure && make && make install Download pulseaudio from http://pulseaudio.org/, apply the pulseaudio-0.9.5-cygwin-fix.patch (patch -p1 -i pulseaudio-0.9.5-cygwin-fix.patch from in the pulseaudio folder), ./configure && make && make install

--- pulseaudio-0.9.5-orig/configure.ac  2006-08-27 05:22:17.000000000 +1000
+++ pulseaudio-0.9.5/configure.ac       2006-12-18 01:55:25.378750000 +1000
@@ -122,15 +122,35 @@
 #### Determine build environment ####
 
 os_is_win32=0
+cygwin=0
 
 case "$host_os" in
        mingw*)
         AC_DEFINE([OS_IS_WIN32], 1, [Build target is Windows.])
         os_is_win32=1
                ;;
+       cygwin*)
+             # Build for cygwin environment
+             # Note this also allows HAVE_X11 and disables HAVE_OSS
+                               # since we have Cygwin/X and WaveOut under 
Cygwin
+             AC_ARG_ENABLE([cygwin], AC_HELP_STRING([--disable-cygwin], [Allow 
win32api under Cygwin]),
+               [
+                 case "${enableval}" in
+                   yes) cygwin=1 ;;
+                   no) cygwin=0 ;;
+                   *) AC_MSG_ERROR(bad value ${enableval} for 
--disable-cygwin) ;;
+                 esac
+               ],
+               [cygwin=1])
+             os_is_win32=1
        esac
 
+if test "x${cygwin}" != "x1" ; then
+       AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h])
+fi
+
 AM_CONDITIONAL(OS_IS_WIN32, test "x$os_is_win32" = "x1")
+AM_CONDITIONAL(OS_IS_CYGWIN, test "x$cygwin" = "x1")
 
 ###################################
 #   Basic environment checks      #
@@ -165,9 +185,6 @@
 # Solaris
 AC_CHECK_HEADERS([sys/filio.h])
 
-# Windows
-AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h])
-
 # Other
 AC_CHECK_HEADERS([sys/ioctl.h])
 
@@ -266,7 +283,7 @@
 HAVE_X11=0
 
 # The macro tests the host, not the build target
-if test "x$os_is_win32" != "x1" ; then
+if test "x$os_is_win32" != "x1" -o "x$cygwin" == "x1" ; then
     AC_PATH_XTRA
     test "x$no_x" != "xyes" && HAVE_X11=1
 fi
@@ -333,7 +350,7 @@
         ],
         [oss=auto])
 
-if test "x${oss}" != xno ; then
+if test "x${oss}" != xno -a "x${cygwin}" != "x1" ; then
     AC_CHECK_HEADERS([sys/soundcard.h],
         [
             HAVE_OSS=1
--- pulseaudio-0.9.5-orig/src/Makefile.am       2006-08-19 05:56:48.000000000 
+1000
+++ pulseaudio-0.9.5/src/Makefile.am    2006-12-18 02:22:13.327500000 +1000
@@ -33,7 +33,11 @@
 
 PA_BINARY=$(bindir)/pulseaudio$(EXEEXT)
 if OS_IS_WIN32
+if OS_IS_CYGWIN
+PA_DEFAULT_CONFIG_DIR=$(pulseconfdir)
+else
 PA_DEFAULT_CONFIG_DIR=%PULSE_ROOT%
+endif
 else
 PA_DEFAULT_CONFIG_DIR=$(pulseconfdir)
 endif
@@ -66,8 +70,10 @@
 
 if OS_IS_WIN32
 AM_LDFLAGS+=-Wl,--export-all-symbols
+if !OS_IS_CYGWIN
 WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet
 endif
+endif
 
 ###################################
 #          Extra files            #
@@ -424,9 +430,11 @@
                pulsecore/shm.c pulsecore/shm.h
 
 if OS_IS_WIN32
+if !OS_IS_CYGWIN
 libpulse_la_SOURCES += \
                pulsecore/dllmain.c 
 endif
+endif
 
 if HAVE_X11
 libpulse_la_SOURCES += \
@@ -598,9 +606,11 @@
                pulsecore/shm.c pulsecore/shm.h
 
 if OS_IS_WIN32
+if !OS_IS_CYGWIN
 libpulsecore_la_SOURCES += \
                pulsecore/dllmain.c 
 endif
+endif
 
 libpulsecore_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBOIL_CFLAGS)
 libpulsecore_la_LDFLAGS = -version-info $(LIBPULSECORE_VERSION_INFO)
@@ -1105,7 +1115,7 @@
 module_x11_publish_la_SOURCES = modules/module-x11-publish.c
 module_x11_publish_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS)
 module_x11_publish_la_LDFLAGS = -module -avoid-version
-module_x11_publish_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) 
$(X_EXTRA_LIBS) libx11wrap.la libauthkey.la libauthkey-prop.la libx11prop.la 
libstrlist.la
+module_x11_publish_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) 
$(X_EXTRA_LIBS) libx11wrap.la libauthkey.la libauthkey-prop.la libx11prop.la 
libstrlist.la libpulsecore.la
 
 # OSS
 
--- liboil-0.3.10/liboil/liboiltmp.c    2006-01-21 11:36:47.000000000 +1000
+++ liboil/liboil/liboiltmp.c   2006-12-18 00:46:14.558125000 +1000
@@ -6,4 +6,7 @@
 void oil_random_argb(void) {}
 void oil_test_get_source_data(void) {}
 void oil_test_get_value(void) {}
+void oil_test_get_arg_pre_n(void) {}
+void oil_test_get_arg_post_n(void) {}
+void oil_test_get_arg_stride(void) {}
 
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to