AUTOMAKE_OPTIONS=gnu
ACLOCAL_AMFLAGS=-I macros
-SUBDIRS=macros src po
+# Keep 'po' and 'init.d' before 'src' for our .gmo files bundling.
+SUBDIRS=macros po init.d src
## to automatically rebuild aclocal.m4 if any of the macros in
## `macros/' change
@MAINT@include macros/macros.dep
"COPYRIGHT_HOLDER"=>'Jan Kratochvil <project-udpgate@jankratochvil.net>',
"ARGV"=>\@ARGV,
"clean"=>[qw(
- .include_test_false.c
- .include_test_all.stamp
*.pod.pl *.pod *.[0-9]
./ChangeLog.bak
./debian/changelog
- ./doc/*-pod.*
+ ./init.d/udpgate
./src/udpgate
+ ./src/bundle.c
./src/ui-gnome-callbacks.[ch]
./src/ui-gnome-interface.[ch]
./src/ui-gnome-support.[ch]
AC_ARG_ENABLE(man-pages,
[ --enable-man-pages=no/yes/auto pod2man(1) required for man pages (def.=yes)],,enable_man_pages=yes)
+AC_ARG_ENABLE(bundle,
+ [ --enable-bundle Build single binary containing locale and init.d files (def.=no)],,enable_bundle=no)
+AM_CONDITIONAL(ENABLE_BUNDLE,[ test "x$enable_bundle" = "xyes" ])
+if test "x$enable_bundle" = "xyes"
+then
+ AC_DEFINE(ENABLE_BUNDLE,,[Build single binary containing locale and init.d files.])
+fi
+
PERL=
AC_PATH_PROGS(PERL,perl5 perl)
AM_CONDITIONAL(HAVE_PERL,test -n "$PERL")
./macros/glade-w.sh
Makefile
./macros/Makefile
+./init.d/Makefile
./src/Makefile
])
--- /dev/null
+# $Id$
+# automake source for UDP Gateway startup scripts Makefile
+# Copyright (C) 2004 Jan Kratochvil <project-udpgate@jankratochvil.net>
+#
+# This program 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; exactly version 2 of June 1991 is required
+#
+# This program 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
+
+
+include $(top_srcdir)/Makefile-head.am
+
+initddir=$(sysconfdir)/rc.d/init.d
+initd_SCRIPTS=udpgate
+EXTRA_DIST+=udpgate.init
+CLEANFILES+=udpgate
+udpgate: udpgate.init
+ $(LN_S) $< $@
+
--- /dev/null
+#! /bin/sh
+# Startup script for udpgate
+#
+# chkconfig: 2345 98 02
+# description: UDP packats gateway
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+[ -f /usr/sbin/udpgate ] || exit 0
+
+prog="udpgate"
+
+start() {
+ echo -n $"Starting $prog: "
+ daemon udpgate --start
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+stop() {
+ if test "x`pidof udpgate`" != x; then
+ echo -n $"Stopping $prog: "
+ killproc udpgate
+ echo
+ fi
+ RETVAL=$?
+ return $RETVAL
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ status)
+ status udpgate
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ condrestart)
+ if test "x`pidof udpgate`" != x; then
+ stop
+ start
+ fi
+ ;;
+
+ *)
+ echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+ exit 1
+
+esac
+
+exit $RETVAL
$(GLADE_OUT)
endif
+if ENABLE_BUNDLE
+
+nodist_udpgate_SOURCES=bundle.c
+
+BUNDLE_SRCS= \
+ bundle.h
+
+EXTRA_DIST+= \
+ bundle.pl
+
+# FIXME: GNU make(1) dependency by $(addprefix ...)
+bundle_files=$(top_srcdir)/init.d/$(PACKAGE).init $(addprefix $(top_builddir)/$(POSUB)/,$(CATALOGS))
+bundle.c: bundle.pl $(bundle_files)
+ $(PERL) bundle.pl $(bundle_files) >$@
+
+endif
+
udpgate_SOURCES= \
configuration.c \
configuration.h \
packet.h \
ui-line.c \
ui-line.h \
- $(GNOME_SRCS)
+ $(GNOME_SRCS) \
+ $(BUNDLE_SRCS)
EXTRA_DIST+= \
$(GLADE_IN)
--- /dev/null
+/* $Id$
+ * Include file for the bundled files with UDPGate.
+ * Copyright (C) 2004 Jan Kratochvil <project-udpgate@jankratochvil.net>
+ *
+ * This program 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; exactly version 2 of June 1991 is required
+ *
+ * This program 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 _UDPGATE_BUNDLE_H
+#define _UDPGATE_BUNDLE_H 1
+
+
+#include <glib/gtypes.h>
+#include <glib/ghash.h>
+
+
+G_BEGIN_DECLS
+
+GHashTable *bundle_hash_new(void);
+
+G_END_DECLS
+
+
+#endif /* _UDPGATE_BUNDLE_H */
--- /dev/null
+#! /usr/bin/perl
+#
+# $Id$
+# Perl generator for the bundled files with UDPGate.
+# Copyright (C) 2004 Jan Kratochvil <project-udpgate@jankratochvil.net>
+#
+# This program 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; exactly version 2 of June 1991 is required
+#
+# This program 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
+
+
+use vars qw($VERSION);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+use strict;
+use warnings;
+
+use File::Basename;
+
+
+print <<"EOH";
+/* AUTOGENERATED FILE! DO NOT EDIT!
+ * Bundled files with UDPGate.
+ */
+
+
+#include "config.h"
+
+#include <glib/ghash.h>
+
+#include "bundle.h" /* self */
+
+
+GHashTable *bundle_hash_new(void)
+{
+static GHashTable *hash;
+EOH
+my @files;
+for my $pathname (@ARGV) {
+ local *F;
+ open F,$pathname or die "Cannot open $pathname: $!";
+ local $/=undef();
+ my $F=<F>;
+ close F or warn "Cannot close $pathname: $!";
+ my $filename=basename $pathname;
+ (my $filename_sym=$filename)=~tr/a-zA-Z/_/c;
+ $filename_sym=~s/^_*//; # Prevent conflict with system internal symbols.
+ push @files,{
+ "filename" =>$filename,
+ "filename_sym"=>$filename_sym,
+ };
+ my $Fout=unpack "H*",$F;
+ $Fout=~s/../0x$&,/g;
+ $Fout=~s/(?:.....){1,16}/\t\t$&\n/g;
+ $Fout=~s/,\n$//;
+ print <<"EOH";
+static const guint8 ${filename_sym}_data[]={
+$Fout
+ };
+EOH
+ }
+print <<"EOH";
+
+ if (!hash) {
+ hash=g_hash_table_new(g_str_hash,g_str_equal);
+EOH
+ for (@files) {
+ print "\t\tg_hash_table_insert(hash,\"".$_->{"filename"}."\",(gpointer)".$_->{"filename_sym"}."_data);\n";
+ }
+print <<"EOH";
+ }
+ return hash;
+}
+
+/* EOF */
+EOH