From c8a301545df3c064e1f17cdc0e4a3f5b029f6352 Mon Sep 17 00:00:00 2001 From: Aaron Bockover Date: Tue, 9 Nov 2010 16:57:15 -0500 Subject: [PATCH] Partially ported to automake --- AUTHORS | 0 Maigre/Makefile.in | 34 -------------- Makefile.am | 18 ++++++++ Makefile.in | 15 ------- NEWS | 0 autogen.sh | 76 ++++++++++++++++++++++++++++++++ configure | 76 -------------------------------- configure.ac | 44 ++++++++++++++++++ libmaigre/Makefile.am | 26 +++++++++++ libmaigre/Makefile.in | 30 ------------- libmaigre/maigre-style.c | 55 ----------------------- maigre-codegen/maigre-codegen.py | 2 - 12 files changed, 164 insertions(+), 212 deletions(-) create mode 100644 AUTHORS delete mode 100644 Maigre/Makefile.in create mode 100644 Makefile.am delete mode 100644 Makefile.in create mode 100644 NEWS create mode 100755 autogen.sh delete mode 100755 configure create mode 100644 configure.ac create mode 100644 libmaigre/Makefile.am delete mode 100644 libmaigre/Makefile.in delete mode 100644 libmaigre/maigre-style.c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/Maigre/Makefile.in b/Maigre/Makefile.in deleted file mode 100644 index ee664f8..0000000 --- a/Maigre/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -MAIGRE_SOURCES = \ - Cairo/ColorExtensions.cs \ - Cairo/ContextExtensions.cs \ - Cairo/Corner.cs \ - Cairo/RectangleExtensions.cs \ - Maigre.Osx/OsxTheme.cs \ - Maigre/Theme.cs \ - Maigre/Theme_Generated.cs - -MAIGRE_OTHER = gtkrc - -REFERENCES = \ - Mono.Cairo \ - -pkg:gtk-sharp-2.0 \ - System \ - System.Core - -REFERENCES_BUILD = \ - $(filter -pkg:%, $(REFERENCES)) \ - $(foreach r, $(filter-out -pkg:%, $(REFERENCES)), -r:$(r)) - -all: Maigre.dll - -Maigre.dll: $(MAIGRE_SOURCES) - gmcs -out:$@ -target:library -debug $(REFERENCES_BUILD) $(MAIGRE_SOURCES) - -Maigre/Theme_Generated.cs: ../maigre-codegen/maigre-codegen.py - $(MAKE) -C ../maigre-codegen - -run: - $(MAKE) -C .. run - -clean: - rm -rf Maigre.dll* obj/ Maigre/Theme_Generated.cs diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..3f181f8 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,18 @@ +SUBDIRS = \ + libmaigre + +EXTRA_DIST = \ + Maigre.sln + +MAINTAINERCLEANFILES = \ + Makefile.in \ + INSTALL \ + aclocal.m4 \ + config.guess \ + config.sub \ + configure \ + depcomp \ + install-sh \ + ltmain.sh \ + missing \ + mkinstalldirs diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index d55dc9f..0000000 --- a/Makefile.in +++ /dev/null @@ -1,15 +0,0 @@ -all: - $(MAKE) -C libmaigre - $(MAKE) -C Maigre - -clean: - $(MAKE) -C libmaigre clean - $(MAKE) -C Maigre clean - rm -rf lib - -run: - rm -rf lib - mkdir -p lib/engines - cp Maigre/gtkrc lib - cp libmaigre/libmaigre.so Maigre/Maigre.dll lib/engines - GTK_PATH=$$PWD/lib GTK2_RC_FILES=lib/gtkrc gtk-demo diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..9862a44 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +PROJECT=maigre + +function error () { + echo "Error: $1" 1>&2 + exit 1 +} + +function check_autotool_version () { + which $1 &>/dev/null || { + error "$1 is not installed, and is required to configure $PACKAGE" + } + + version=$($1 --version | head -n 1 | cut -f4 -d' ') + major=$(echo $version | cut -f1 -d.) + minor=$(echo $version | cut -f2 -d.) + rev=$(echo $version | cut -f3 -d. | sed 's/[^0-9].*$//') + major_check=$(echo $2 | cut -f1 -d.) + minor_check=$(echo $2 | cut -f2 -d.) + rev_check=$(echo $2 | cut -f3 -d.) + + if [ $major -lt $major_check ]; then + do_bail=yes + elif [[ $minor -lt $minor_check && $major = $major_check ]]; then + do_bail=yes + elif [[ $rev -lt $rev_check && $minor = $minor_check && $major = $major_check ]]; then + do_bail=yes + fi + + if [ x"$do_bail" = x"yes" ]; then + error "$1 version $2 or better is required to configure $PROJECT" + fi +} + +function run () { + echo "Running $@ ..." + $@ 2>.autogen.log || { + cat .autogen.log 1>&2 + rm .autogen.log + error "Could not run $1, which is required to configure $PROJECT" + } + rm .autogen.log +} + +srcdir=$(dirname $0) +test -z "$srcdir" && srcdir=. + +(test -f $srcdir/configure.ac) || { + error "Directory \"$srcdir\" does not look like the top-level $PROJECT directory" +} + +check_autotool_version aclocal 1.9 +check_autotool_version automake 1.9 +check_autotool_version autoconf 2.53 +check_autotool_version libtoolize 1.4.3 +check_autotool_version pkg-config 0.14.0 + +run libtoolize --force --copy --automake +run aclocal $ACLOCAL_FLAGS +run autoconf + +test -f config.h.in && touch config.h.in +run automake --gnu --add-missing --force --copy \ + -Wno-portability -Wno-portability + +if [ ! -z "$NOCONFIGURE" ]; then + echo "Done. ./configure skipped." + exit $? +fi + +if [ $# = 0 ]; then + echo "WARNING: I am going to run configure without any arguments." +fi + +run ./configure --enable-maintainer-mode $@ diff --git a/configure b/configure deleted file mode 100755 index 54949a8..0000000 --- a/configure +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -set -e - -function check_start { - echo -n "Checking for $1... " -} - -function check_fail { - echo no - echo - echo "$1" - exit 1 -} - -function check_success { - echo yes -} - -check_start "GTK+" -pkg-config --atleast-version 2.12 gtk+-2.0 || - check_fail "Please install gtk+-2.0 >= 2.12" && - check_success - -check_start "Mono runtime" -pkg-config --atleast-version 2.6 mono || - check_fail "Please install mono-devel >= 2.6" && - check_success - -check_start "gmcs compiler" -gmcs --help &>/dev/null || - check_fail "Please install gmcs" && - check_success - -check_start "Gtk#" -pkg-config --atleast-version 2.12 gtk-sharp-2.0 || - check_fail "Please install gtk-sharp-2.0 >= 2.12" && - check_success - -check_start "gcc" -gcc --help &>/dev/null || - check_fail "Please install gcc" && - check_success - -check_start "Python runtime" -python --help &>/dev/null || - check_fail "Please install python" && - check_success - -check_start "Python mako module" -python -c 'import mako' &>/dev/null || - check_fail "Please install python-mako." && - check_success - -function generate { - echo "Created $1" - packages="mono gtk+-2.0" - sed \ - "s,@PKG_CFLAGS@,$(pkg-config --cflags $packages),g; - s,@PKG_LIBS@,$(pkg-config --libs $packages),g" \ - < $1.in \ - > $1 - { cat <> $1 -} - -generate Makefile -generate libmaigre/Makefile -generate Maigre/Makefile - -echo -echo "Success. You may now run make." diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..a43cd6c --- /dev/null +++ b/configure.ac @@ -0,0 +1,44 @@ +AC_PREREQ(2.52) +AC_INIT([maigre], [0.1]) +AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar foreign]) +AM_MAINTAINER_MODE + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AC_PROG_CC +AC_PROG_INSTALL +PKG_PROG_PKG_CONFIG + +AM_DISABLE_STATIC +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL + +AC_PATH_PROG(MCS, gmcs) +if test x$MCS = x; then + AC_MSG_ERROR([Could not find 'gmcs']) +fi + +AC_PATH_PROG(MONO, mono) +if test x$MONO = x; then + AC_MSG_ERROR([Could not find 'mono']) +fi + +AC_PATH_PROG(PYTHON, python) +if test x$PYTHON = x; then + AC_MSG_ERROR([Could not find 'python']) +fi + +PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 >= 2.12) + +PKG_CHECK_MODULES(MONO, mono >= 2.6) +PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.12) + +GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0` +AC_SUBST(GTK_VERSION) + +AC_CONFIG_FILES([ + Makefile + libmaigre/Makefile +]) + +AC_OUTPUT diff --git a/libmaigre/Makefile.am b/libmaigre/Makefile.am new file mode 100644 index 0000000..6c98356 --- /dev/null +++ b/libmaigre/Makefile.am @@ -0,0 +1,26 @@ +EXTRA_DIST = maigre-style.c.in +CLEANFILES = maigre-style.c +MAINTAINERCLEANFILES = Makefile.in + +INCLUDES = \ + -Wall -ggdb3 -D_FORTIFY_SOURCE=2 \ + $(MONO_CFLAGS) \ + $(GTK_CFLAGS) + +MAIGRE_SRC = \ + maigre-mono-bridge.c \ + maigre-mono-bridge.h \ + maigre-rc-style.c \ + maigre-rc-style.h \ + maigre-style.h \ + maigre-theme-module.c + +enginedir = $(libdir)/gtk-2.0/$(GTK_VERSION)/engines +engine_LTLIBRARIES = libmaigre.la + +libmaigre_la_SOURCES = $(MAIGRE_SRC) maigre-style.c +libmurrine_la_LDFLAGS = -module -avoid-version -no-undefined +libmurrine_la_LIBADD = $(MONO_LIBS) $(GTK_LIBS) + +maigre-style.c: maigre-style.c.in + @echo " GEN $@"; ../maigre-codegen/maigre-codegen.py $< $@ diff --git a/libmaigre/Makefile.in b/libmaigre/Makefile.in deleted file mode 100644 index 3aa1e46..0000000 --- a/libmaigre/Makefile.in +++ /dev/null @@ -1,30 +0,0 @@ -LIBMAIGRE_SOURCES = \ - maigre-mono-bridge.c \ - maigre-rc-style.c \ - maigre-style.c \ - maigre-theme-module.c - -LIBMAIGRE_OTHER = \ - maigre-mono-bridge.h \ - maigre-rc-style.h \ - maigre-style.h - -CC = gcc -LIBMAIGRE_CFLAGS = -Wall -O2 -ggdb3 @PKG_CFLAGS@ $(CFLAGS) -LIBMAIGRE_LDFLAGS = -shared @PKG_LIBS@ $(LDFLAGS) -LIBMAIGRE_OBJECTS = $(LIBMAIGRE_SOURCES:.c=.o) - -all: libmaigre.so - -libmaigre.so: codegen $(LIBMAIGRE_OBJECTS) - $(CC) $(LIBMAIGRE_LDFLAGS) $(LIBMAIGRE_OBJECTS) -o $@ - -codegen: ../maigre-codegen/maigre-codegen.py - ./$< - touch maigre-style.c - -.c.o: - $(CC) -c $(LIBMAIGRE_CFLAGS) $< -o $@ - -clean: - rm -rf $(LIBMAIGRE_OBJECTS) libmaigre.so maigre-style-overrides.c diff --git a/libmaigre/maigre-style.c b/libmaigre/maigre-style.c deleted file mode 100644 index c508804..0000000 --- a/libmaigre/maigre-style.c +++ /dev/null @@ -1,55 +0,0 @@ -// -// maigre-style.c -// -// Author: -// Aaron Bockover -// -// Copyright 2010 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include - -#include "maigre-style.h" -#include "maigre-mono-bridge.h" - -typedef void (* DrawFnptr) (); - -struct MaigreStyle { - GtkStyle parent_instance; -}; - -struct MaigreStyleClass { - GtkStyleClass parent_class; -}; - -G_DEFINE_TYPE (MaigreStyle, maigre_style, GTK_TYPE_STYLE); - -#include "maigre-style-overrides.c" - -static void -maigre_style_init (MaigreStyle *maigre) -{ -} - -static void -maigre_style_class_init (MaigreStyleClass *klass) -{ - maigre_style_override_methods (GTK_STYLE_CLASS (klass)); -} \ No newline at end of file diff --git a/maigre-codegen/maigre-codegen.py b/maigre-codegen/maigre-codegen.py index ae118a8..e951d15 100755 --- a/maigre-codegen/maigre-codegen.py +++ b/maigre-codegen/maigre-codegen.py @@ -202,8 +202,6 @@ parser = GtkStyleHeaderParser () parser.blacklist = ['draw_polygon'] parser.parse () -print sys.argv[2] - generator = CodeGenerator (parser) result = generator.generate (sys.argv[1]) with open (sys.argv[2], 'w') as out: