From d99c1521abadfd6ce0e95047c1b32430ba3f5915 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Wed, 20 Jan 2010 21:21:18 +0100 Subject: [PATCH] Switch to autotools build process, include gettext infrastructure --- Makefile | 37 -------------------- Makefile.am | 44 ++++++++++++++++++++++++ autogen.sh | 13 +++++++ autovapi.sh | 11 ++++++ configure.ac | 71 +++++++++++++++++++++++++++++++++++++++ m4/vala.m4 | 29 ++++++++++++++++ po/POTFILES.in | 1 + src/status-area-applet-tor.vala | 2 +- 8 files changed, 170 insertions(+), 38 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100755 autovapi.sh create mode 100644 configure.ac create mode 100644 m4/vala.m4 create mode 100644 po/POTFILES.in diff --git a/Makefile b/Makefile deleted file mode 100644 index 0c312a1..0000000 --- a/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -VERSION=0.0.1 -CFLAGS= -Wall -pedantic - -all: status-area-applet-tor.so - -ICON_DIR=$(DESTDIR)`pkg-config libhildondesktop-1 --variable=prefix`/share/icons/hicolor -SM_LIB_DIR=$(DESTDIR)`pkg-config libhildondesktop-1 --variable=hildondesktoplibdir` -SM_DESKTOP_DIR=$(DESTDIR)`pkg-config libhildondesktop-1 --variable=hildonstatusmenudesktopentrydir` - -install: - mkdir -p $(ICON_DIR)/18x18/hildon/ - mkdir -p $(ICON_DIR)/48x48/hildon/ - mkdir -p $(SM_LIB_DIR) - mkdir -p $(SM_DESKTOP_DIR) - cp data/tor_status_connected.png $(ICON_DIR)/18x18/hildon/ - cp data/tor_status_disabled.png $(ICON_DIR)/18x18/hildon/ - cp data/tor_status_connecting.png $(ICON_DIR)/18x18/hildon/ - cp data/tor_onion.png $(ICON_DIR)/48x48/hildon/tor_onion.png - cp data/status-area-applet-tor.desktop $(SM_DESKTOP_DIR) - cp status-area-applet-tor.so $(SM_LIB_DIR) - -uninstall: - rm $(SM_LIB_DIR)/status-area-applet-tor.so - rm $(SM_DESKTOP_DIR)/status-area-applet-tor.desktop - rm $(ICON_DIR)/18x18/hildon/tor_status_connected.png - rm $(ICON_DIR)/18x18/hildon/tor_status_disabled.png - rm $(ICON_DIR)/18x18/hildon/tor_status_connecting.png - rm $(ICON_DIR)/48x48/hildon/tor_onion.png - -status-area-applet-tor.so: src/status-area-applet-tor.c - $(CC) -shared -Wall `pkg-config libhildondesktop-1 gconf-2.0 conic --cflags --libs` -o $@ $^ - -src/status-area-applet-tor.c: src/status-area-applet-tor.vala - valac -C --vapidir ./vapi --pkg conic --pkg gconf-2.0 --pkg hildon-1 --pkg libhildondesktop-1 --pkg libosso --pkg posix $^ - -clean: - -rm -f status-area-applet-tor.so src/status-area-applet-tor.c diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..0439fca --- /dev/null +++ b/Makefile.am @@ -0,0 +1,44 @@ +# List extras to package +EXTRA_DIST = \ + autogen.sh \ + autovapi.sh + +# Sub directories +SUBDIRS = po + +# Binary +hildondesktoplib_LTLIBRARIES = \ + status-area-applet-tor.la + +hildonstatusmenudesktopentry_DATA = \ + data/status-area-applet-tor.desktop + +icon48_DATA = \ + data/tor_onion.png + +icon18_DATA = \ + data/tor_status_disabled.png \ + data/tor_status_connected.png \ + data/tor_status_connecting.png + +status_area_applet_tor_la_SOURCES = \ + src/status-area-applet-tor.c + +status_area_applet_tor_la_VALASOURCES = \ + src/status-area-applet-tor.vala + +src/status-area-applet-tor.c: ${status_area_applet_tor_la_VALASOURCES} + ${VALAC} -C ${status_area_applet_tor_la_VALAFLAGS} $^ + +status_area_applet_tor_la_VALAFLAGS = --vapidir ./vapi --pkg config \ + --pkg conic --pkg gconf-2.0 --pkg hildon-1 --pkg libhildondesktop-1 \ + --pkg libosso --pkg posix +status_area_applet_tor_la_CFLAGS = ${HD_CFLAGS} ${GCONF_CFLAGS} ${CONIC_CFLAGS} \ + -DGETTEXT_PACKAGE=\"@GETTEXT_PACKAGE@\" +status_area_applet_tor_la_LIBADD = ${HD_LIBS} ${GCONF_LIBS} ${CONIC_LIBS} +status_area_applet_tor_la_LDFLAGS = -module -avoid-version + +ACLOCAL_AMFLAGS = -Im4 + +CLEANFILES = \ + ${status_area_applet_tor_SOURCES} diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..3676ffd --- /dev/null +++ b/autogen.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -x +glib-gettextize --copy --force +libtoolize --copy --automake +intltoolize --copy --force --automake + +aclocal-1.10 -Im4 +autoconf +autoheader +automake-1.10 --copy --add-missing --foreign +debian/rules config.status +./autovapi.sh diff --git a/autovapi.sh b/autovapi.sh new file mode 100755 index 0000000..05c8686 --- /dev/null +++ b/autovapi.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# Generate config.vapi from config.h +# +( +echo '// config.vapi. Generated from config.h by autovapi.sh.' +echo '[CCode (cheader_filename = "config.h")]' +echo 'namespace Config {' +sed -ne 's/#define \(HAVE_[A-Z_]*\) \([0-9]*\)$/\t\[CCode (cname = \"\1\"\)]\n\tconst bool \1;/p' -e 's/#define \([A-Z_]*\) \([0-9]*\)$/\t\[CCode (cname = \"\1\"\)]\n\tconst int \1;/p' -e 's/#define \([A-Z_]*\) \(\".*\"\)$/\t\[CCode (cname = \"\1\"\)]\n\tconst string \1;/p' < config.h +echo '}' +) > vapi/config.vapi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..aadb308 --- /dev/null +++ b/configure.ac @@ -0,0 +1,71 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(src/status-area-applet-tor.vala) +AC_CONFIG_HEADERS([config.h]) + +PACKAGE=status-area-applet-tor +VERSION=0.0.2 + +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +AC_PROG_CC +AM_PROG_VALAC([0.7.9]) +AC_STDC_HEADERS +AC_PROG_INSTALL +AC_PROG_LIBTOOL + +CFLAGS="$CFLAGS -Wall -ansi -Wmissing-prototypes -Wmissing-declarations" + +PKG_CHECK_MODULES(CONIC, conic >= 0.22) +AC_SUBST(CONIC_LIBS) +AC_SUBST(CONIC_CFLAGS) + +PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.16.0) +AC_SUBST(GCONF_LIBS) +AC_SUBST(GCONF_CFLAGS) + +PKG_CHECK_MODULES(HILDON, hildon-1 >= 2.2.0) +AC_SUBST(HILDON_LIBS) +AC_SUBST(HILDON_CFLAGS) + +PKG_CHECK_MODULES(HD, libhildondesktop-1 >= 2.1.37) +AC_SUBST(HD_LIBS) +AC_SUBST(HD_CFLAGS) + +PKG_CHECK_MODULES(OSSO, libosso >= 2.20) +AC_SUBST(OSSO_LIBS) +AC_SUBST(OSSO_CFLAGS) + +PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.78) +AC_SUBST(DBUS_LIBS) +AC_SUBST(DBUS_CFLAGS) + +PKG_CHECK_MODULES(OSSOSETTINGS, osso-af-settings >= 0.9.2) + +localedir=`$PKG_CONFIG osso-af-settings --variable=localedir` +icon48dir=`$PKG_CONFIG libhildondesktop-1 --variable=prefix`/share/icons/hicolor/48x48 +icon18dir=`$PKG_CONFIG libhildondesktop-1 --variable=prefix`/share/icons/hicolor/18x18 +hildondesktoplibdir=`$PKG_CONFIG libhildondesktop-1 --variable=hildondesktoplibdir` +hildonstatusmenudesktopentrydir=`$PKG_CONFIG libhildondesktop-1 --variable=hildonstatusmenudesktopentrydir` + +# Localization-related +AC_PROG_INTLTOOL([0.40.5]) +GETTEXT_PACKAGE=status-area-applet-tor +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of gettext package]) +ALL_LINGUAS="de" +AM_GLIB_GNU_GETTEXT +AC_SUBST(ALL_LINGUAS) +AC_SUBST(localedir) +AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir", [localedir]) + +AC_SUBST(icon48dir) +AC_SUBST(icon18dir) +AC_SUBST(hildondesktoplibdir) +AC_SUBST(hildonstatusmenudesktopentrydir) + +AC_OUTPUT([ + Makefile + po/Makefile.in + po/Makefile +]) diff --git a/m4/vala.m4 b/m4/vala.m4 new file mode 100644 index 0000000..d95734a --- /dev/null +++ b/m4/vala.m4 @@ -0,0 +1,29 @@ +# Autoconf support for the Vala compiler + +# Copyright (C) 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# Check whether the Vala compiler exists in `PATH'. If it is found, the +# variable VALAC is set. Optionally a minimum release number of the +# compiler can be requested. +# +# AM_PROG_VALAC([MINIMUM-VERSION]) +# -------------------------------- +AC_DEFUN([AM_PROG_VALAC], +[AC_PATH_PROG([VALAC], [valac], []) + AS_IF([test -z "$VALAC"], + [AC_MSG_WARN([No Vala compiler found. You will not be able to compile .vala source files.])], + [AS_IF([test -n "$1"], + [AC_MSG_CHECKING([$VALAC is at least version $1]) + am__vala_version=`$VALAC --version | sed 's/Vala *//'` + AS_VERSION_COMPARE([$1], ["$am__vala_version"], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Vala $1 not found.])])])]) +]) diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..cbb43d3 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1 @@ +src/status-area-applet-tor.vala diff --git a/src/status-area-applet-tor.vala b/src/status-area-applet-tor.vala index 51972b3..7647239 100644 --- a/src/status-area-applet-tor.vala +++ b/src/status-area-applet-tor.vala @@ -407,7 +407,7 @@ class TorStatusMenuItem : HD.StatusMenuItem { // Osso hook-up osso = new Osso.Context (STATUSMENU_TOR_LIBOSSO_SERVICE_NAME, - "0.0.1", + Config.VERSION, true, null); -- 1.7.9.5