diff --git a/.cvsignore b/.cvsignore index 4e8ac1c1b..23f24631a 100755 --- a/.cvsignore +++ b/.cvsignore @@ -1,3 +1,10 @@ *.dll *.exe +config.* +*.m4 +libtool +ltconfig +ltmain.sh +stamp* +configure diff --git a/ChangeLog b/ChangeLog index 4efa03d1e..9698c2482 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-04-25 Mike Kestner + + * autogen.sh : simple config for the glue build + * configure.in : simple config for the glue build + * makefile : add glue dir to build + * glib/SList.cs : Fix some leakage. + * glue/value.c : a helper function for heap alloc of GValues + * glue/Makefile.am : build for libgtksharpglue + 2002-04-19 Mike Kestner * glib/SList.cs : A more sane approach. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 000000000..7e1340d52 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. +# Ripped off from GNOME macros version + +DIE=0 + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile Gtk#." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile Gtk#." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile Gtk#." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + + +if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + libtoolize --force --copy + fi +fi + +echo "Running aclocal $ACLOCAL_FLAGS ..." +aclocal $ACLOCAL_FLAGS || { + echo + echo "**Error**: aclocal failed. This may mean that you have not" + echo "installed all of the packages you need, or you may need to" + echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" + echo "for the prefix where you installed the packages whose" + echo "macros were not found" + exit 1 +} + +if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then + echo "Running autoheader..." + autoheader || { echo "**Error**: autoheader failed."; exit 1; } +fi + +echo "Running automake --gnu $am_opt ..." +automake --add-missing --gnu $am_opt || + { echo "**Error**: automake failed."; exit 1; } +echo "Running autoconf ..." +autoconf || { echo "**Error**: autoconf failed."; exit 1; } + + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi diff --git a/configure.in b/configure.in new file mode 100644 index 000000000..155de6552 --- /dev/null +++ b/configure.in @@ -0,0 +1,85 @@ + +AC_INIT(README) +AC_CANONICAL_SYSTEM +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(gtk-sharp, 0.2) +AM_MAINTAINER_MODE + +AC_CHECK_TOOL(CC, gcc, gcc) +AC_PROG_CC +AM_PROG_CC_STDC +AC_PROG_INSTALL + +dnl may require a specific autoconf version +dnl AC_PROG_CC_FOR_BUILD +dnl CC_FOR_BUILD not automatically detected +CC_FOR_BUILD=$CC +BUILD_EXEEXT= +if test "x$cross_compiling" = "xyes"; then + CC_FOR_BUILD=cc + BUILD_EXEEXT="" +fi +AC_SUBST(CC_FOR_BUILD) +AC_SUBST(HOST_CC) +AC_SUBST(BUILD_EXEEXT) + +# Set STDC_HEADERS +AC_HEADER_STDC +AM_PROG_LIBTOOL + +# not 64 bit clean in cross-compile +AC_CHECK_SIZEOF(void *, 4) + +CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings' + +AC_PATH_PROG(PKG_CONFIG, pkg-config, no) +if test "x$PKG_CONFIG" = "xno"; then + AC_MSG_ERROR([You need to install pkg-config]) +fi + +dnl for use on the build system +dnl pkg-config is stupid +BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0` +BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0` +AC_SUBST(BUILD_GLIB_CFLAGS) +AC_SUBST(BUILD_GLIB_LIBS) + +PKG_PATH= +AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir], + if test x$with_crosspkgdir = "x"; then + if test -s $PKG_CONFIG_PATH; then + PKG_PATH=$PKG_CONFIG_PATH + fi + else + PKG_PATH=$with_crosspkgdir + PKG_CONFIG_PATH=$PKG_PATH + export PKG_CONFIG_PATH + fi +) + +## Versions of dependencies +GLIB_REQUIRED_VERSION=2.0.0 + +PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION) + +GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0` +GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0` +GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0` +GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0` + +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) +AC_SUBST(GMODULE_CFLAGS) +AC_SUBST(GMODULE_LIBS) + +AC_SUBST(CFLAGS) + +AC_OUTPUT([ +glue/Makefile +]) + +echo " + + Now do a "make linux" or "make windows" to build Gtk#. + +" diff --git a/glib/SList.cs b/glib/SList.cs index 43cac08ed..ef62b90a6 100644 --- a/glib/SList.cs +++ b/glib/SList.cs @@ -20,6 +20,17 @@ namespace GLib { public class SList : ArrayList { + private IntPtr list_ptr; + + [DllImport("gobject-2.0")] + static extern void g_slist_free(IntPtr l); + + ~SList () + { + if (list_ptr != IntPtr.Zero) + g_slist_free (list_ptr); + } + /// /// Handle Property /// @@ -33,6 +44,9 @@ namespace GLib { public IntPtr Handle { get { + if (list_ptr != IntPtr.Zero) + g_slist_free (list_ptr); + IntPtr l = IntPtr.Zero; foreach (object o in this) { IntPtr data = IntPtr.Zero; @@ -41,9 +55,10 @@ namespace GLib { else throw new Exception(); } + + list_ptr = l; return l; } } - } } diff --git a/glue/.cvsignore b/glue/.cvsignore new file mode 100644 index 000000000..961fd88d5 --- /dev/null +++ b/glue/.cvsignore @@ -0,0 +1,6 @@ +*.lo +*.la +Makefile.in +Makefile +.deps +.libs diff --git a/glue/Makefile.am b/glue/Makefile.am new file mode 100644 index 000000000..afa83423c --- /dev/null +++ b/glue/Makefile.am @@ -0,0 +1,13 @@ +lib_LTLIBRARIES = libgtksharpglue.la + +INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir) + +libgtksharpglue_la_SOURCES = \ + value.c \ + # + +libgtksharpglue.dll: $(libgtksharpglue_la_OBJECTS) libgtksharpglue.rc libgtksharpglue.def + ./build-dll libgtksharpglue 0.1 + +CLEANFILES = lib*.a lib*.dll + diff --git a/glue/value.c b/glue/value.c new file mode 100644 index 000000000..f4f255ff6 --- /dev/null +++ b/glue/value.c @@ -0,0 +1,18 @@ +/* value.c : Glue to allocate GValues on the heap. + * + * Author: Mike Kestner + * + * 2002 Mike Kestner + */ + +#include + +GValue * +gtksharp_value_create (GType g_type) +{ + GValue *val = g_new0 (GValue, 1); + val = g_value_init (val, g_type); + return val; +} + + diff --git a/makefile b/makefile index 024c864a9..6aa954406 100644 --- a/makefile +++ b/makefile @@ -15,7 +15,9 @@ windows: unix: @echo "'make unix' is broken for now." -linux: +linux: + (cd glue;make) || exit 1 for i in $(DIRS); do \ (cd $$i; MCS="$(MCS)" make linux) || exit 1;\ done; +