initial working win32 port



   Hi!

In the last days I've spent some time on trying to get the cygwin win32
port I started long ago more mature. And there is some success: the
beast port compiles, runs and even plays audio. This means:

What works:
  * the complete gui
  * audio output (somewhat: see below)
  * plugins
  * loading and playing the demosong
  * scripts (although quite slow and with errors on problems with our
    the sfi builtin gc)

What still needs to be done:
  * realtime ability (because thread priorization must be done different
    under windows)
  * stability (there must be some bugs left, because beast is crashing a
    lot - which it doesn't under linux)
  * better support for native audio (currently it uses cygwins
	/dev/dsp emulation)
  * midi input/output
  * browser integration
  * magic-1-click-installer

Attached are
  * diffs between the 0.6.6 release and my port
  * a new file (bse/bsevar.h): the contents could maybe be merged into
   some of the other bse headers, but I didn't know which

Some remarks:
  configure.in:
	should use pkg-config for finding -lvorbisenc (ogg/vorbis is in
	/usr/local on my installation)
	
	the other two changes are probably not important

  beast-gtk/Makefile.am, shell/Makefile.am:
    the magic version-specific build rule doesn't work, so for now I put
	the versions into the rules

  sfi/Makefile.am bse/Makefile.am:
    to make the symbols from the dlls available, I use libtools
	export-by-regex feature

    besides, I made some changes to get BSE_VAR and SFI_VAR work

  plugins/Makefile.am:
    -no-undefined is required for building DLLs, and --export-regex is
	necessary for exporting the symbol

  bse/bsevar.h, BSE_VAR, SFI_VAR and others:
    windows DLLs need to declare which variables are part of the API
	(I took the definition from glib, more or less)

    in fact, this is probably the largest change to the code base

How to build beast for windows yourself (currently only useful if you
want to hack on the port):
  * install cygwin (http://cygwin.com/), including gcc, g++, xserver,
    gtk libraries and so on
  * get libraries beast needs, but unavailable from cygwin:
    http://space.twc.de/~stefan/download/beast-win32-support-libs-20050928.tar.bz2 
  * compile these "support libraries", and install them (to /usr/local)
  * export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
  * get beast-0.6.6 from beast.gtk.org
  * apply attached patch to beast
  * put attached bsevar.h file in the bse directory
  * compile and install beast

Running it, once installed:
  * in a cygwin shell, type 
    xinit beast -- -multiwindow

Any comments welcome.

   Cu... Stefan
-- 
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan
Index: configure.in
===================================================================
RCS file: /cvs/gnome/beast/configure.in,v
retrieving revision 1.162
diff -u -r1.162 configure.in
--- configure.in	25 May 2005 19:54:45 -0000	1.162
+++ configure.in	28 Sep 2005 17:46:15 -0000
@@ -80,7 +80,7 @@
 AM_MAINTAINER_MODE
 
 # architecture information
-AC_CANONICAL_TARGET
+# AC_CANONICAL_TARGET
 AC_DEFINE_UNQUOTED(BST_ARCH_NAME, "$target", [Architecture Description])
 
 # declare --enable-* args and collect ac_help strings
@@ -179,18 +179,19 @@
 
     dnl --- Ogg/Vorbis check ---
     OV_LIBS=
-    ov_tests=0
-    AC_CHECK_LIB(vorbisfile, ogg_stream_reset_serialno,
-	[AC_CHECK_HEADER(ogg/ogg.h, ov_tests=`expr $ov_tests + 1`)]
-	[AC_CHECK_HEADER(vorbis/vorbisfile.h, ov_tests=`expr $ov_tests + 1`)]
-	[AC_CHECK_HEADER(vorbis/vorbisenc.h, ov_tests=`expr $ov_tests + 1`)]
-	,
-	ov_tests=0, -lvorbisenc -lvorbis -logg)
-    if test $ov_tests = 3 ; then
-	OV_LIBS="-lvorbisfile -lvorbisenc -lvorbis -logg"
-    else
-	AC_MSG_WARN([failed to detect Ogg/Vorbis library (>=1.0) or headers])
-    fi
+dnl    ov_tests=0
+dnl    AC_CHECK_LIB(vorbisfile, ogg_stream_reset_serialno,
+dnl	[AC_CHECK_HEADER(ogg/ogg.h, ov_tests=`expr $ov_tests + 1`)]
+dnl	[AC_CHECK_HEADER(vorbis/vorbisfile.h, ov_tests=`expr $ov_tests + 1`)]
+dnl	[AC_CHECK_HEADER(vorbis/vorbisenc.h, ov_tests=`expr $ov_tests + 1`)]
+dnl	,
+dnl	ov_tests=0, -lvorbisenc -lvorbis -logg)
+dnl    if test $ov_tests = 3 ; then
+	OV_LIBS="-L/usr/local/lib -lvorbisfile -lvorbisenc -lvorbis -logg"
+dnl	OV_LIBS="-lvorbisfile -lvorbisenc -lvorbis -logg"
+dnl    else
+dnl	AC_MSG_WARN([failed to detect Ogg/Vorbis library (>=1.0) or headers])
+dnl    fi
     
     dnl --- libmad MPEG decoder check ---
     dnl libmad doesn't come with a mad.pc file (just its debian package)
@@ -504,7 +505,8 @@
 
 # initialize libtool, we need dynamic module support
 AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
+LT_INIT
+AC_PROG_LIBTOOL
 
 # Check for package requirements.
 MC_IF_VAR_EQ(GCC, yes,,
Index: beast-gtk/Makefile.am
===================================================================
RCS file: /cvs/gnome/beast/beast-gtk/Makefile.am,v
retrieving revision 1.124
diff -u -r1.124 Makefile.am
--- beast-gtk/Makefile.am	20 May 2005 12:17:06 -0000	1.124
+++ beast-gtk/Makefile.am	28 Sep 2005 17:46:15 -0000
@@ -189,11 +189,16 @@
 #
 # setup BEAST sources and their dependancies
 #
-bin_PROGRAMS = @BEAST_BINARY@			# this expands to beast-$BIN_VERSION
-EXTRA_PROGRAMS = beast-\$(BIN_VERSION)		# make automake-1.4 eat beast____BIN_VERSION_ variables
-beast____BIN_VERSION__SOURCES = bstmain.c $(beast_sources)
-beast____BIN_VERSION__LDADD = $(progs_LDADD)
-beast_objects = $(beast____BIN_VERSION__OBJECTS)
+# bin_PROGRAMS = @BEAST_BINARY@			# this expands to beast-$BIN_VERSION
+# EXTRA_PROGRAMS = beast-\$(BIN_VERSION)		# make automake-1.4 eat beast____BIN_VERSION_ variables
+# beast____BIN_VERSION__SOURCES = bstmain.c $(beast_sources)
+# beast____BIN_VERSION__LDADD = $(progs_LDADD)
+# beast_objects = $(beast____BIN_VERSION__OBJECTS)
+
+bin_PROGRAMS = beast-0.6.6
+beast_0_6_6_SOURCES = bstmain.c $(beast_sources)
+beast_0_6_6_LDADD = $(progs_LDADD)
+
 noinst_PROGRAMS = tsmview testgui # bststest
 tsmview_SOURCES = tsmview.c cxxdummy.cc
 tsmview_LDADD = $(progs_LDADD)
Index: beast-gtk/gxk/gxkspline.c
===================================================================
RCS file: /cvs/gnome/beast/beast-gtk/gxk/gxkspline.c,v
retrieving revision 1.4
diff -u -r1.4 gxkspline.c
--- beast-gtk/gxk/gxkspline.c	16 Aug 2004 09:00:06 -0000	1.4
+++ beast-gtk/gxk/gxkspline.c	28 Sep 2005 17:46:53 -0000
@@ -23,6 +23,9 @@
 #include <math.h>
 
 #define SQRT_3       (1.7320508075688772935274463415059)
+#ifndef NAN
+static const double NAN = (0.0 / 0.0);
+#endif
 static const double INF = 1e+999;
 
 
Index: beast-gtk/gxk/splinetest.c
===================================================================
RCS file: /cvs/gnome/beast/beast-gtk/gxk/splinetest.c,v
retrieving revision 1.4
diff -u -r1.4 splinetest.c
--- beast-gtk/gxk/splinetest.c	8 Sep 2004 07:07:11 -0000	1.4
+++ beast-gtk/gxk/splinetest.c	28 Sep 2005 17:46:56 -0000
@@ -20,6 +20,10 @@
 #include "gxk/gxkspline.h"
 #include <stdlib.h>
 
+#ifndef NAN
+static const double NAN = (0.0 / 0.0);
+#endif
+
 static void
 spline_test (GxkSpline *spline,
              guint      interval_steps,
Index: bse/Makefile.am
===================================================================
RCS file: /cvs/gnome/beast/bse/Makefile.am,v
retrieving revision 1.122
diff -u -r1.122 Makefile.am
--- bse/Makefile.am	19 Apr 2005 14:31:23 -0000	1.122
+++ bse/Makefile.am	28 Sep 2005 17:47:01 -0000
@@ -21,7 +21,7 @@
 # the source file sets ;(
 DEFS += $(strip \
 	$(patsubst %, -DG_LOG_DOMAIN=\"BSE\" -DBSE_COMPILATION, \
-	              $(filter $(<F), $(bse_c_sources) $(bse_cc_sources))) \
+	              $(filter $(<F), $(bse_c_sources) $(bse_cc_sources) $(bse_proc_gen_sources))) \
 )
 
 # libtool stuff: set version and export symbols for resolving
@@ -29,8 +29,11 @@
 libbse_la_LDFLAGS = $(strip \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
 	-release $(LT_RELEASE) \
-	-export-dynamic -no-undefined \
+	-export-dynamic \
+	-export-symbols-regex '.*' \
+	-no-undefined \
 )
+#	-export-symbols bse.def
 libbse_la_LIBADD = $(top_builddir)/sfi/libsfi.la $(BSE_LIBS) -lm
 
 
@@ -60,7 +63,7 @@
 	bseutils.h		bsemidivoice.h		bsewave.h			bsewaveosc.h \
 	bsecsynth.h		bsewaverepo.h		bseladspamodule.h		bsepcmwriter.h \
 	bsecompat.h		bseundostack.h		bsemidiinput.h			bsemididecoder.h \
-	bsenote.h		bsemidifile.h		\
+	bsenote.h		bsemidifile.h		bsevar.h	\
 	bsecxxvalue.hh		bsecxxutils.hh		bsecxxbase.hh			bsecxxclosure.hh \
 	bsecxxarg.hh		bsecxxmodule.hh		bsecxxplugin.hh			bseloader.h \
 )
@@ -245,8 +248,8 @@
 	    --eprod "extern GType BSE_TYPE_ID (@EnumName@);" \
 	      $(bse_public_h_sources) \
 	  && $(PERL) mktypes.pl --externs $(bse_c_sources) \
-	) > xgen-sbgth \
-	&& $(SFIDL) $(SFIDL_INC) --core-c --header $(srcdir)/bsecore.idl >> xgen-sbgth \
+	) | sed 's/extern GType/BSE_VAR GType/g' > xgen-sbgth \
+	&& $(SFIDL) $(SFIDL_INC) --core-c --header $(srcdir)/bsecore.idl | sed 's/extern GType/BSE_VAR GType/g' >> xgen-sbgth \
 	&& (cmp -s xgen-sbgth $(srcdir)/bsegentypes.h || cp xgen-sbgth $(srcdir)/bsegentypes.h) \
 	&& rm -f xgen-sbgth \
 	&& echo timestamp > $(@F)
Index: bse/bse.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bse.h,v
retrieving revision 1.24
diff -u -r1.24 bse.h
--- bse/bse.h	30 Dec 2002 00:08:33 -0000	1.24
+++ bse/bse.h	28 Sep 2005 17:47:01 -0000
@@ -19,6 +19,7 @@
 #define __BSE_H__
 
 #include <sfi/sfi.h>
+#include <bse/bsevar.h>
 #include <bse/bseconfig.h>
 
 G_BEGIN_DECLS
@@ -31,12 +32,12 @@
 SfiGlueContext*	bse_init_glue_context	(const gchar	*client);
 
 /* library versioning */
-extern const guint   bse_major_version;
-extern const guint   bse_minor_version;
-extern const guint   bse_micro_version;
-extern const guint   bse_interface_age;
-extern const guint   bse_binary_age;
-extern const gchar  *bse_version;
+BSE_CONST_VAR guint   bse_major_version;
+BSE_CONST_VAR guint   bse_minor_version;
+BSE_CONST_VAR guint   bse_micro_version;
+BSE_CONST_VAR guint   bse_interface_age;
+BSE_CONST_VAR guint   bse_binary_age;
+BSE_CONST_VAR gchar  *bse_version;
 gchar*               bse_check_version	(guint           required_major,
 					 guint           required_minor,
 					 guint           required_micro);
Index: bse/bsecxxmodule.hh
===================================================================
RCS file: /cvs/gnome/beast/bse/bsecxxmodule.hh,v
retrieving revision 1.18
diff -u -r1.18 bsecxxmodule.hh
--- bse/bsecxxmodule.hh	7 Mar 2005 06:56:24 -0000	1.18
+++ bse/bsecxxmodule.hh	28 Sep 2005 17:47:06 -0000
@@ -206,8 +206,8 @@
 
 /* --- implementation details --- */
 namespace externC { extern "C" {
-extern guint bse_engine_exvar_sample_freq;
-extern guint bse_engine_exvar_block_size;
+BSE_VAR guint bse_engine_exvar_sample_freq;
+BSE_VAR guint bse_engine_exvar_block_size;
 extern guint64 bse_module_tick_stamp (BseModule*);
 } }
 inline BseModule*
Index: bse/bseengine.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bseengine.h,v
retrieving revision 1.36
diff -u -r1.36 bseengine.h
--- bse/bseengine.h	11 Dec 2004 14:39:38 -0000	1.36
+++ bse/bseengine.h	28 Sep 2005 17:47:08 -0000
@@ -19,6 +19,7 @@
 #define __BSE_ENGINE_H__
 
 #include <bse/bsedefs.h>
+#include <bse/bsevar.h>
 
 G_BEGIN_DECLS
 
@@ -237,9 +238,9 @@
 
 
 /*< private >*/
-extern guint    bse_engine_exvar_block_size;
-extern guint    bse_engine_exvar_sample_freq;
-extern guint    bse_engine_exvar_control_mask;
+BSE_VAR guint    bse_engine_exvar_block_size;
+BSE_VAR guint    bse_engine_exvar_sample_freq;
+BSE_VAR guint    bse_engine_exvar_control_mask;
 
 G_END_DECLS
 
Index: bse/bseglobals.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bseglobals.h,v
retrieving revision 1.34
diff -u -r1.34 bseglobals.h
--- bse/bseglobals.h	18 Dec 2004 23:25:29 -0000	1.34
+++ bse/bseglobals.h	28 Sep 2005 17:47:11 -0000
@@ -22,6 +22,7 @@
 #include <bse/bsemath.h>
 #include <bse/bsenote.h>
 #include <bse/bseconstvalues.h>
+#include <bse/bsevar.h>
 
 G_BEGIN_DECLS
 
@@ -75,13 +76,13 @@
  * (SFI_KAMMER_NOTE + 12) -> 2.0
  * etc...
  */
-extern const gdouble* _bse_semitone_factor_table;
+BSE_CONST_VAR gdouble* _bse_semitone_factor_table;
 #define	BSE_SEMITONE_FACTOR(ht)		((ht) > SFI_MAX_NOTE ? \
 				         _bse_semitone_factor_table[SFI_MAX_NOTE] : \
 				         (ht) < SFI_MIN_NOTE ? \
 				         _bse_semitone_factor_table[SFI_MIN_NOTE] : \
 				         _bse_semitone_factor_table[(ht)])
-extern const gdouble* _bse_fine_tune_factor_table;
+BSE_CONST_VAR gdouble* _bse_fine_tune_factor_table;
 #define	BSE_FINE_TUNE_FACTOR(ft)	((ft) > BSE_MAX_FINE_TUNE ? \
                                          _bse_fine_tune_factor_table[BSE_MAX_FINE_TUNE] : \
                                          (ft) < BSE_MIN_FINE_TUNE ? \
Index: bse/bsemain.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bsemain.h,v
retrieving revision 1.21
diff -u -r1.21 bsemain.h
--- bse/bsemain.h	21 May 2005 00:51:30 -0000	1.21
+++ bse/bsemain.h	28 Sep 2005 17:47:24 -0000
@@ -69,11 +69,11 @@
 
 /* --- internal --- */
 void    _bse_init_c_wrappers    ();
-extern BseMainArgs  *bse_main_args;
-extern GMainContext *bse_main_context;
-extern SfiMutex	     bse_main_sequencer_mutex;
-extern gboolean      bse_main_debug_extensions;
-extern SfiThread    *bse_main_thread;
+BSE_VAR BseMainArgs  *bse_main_args;
+BSE_VAR GMainContext *bse_main_context;
+BSE_VAR SfiMutex      bse_main_sequencer_mutex;
+BSE_VAR gboolean      bse_main_debug_extensions;
+BSE_VAR SfiThread    *bse_main_thread;
 
 
 G_END_DECLS
Index: bse/bsemathsignal.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bsemathsignal.h,v
retrieving revision 1.22
diff -u -r1.22 bsemathsignal.h
--- bse/bsemathsignal.h	24 Dec 2004 21:51:10 -0000	1.22
+++ bse/bsemathsignal.h	28 Sep 2005 17:47:25 -0000
@@ -383,7 +383,7 @@
 
 /* --- cents (1/100th of a semitone) --- */
 #define	bse_cent_factor(index /* -100..100 */)	(bse_cent_table[index])
-extern const gdouble *bse_cent_table;
+BSE_CONST_VAR gdouble *bse_cent_table;
 
 
 /* --- implementation details --- */
Index: bse/bseobject.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bseobject.h,v
retrieving revision 1.39
diff -u -r1.39 bseobject.h
--- bse/bseobject.h	10 Apr 2005 22:56:28 -0000	1.39
+++ bse/bseobject.h	28 Sep 2005 17:47:29 -0000
@@ -163,7 +163,7 @@
 
 
 /* --- implementation details --- */
-extern GQuark bse_quark_uname;
+BSE_VAR GQuark bse_quark_uname;
 void          bse_object_marshal_signal (GClosure       *closure,
                                          GValue /*out*/ *return_value,
                                          guint           n_param_values,
Index: bse/bseplugin.c
===================================================================
RCS file: /cvs/gnome/beast/bse/bseplugin.c,v
retrieving revision 1.44
diff -u -r1.44 bseplugin.c
--- bse/bseplugin.c	20 May 2005 11:43:23 -0000	1.44
+++ bse/bseplugin.c	28 Sep 2005 17:47:33 -0000
@@ -639,23 +639,30 @@
       ring = sfi_ring_concat (ring, sfi_ring_sort (files, (SfiCompareFunc) strcmp, NULL));
       return ring;      /* override */
     }
+
+#ifndef __CYGWIN32__
+   const char *plugin_pattern = "*.so";
+#else
+   const char *plugin_pattern = "*.dll";
+#endif
+
   if (include_drivers)
     {
-      files = sfi_file_crawler_list_files (BSE_PATH_DRIVERS, "*.so", G_FILE_TEST_IS_REGULAR);
+      files = sfi_file_crawler_list_files (BSE_PATH_DRIVERS, plugin_pattern, G_FILE_TEST_IS_REGULAR);
       ring = sfi_ring_concat (ring, sfi_ring_sort (files, (SfiCompareFunc) strcmp, NULL));
       files = sfi_file_crawler_list_files (BSE_PATH_DRIVERS, "*.o", G_FILE_TEST_IS_REGULAR);
       ring = sfi_ring_concat (ring, sfi_ring_sort (files, (SfiCompareFunc) strcmp, NULL));
     }
   if (include_plugins)
     {
-      files = sfi_file_crawler_list_files (BSE_PATH_PLUGINS, "*.so", G_FILE_TEST_IS_REGULAR);
+      files = sfi_file_crawler_list_files (BSE_PATH_PLUGINS, plugin_pattern, G_FILE_TEST_IS_REGULAR);
       ring = sfi_ring_concat (ring, sfi_ring_sort (files, (SfiCompareFunc) strcmp, NULL));
       files = sfi_file_crawler_list_files (BSE_PATH_PLUGINS, "*.o", G_FILE_TEST_IS_REGULAR);
       ring = sfi_ring_concat (ring, sfi_ring_sort (files, (SfiCompareFunc) strcmp, NULL));
     }
   if (include_plugins && BSE_GCONFIG (plugin_path) && BSE_GCONFIG (plugin_path)[0])
     {
-      files = sfi_file_crawler_list_files (BSE_GCONFIG (plugin_path), "*.so", G_FILE_TEST_IS_REGULAR);
+      files = sfi_file_crawler_list_files (BSE_GCONFIG (plugin_path), plugin_pattern, G_FILE_TEST_IS_REGULAR);
       ring = sfi_ring_concat (ring, sfi_ring_sort (files, (SfiCompareFunc) strcmp, NULL));
       files = sfi_file_crawler_list_files (BSE_GCONFIG (plugin_path), "*.o", G_FILE_TEST_IS_REGULAR);
       ring = sfi_ring_concat (ring, sfi_ring_sort (files, (SfiCompareFunc) strcmp, NULL));
Index: bse/bseplugin.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bseplugin.h,v
retrieving revision 1.23
diff -u -r1.23 bseplugin.h
--- bse/bseplugin.h	7 Mar 2005 07:48:46 -0000	1.23
+++ bse/bseplugin.h	28 Sep 2005 17:47:33 -0000
@@ -29,6 +29,7 @@
 
 #include	<bse/bse.h>	/* for bse_check_version() */
 #include	<bse/bseexports.h>
+#include	<bse/bsevar.h>
 
 G_BEGIN_DECLS
 
@@ -77,13 +78,13 @@
                                BSE_EXPORT_IDENTITY (BSE_PLUGIN_NAME, __enode_chain_head);       \
   extern "C" {                                                                                  \
     extern ::BseExportIdentity *const BSE_EXPORT_IDENTITY_SYMBOL;                               \
-    ::BseExportIdentity *const BSE_EXPORT_IDENTITY_SYMBOL = &__bse_export_identity;             \
+    PLUGIN_EXPORT_VAR ::BseExportIdentity *const BSE_EXPORT_IDENTITY_SYMBOL = &__bse_export_identity;             \
   }
 #else
 #define BSE_DEFINE_EXPORTS(PluginName)                                                          \
   static BseExportIdentity __bse_export_identity =                                              \
                              BSE_EXPORT_IDENTITY (BSE_PLUGIN_NAME, __enode_chain_head);         \
-  BseExportIdentity *const BSE_EXPORT_IDENTITY_SYMBOL = &__bse_export_identity
+  PLUGIN_EXPORT_VAR BseExportIdentity *const BSE_EXPORT_IDENTITY_SYMBOL = &__bse_export_identity
 #endif
 
 #define BSE_DEFINE_EXPORT_STRINGS_FUNC(FUNCNAME, BLURB, AUTHORS, LICENSE)                       \
@@ -110,7 +111,7 @@
 
 /* --- implementation details --- */
 void		         bse_plugin_init_builtins     (void);
-extern BseExportIdentity bse_builtin_export_identity; /* sync with bsecxxplugin.hh */
+BSE_VAR BseExportIdentity bse_builtin_export_identity; /* sync with bsecxxplugin.hh */
 
 G_END_DECLS
 
Index: bse/bsesequencer.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bsesequencer.h,v
retrieving revision 1.10
diff -u -r1.10 bsesequencer.h
--- bse/bsesequencer.h	8 Oct 2004 12:24:14 -0000	1.10
+++ bse/bsesequencer.h	28 Sep 2005 17:47:36 -0000
@@ -19,6 +19,7 @@
 #define __BSE_SSEQUENCER_H__
 
 #include <bse/bsesong.h>
+#include <bse/bsevar.h>
 
 G_BEGIN_DECLS
 
@@ -27,7 +28,7 @@
   SfiRing		*songs;
 } BseSequencer;
 
-extern SfiThread       *bse_sequencer_thread;
+BSE_VAR SfiThread      *bse_sequencer_thread;
 
 void			bse_sequencer_init_thread	(void);
 void                    bse_sequencer_add_io_watch      (guint           n_pfds,
Index: bse/bseserver.c
===================================================================
RCS file: /cvs/gnome/beast/bse/bseserver.c,v
retrieving revision 1.54
diff -u -r1.54 bseserver.c
--- bse/bseserver.c	25 May 2005 17:54:45 -0000	1.54
+++ bse/bseserver.c	28 Sep 2005 17:47:37 -0000
@@ -1151,9 +1151,11 @@
       engine_is_initialized = TRUE;
       bse_engine_init (TRUE);
       /* lower priorities compared to engine if our priority range permits */
+#ifndef __CYGWIN32__
       current_priority = getpriority (PRIO_PROCESS, mypid);
       if (current_priority <= -2 && mypid)
         setpriority (PRIO_PROCESS, mypid, current_priority + 1);
+#endif
     }
   bse_engine_configure (BSE_GCONFIG (synth_latency), mix_freq, BSE_GCONFIG (synth_control_freq));
 
Index: bse/bsetype.h
===================================================================
RCS file: /cvs/gnome/beast/bse/bsetype.h,v
retrieving revision 1.43
diff -u -r1.43 bsetype.h
--- bse/bsetype.h	19 Dec 2004 13:02:32 -0000	1.43
+++ bse/bsetype.h	28 Sep 2005 17:47:44 -0000
@@ -19,6 +19,7 @@
 #define __BSE_TYPE_H__
 
 #include	<bse/bsedefs.h>
+#include	<bse/bsevar.h>
 
 G_BEGIN_DECLS
 
@@ -33,7 +34,7 @@
 #define	BSE_TYPE_IS_OBJECT(type)	(g_type_is_a ((type), BSE_TYPE_OBJECT))
 
 /* --- extra types --- */
-extern GType bse_type_id_packed_pointer;
+BSE_VAR GType bse_type_id_packed_pointer;
 #define BSE_TYPE_PACKED_POINTER (bse_type_id_packed_pointer)
 
 
@@ -99,7 +100,7 @@
 
 /* --- dynamic config --- */
 #define BSE_GCONFIG(cfg) (bse_global_config->cfg)
-extern BseGConfig        *bse_global_config;    /* from bsegconfig.[hc] */
+BSE_VAR BseGConfig        *bse_global_config;    /* from bsegconfig.[hc] */
 
 
 /* --- provide IDL pspec initializers --- */
Index: bse/gslcommon.h
===================================================================
RCS file: /cvs/gnome/beast/bse/gslcommon.h,v
retrieving revision 1.34
diff -u -r1.34 gslcommon.h
--- bse/gslcommon.h	24 Jan 2005 21:45:13 -0000	1.34
+++ bse/gslcommon.h	28 Sep 2005 17:47:46 -0000
@@ -21,6 +21,7 @@
 
 #include <bse/gsldefs.h>
 #include <bse/bseenums.h>
+#include <bse/bsevar.h>
 
 G_BEGIN_DECLS
 
@@ -119,7 +120,7 @@
 void	bse_init_loader_gus_patch	(void);
 #define		GSL_N_IO_RETRIES	(5)
 #define		_GSL_TICK_STAMP_VAL()	(bse_engine_exvar_tick_stamp + 0)
-extern volatile guint64	bse_engine_exvar_tick_stamp;
+BSE_VAR volatile guint64 bse_engine_exvar_tick_stamp;
 
 
 G_END_DECLS
Index: launchers/suidmain.c
===================================================================
RCS file: /cvs/gnome/beast/launchers/suidmain.c,v
retrieving revision 1.6
diff -u -r1.6 suidmain.c
--- launchers/suidmain.c	3 Dec 2004 18:17:24 -0000	1.6
+++ launchers/suidmain.c	28 Sep 2005 17:48:03 -0000
@@ -27,6 +27,10 @@
 
 static int original_priority = 0;
 
+#ifdef __CYGWIN32__
+static const int PRIO_MIN = -20;
+#endif
+
 static int      /* returns 0 for success */
 adjust_priority (void)
 {
Index: plugins/Makefile.am
===================================================================
RCS file: /cvs/gnome/beast/plugins/Makefile.am,v
retrieving revision 1.50
diff -u -r1.50 Makefile.am
--- plugins/Makefile.am	15 May 2005 14:22:46 -0000	1.50
+++ plugins/Makefile.am	28 Sep 2005 17:48:05 -0000
@@ -71,7 +71,7 @@
 ##plugins_built_sources += foo.genidl.hh
 ##plugin_LTLIBRARIES    += foo.la
 #
-plugin_ldflags = -avoid-version
+plugin_ldflags = -avoid-version -no-undefined --export-regex bse_export__identity
 plugin_libs    = $(top_builddir)/bse/libbse.la $(top_builddir)/sfi/libsfi.la $(BSE_LIBS) -lm
 
 EXTRA_DIST += $(strip \
Index: plugins/evaluator/Makefile.am
===================================================================
RCS file: /cvs/gnome/beast/plugins/evaluator/Makefile.am,v
retrieving revision 1.10
diff -u -r1.10 Makefile.am
--- plugins/evaluator/Makefile.am	15 May 2005 14:22:47 -0000	1.10
+++ plugins/evaluator/Makefile.am	28 Sep 2005 17:48:08 -0000
@@ -16,7 +16,7 @@
 EVALUATE_SOURCES = instruction.cc compiler.cc cpu.cc
 
 bseevaluator_la_SOURCES = bseevaluator.cc $(EVALUATE_SOURCES)
-bseevaluator_la_LDFLAGS = -module -avoid-version
+bseevaluator_la_LDFLAGS = -module -avoid-version -no-undefined --export-regex bse_export__identity
 bseevaluator_la_LIBADD  = $(top_builddir)/bse/libbse.la $(top_builddir)/sfi/libsfi.la $(BSE_LIBS) -lm
 plugins_built_sources += bseevaluator.genidl.hh
 EXTRA_HEADERS += bseevaluator.idl symbols.hh token.hh instruction.hh compiler.hh cpu.hh
Index: plugins/freeverb/Makefile.am
===================================================================
RCS file: /cvs/gnome/beast/plugins/freeverb/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- plugins/freeverb/Makefile.am	15 May 2005 14:22:47 -0000	1.5
+++ plugins/freeverb/Makefile.am	28 Sep 2005 17:48:08 -0000
@@ -8,7 +8,7 @@
 plugindir = $(bseplugindir)
 
 freeverb_la_SOURCES = allpass.cpp comb.cpp revmodel.cpp bsefreeverbcpp.cpp bsefreeverb.c
-freeverb_la_LDFLAGS = -module -avoid-version
+freeverb_la_LDFLAGS = -module -avoid-version -no-undefined --export-regex bse_export__identity
 freeverb_la_LIBADD  = $(top_builddir)/bse/libbse.la $(top_builddir)/sfi/libsfi.la $(BSE_LIBS) -lm
 
 plugin_LTLIBRARIES = freeverb.la
Index: sfi/Makefile.am
===================================================================
RCS file: /cvs/gnome/beast/sfi/Makefile.am,v
retrieving revision 1.32
diff -u -r1.32 Makefile.am
--- sfi/Makefile.am	15 May 2005 13:52:49 -0000	1.32
+++ sfi/Makefile.am	28 Sep 2005 17:49:20 -0000
@@ -10,12 +10,18 @@
 # public libraries
 lib_LTLIBRARIES = libsfi.la
 DEFS += -DG_LOG_DOMAIN=\"SFI\" -DG_DISABLE_CONST_RETURNS
+
+AM_CFLAGS += -DSFI_COMPILATION
+
 libsfiincludedir = $(includedir)/sfi
 libsfi_la_LDFLAGS = $(strip \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
 	-release $(LT_RELEASE) \
 	-export-dynamic \
+	-export-symbols-regex '.*' \
+	-no-undefined \
 )
+#	-export-symbols sfi.def
 libsfi_la_LIBADD = $(SFI_LIBS) -lm
 
 sfi_public_headers = $(strip \
@@ -84,11 +90,11 @@
 # source files
 common_idl_sources = sfidl-generator.cc sfidl-namespace.cc sfidl-options.cc sfidl-parser.cc \
   sfidl-factory.cc sfidl-typelist.cc sfidl-cbase.cc sfidl-clientc.cc sfidl-clientcxx.cc sfidl-corec.cc \
-  sfidl-corecxx.cc sfidl-cxxbase.cc sfidl-hostc.cc glib-extra.c
+  sfidl-corecxx.cc sfidl-cxxbase.cc sfidl-hostc.cc
 
 noinst_PROGRAMS = testsfi testcxx testsfidl
 sfidl_SOURCES = sfidl.cc $(common_idl_sources)
-sfidl_LDADD = $(SFI_LIBS) -lm
+sfidl_LDADD = $(SFI_LIBS) -lm -lsfi
 
 bin_PROGRAMS = sfidl
 
Index: sfi/sfiparams.h
===================================================================
RCS file: /cvs/gnome/beast/sfi/sfiparams.h,v
retrieving revision 1.25
diff -u -r1.25 sfiparams.h
--- sfi/sfiparams.h	24 Dec 2004 21:50:52 -0000	1.25
+++ sfi/sfiparams.h	28 Sep 2005 17:49:30 -0000
@@ -324,7 +324,7 @@
 
 /* --- internal --- */
 void		_sfi_init_params	(void);
-extern GType*	 sfi__param_spec_types;
+SFI_VAR GType*	sfi__param_spec_types;
 SfiRec*		sfi_pspec_to_rec	(GParamSpec	*pspec);
 GParamSpec*	sfi_pspec_from_rec	(SfiRec		*prec);
 
Index: sfi/sfiserial.h
===================================================================
RCS file: /cvs/gnome/beast/sfi/sfiserial.h,v
retrieving revision 1.7
diff -u -r1.7 sfiserial.h
--- sfi/sfiserial.h	8 Sep 2004 14:52:24 -0000	1.7
+++ sfi/sfiserial.h	28 Sep 2005 17:49:31 -0000
@@ -48,7 +48,7 @@
 
 
 /* --- GScanner config --- */
-extern const GScannerConfig *sfi_storage_scanner_config;
+SFI_VAR const GScannerConfig *sfi_storage_scanner_config;
 
 
 G_END_DECLS
Index: sfi/sfithreads.c
===================================================================
RCS file: /cvs/gnome/beast/sfi/sfithreads.c,v
retrieving revision 1.15
diff -u -r1.15 sfithreads.c
--- sfi/sfithreads.c	13 Oct 2004 17:01:35 -0000	1.15
+++ sfi/sfithreads.c	28 Sep 2005 17:49:32 -0000
@@ -230,7 +230,11 @@
       self->ac.cstime = timeval_usecs (&res.ru_stime);
       self->info.cutime = MAX (self->ac.cutime - utime, 0) * dfact;
       self->info.cstime = MAX (self->ac.cstime - stime, 0) * dfact;
+#ifndef __CYGWIN32__
       self->info.priority = getpriority (PRIO_PROCESS, self->tid);
+#else
+      self->info.priority = 0;
+#endif
       thread_info_from_stat_L (self, dfact);
       self->accounting--;
     }
@@ -1311,7 +1315,9 @@
 {
   SfiThreadTable *table = get_pth_thread_table ();
   if (!table)
-    table = get_fallback_thread_table ();
+    {
+      table = get_fallback_thread_table ();
+    }
   sfi_thread_table = *table;
   
   sfi_mutex_init (&global_thread_mutex);
Index: sfi/sfithreads.h
===================================================================
RCS file: /cvs/gnome/beast/sfi/sfithreads.h,v
retrieving revision 1.10
diff -u -r1.10 sfithreads.h
--- sfi/sfithreads.h	25 May 2005 20:49:04 -0000	1.10
+++ sfi/sfithreads.h	28 Sep 2005 17:49:32 -0000
@@ -197,7 +197,8 @@
 					 gulong		 abs_usecs);
   void		(*cond_destroy)		(SfiCond	*cond);
 };
-extern SfiThreadTable sfi_thread_table;
+
+SFI_VAR SfiThreadTable sfi_thread_table;
 static inline void /* inlined for speed */
 sfi_guard_protect (SfiGuard      *guard,
                    guint          nth_hazard,
Index: sfi/sfitime.c
===================================================================
RCS file: /cvs/gnome/beast/sfi/sfitime.c,v
retrieving revision 1.13
diff -u -r1.13 sfitime.c
--- sfi/sfitime.c	20 Jan 2005 16:37:30 -0000	1.13
+++ sfi/sfitime.c	28 Sep 2005 17:49:32 -0000
@@ -74,7 +74,11 @@
      */
     struct tm tmdata;
     localtime_r (&t, &tmdata);
+#ifdef __CYGWIN32__
+    gmt_diff = 0;
+#else
     gmt_diff = -tmdata.tm_gmtoff;
+#endif
   }
 #endif
 
Index: sfi/sfitypes.h
===================================================================
RCS file: /cvs/gnome/beast/sfi/sfitypes.h,v
retrieving revision 1.17
diff -u -r1.17 sfitypes.h
--- sfi/sfitypes.h	20 May 2004 12:23:17 -0000	1.17
+++ sfi/sfitypes.h	28 Sep 2005 17:49:32 -0000
@@ -95,6 +95,24 @@
 #define SFI_END_ARGS2(a,b)   a , b)
 #define SFI_END_ARGS3(a,b,c) a , b , c)
 
+/* We prefix variable declarations so they can
+ * properly get exported in windows dlls.
+ */
+#ifndef SFI_VAR
+#  ifdef G_PLATFORM_WIN32
+#    ifdef SFI_STATIC_COMPILATION
+#      define SFI_VAR extern
+#    else /* !SFI_STATIC_COMPILATION */
+#      ifdef SFI_COMPILATION
+#        define SFI_VAR extern __declspec(dllexport)
+#      else /* !SFI_COMPILATION */
+#        define SFI_VAR extern __declspec(dllimport)
+#      endif /* !SFI_COMPILATION */
+#    endif /* !SFI_STATIC_COMPILATION */
+#  else /* !G_PLATFORM_WIN32 */
+#    define SFI_VAR extern
+#  endif /* !G_PLATFORM_WIN32 */
+#endif /* SFI_VAR */
 
 G_END_DECLS
 
Index: sfi/sfivalues.h
===================================================================
RCS file: /cvs/gnome/beast/sfi/sfivalues.h,v
retrieving revision 1.13
diff -u -r1.13 sfivalues.h
--- sfi/sfivalues.h	8 Oct 2004 09:49:27 -0000	1.13
+++ sfi/sfivalues.h	28 Sep 2005 17:49:33 -0000
@@ -185,9 +185,9 @@
 
 
 /* --- internal --- */
-void	     _sfi_init_values	(void);
-extern GType *sfi__value_types;
-gboolean      sfi_check_value	(const GValue	*value);
+void	       _sfi_init_values	(void);
+SFI_VAR GType *sfi__value_types;
+gboolean       sfi_check_value	(const GValue	*value);
 
 G_END_DECLS
 
Index: shell/Makefile.am
===================================================================
RCS file: /cvs/gnome/beast/shell/Makefile.am,v
retrieving revision 1.17
diff -u -r1.17 Makefile.am
--- shell/Makefile.am	19 May 2005 22:24:34 -0000	1.17
+++ shell/Makefile.am	28 Sep 2005 17:49:34 -0000
@@ -23,10 +23,15 @@
 #
 # programs to build
 #
-bin_PROGRAMS = @BSESH_BINARY@			# this expands to bsesh-$BIN_VERSION
-EXTRA_PROGRAMS = bsesh-\$(BIN_VERSION)		# make automake-1.4 eat bsesh____BIN_VERSION_ variables
-bsesh____BIN_VERSION__SOURCES = bsesh.c bsescminterp.c cxxdummy.cc
-bsesh____BIN_VERSION__LDADD = $(programs_ldadd) $(BSE_SHELL_LIBS)
+# bin_PROGRAMS = @BSESH_BINARY@			# this expands to bsesh-$BIN_VERSION
+# EXTRA_PROGRAMS = bsesh-\$(BIN_VERSION)		# make automake-1.4 eat bsesh____BIN_VERSION_ variables
+# bsesh____BIN_VERSION__SOURCES = bsesh.c bsescminterp.c cxxdummy.cc
+# bsesh____BIN_VERSION__LDADD = $(programs_ldadd) $(BSE_SHELL_LIBS)
+
+bin_PROGRAMS = bsesh-0.6.6                      # this expands to bsesh-$BIN_VERSION
+bsesh_0_6_6_SOURCES = bsesh.c bsescminterp.c cxxdummy.cc
+bsesh_0_6_6_LDADD = $(programs_ldadd) $(BSE_SHELL_LIBS)
+
 # libraries to link programs against
 programs_ldadd = $(top_builddir)/bse/libbse.la $(top_builddir)/sfi/libsfi.la
 # source setups
/* BSE - Bedevilled Sound Engine
 * Copyright (C) 1998-2002 Tim Janik
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 */
#ifndef __BSE_VAR_H__
#define __BSE_VAR_H__

#include <glib.h>

G_BEGIN_DECLS

/* We prefix variable declarations so they can
 * properly get exported in windows dlls.
 */
#ifndef BSE_VAR
#  ifdef G_PLATFORM_WIN32
#    ifdef BSE_STATIC_COMPILATION
#      define BSE_VAR extern
#    else /* !BSE_STATIC_COMPILATION */
#      ifdef BSE_COMPILATION
#        define BSE_VAR extern __declspec(dllexport)
#      else /* !BSE_COMPILATION */
#        define BSE_VAR extern __declspec(dllimport)
#      endif /* !BSE_COMPILATION */
#    endif /* !BSE_STATIC_COMPILATION */
#  else /* !G_PLATFORM_WIN32 */
#    define BSE_VAR extern
#  endif /* !G_PLATFORM_WIN32 */
#endif /* BSE_VAR */

#ifndef BSE_CONST_VAR
#  ifdef G_PLATFORM_WIN32
#    ifdef BSE_STATIC_COMPILATION
#      define BSE_CONST_VAR const extern
#    else /* !BSE_STATIC_COMPILATION */
#      ifdef BSE_COMPILATION
#        define BSE_CONST_VAR __declspec(dllexport) const extern
#      else /* !BSE_COMPILATION */
#        define BSE_CONST_VAR __declspec(dllimport) const extern
#      endif /* !BSE_COMPILATION */
#    endif /* !BSE_STATIC_COMPILATION */
#  else /* !G_PLATFORM_WIN32 */
#    define BSE_CONST_VAR const extern
#  endif /* !G_PLATFORM_WIN32 */
#endif /* BSE_VAR */

/*
 * for plugins: always export
 */
#ifndef PLUGIN_EXPORT_VAR
#  ifdef G_PLATFORM_WIN32
#    ifdef BSE_STATIC_COMPILATION
#      define PLUGIN_EXPORT_VAR
#    else /* !BSE_STATIC_COMPILATION */
#      define PLUGIN_EXPORT_VAR __declspec(dllexport)
#    endif /* !BSE_STATIC_COMPILATION */
#  else /* !G_PLATFORM_WIN32 */
#    define PLUGIN_EXPORT_VAR
#  endif /* !G_PLATFORM_WIN32 */
#endif /* BSE_VAR */

G_END_DECLS

#endif /* __BSE_VAR_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]