diff options
author | Roger Leigh <rleigh@debian.org> | 2005-06-21 11:30:41 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2005-06-21 11:30:41 +0000 |
commit | f89e3c7c7268090f271443dc41093857d5d5e6e4 (patch) | |
tree | f7b78ae6d86b55b994fdf8b35755ad00213fbe8a | |
parent | 129ac3ff8bfdd46bb689052c890fd888caa61a22 (diff) | |
download | schroot-f89e3c7c7268090f271443dc41093857d5d5e6e4.tar.gz |
Summary:
Add autotools framework
Revision:
schroot--mainline--0.1.0--patch-1
- Add support for autoconf, automake and libtool.
- Add support for gtk-doc.
- Install schroot setuid root.
- Add --version option and embed version number in the output.
- Add AUTHORS and NEWS files.
- Generate ChangeLog with tla.
-rw-r--r-- | AUTHORS | 5 | ||||
-rw-r--r-- | Makefile.am | 27 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rwxr-xr-x | bootstrap | 19 | ||||
-rw-r--r-- | configure.ac | 99 | ||||
-rw-r--r-- | schroot/Makefile.am | 46 | ||||
-rw-r--r-- | schroot/schroot.c | 25 |
7 files changed, 220 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..8feed60b --- /dev/null +++ b/AUTHORS @@ -0,0 +1,5 @@ +The list of contributors, in alphabetical order, is as follows. The +principal areas that each contributed to are listed in addition. + +Roger Leigh <rleigh@debian.org> + Architecture, Coding diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..4f506bdf --- /dev/null +++ b/Makefile.am @@ -0,0 +1,27 @@ +# schroot Makefile template +# +# +# Copyright (C) 2004-2005 Roger Leigh <rleigh@debian.org> +# +# 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; either version 2 of the +# License, or (at your option) any later version. +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +##################################################################### + +SUBDIRS = schroot + +$(srcdir)/ChangeLog: + tla changelog >$@ + +.PHONY: ChangeLog @@ -0,0 +1 @@ +0.1.0 - Initial release. diff --git a/bootstrap b/bootstrap new file mode 100755 index 00000000..0b7e9d2c --- /dev/null +++ b/bootstrap @@ -0,0 +1,19 @@ +#!/bin/sh +if [ -d scripts ]; then + : +else + mkdir scripts +fi +echo "libtoolize" +libtoolize --force --copy +echo "gtkdocize" +gtkdocize --copy --docdir scripts +echo "aclocal" +aclocal +echo "autoheader" +autoheader +echo "automake" +automake --add-missing --gnu --force --copy +echo "autoconf" +autoconf + diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..93b10b1c --- /dev/null +++ b/configure.ac @@ -0,0 +1,99 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +dnl The minimum version of autoconf required. +AC_PREREQ(2.59) +dnl Initialise automake with the package name, version and +dnl bug-reporting address. +AC_INIT([schroot], [0.1.0], [rleigh@debian.org]) +dnl For safety, check we are in the right directory by +dnl checking for a known unique file. +AC_CONFIG_SRCDIR([schroot/sbuild-session.c]) +dnl Place auxilliary scripts here. +AC_CONFIG_AUX_DIR([scripts]) +dnl Put macro definitions here (though they aren't used). +AC_CONFIG_HEADER([config.h]) + +dnl Initialise automake stuff. +AM_INIT_AUTOMAKE(1.9 gnu check-news dist-bzip2 no-dist-gzip tar-pax) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +dnl AC_PROG_CC_C99 +AC_PROG_LIBTOOL +AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) +AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) +GTK_DOC_CHECK([1.2]) +# Checks for libraries. +PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4.0]) + +SCHROOT_CFLAGS="$GOBJECT_CFLAGS" +AC_SUBST([SCHROOT_CFLAGS]) + +# Checks for header files (none at the moment). + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL + +# Checks for library functions (none at the moment). +AC_CHECK_LIB([pam], [pam_authenticate], + [PAM_LIBS="-lpam"], + [AC_MSG_ERROR([Linux-PAM is not installed, but is required by schroot])]) +AC_CHECK_LIB([pam_misc], [pam_getenvlist], + [PAM_LIBS="${PAM_LIBS} -lpam_misc"], + [AC_MSG_ERROR([Linux-PAM is not installed, but is required by schroot])]) +AC_SUBST([PAM_LIBS]) + +dnl Set PACKAGE_LOCALE_DIR in config.h +AH_TEMPLATE(PACKAGE_LOCALE_DIR,, [Package locale directory]) +if test "x${prefix}" = "xNONE"; then + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, ["${ac_default_prefix}/share/locale"]) +else + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, ["${prefix}/share/locale"]) +fi + +dnl Set PACKAGE_DATA_DIR in config.h. +AH_TEMPLATE(PACKAGE_DATA_DIR,, [Package data directory]) +if test "x${datadir}" = 'x${prefix}/share'; then + if test "x${prefix}" = "xNONE"; then + PACKAGE_DATA_DIR="${ac_default_prefix}/share/${PACKAGE}" + else + PACKAGE_DATA_DIR="${prefix}/share/${PACKAGE}" + fi +else + PACKAGE_DATA_DIR="${datadir}/${PACKAGE}" +fi + +AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${PACKAGE_DATA_DIR}") + +dnl Set PACKAGE_LIB_DIR in config.h. +AH_TEMPLATE(PACKAGE_LIB_DIR,, [Package lib directory]) +if test "x${libdir}" = 'x${exec_prefix}/lib'; then + if test "x${exec_prefix}" = "xNONE"; then + if test "x${prefix}" = "xNONE"; then + PACKAGE_LIB_DIR="${ac_default_prefix}/lib/${PACKAGE}" + else + PACKAGE_LIB_DIR="${prefix}/lib/${PACKAGE}" + fi + else + PACKAGE_LIB_DIR="${exec_prefix}/lib/${PACKAGE}" + fi +else + PACKAGE_LIB_DIR="${libdir}/${PACKAGE}" +fi + +AH_TEMPLATE(SCHROOT_DATADIR,, [Package data directory]) +SCHROOT_DATADIR="${PACKAGE_DATA_DIR}/${PACKAGE_VERSION}" +AC_DEFINE_UNQUOTED(SCHROOT_DATADIR, ["$SCHROOT_DATADIR"], ) + +AH_TEMPLATE(SCHROOT_MODULEDIR,, [Package module directory]) +SCHROOT_MODULEDIR="${PACKAGE_LIB_DIR}/${PACKAGE_VERSION}/modules" +AC_DEFINE_UNQUOTED(SCHROOT_MODULEDIR, ["$SCHROOT_MODULEDIR"]) + + +dnl Configure which files to generate. +AC_CONFIG_FILES([schroot/Makefile]) +AC_CONFIG_FILES([Makefile]) +dnl Output the generated config.status script. +AC_OUTPUT diff --git a/schroot/Makefile.am b/schroot/Makefile.am new file mode 100644 index 00000000..fca01756 --- /dev/null +++ b/schroot/Makefile.am @@ -0,0 +1,46 @@ +# schroot Makefile template +# +# +# Copyright (C) 2004-2005 Roger Leigh <rleigh@debian.org> +# +# 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; either version 2 of the +# License, or (at your option) any later version. +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +##################################################################### + +AM_CFLAGS = -std=c99 +DEFS = -DSCHROOT_CONFIG_FILE="\"$(sysconfdir)/schroot.conf\"" + +bin_PROGRAMS = schroot + +schroot_SOURCES = \ + schroot.c \ + sbuild-chroot.h \ + sbuild-chroot.c \ + sbuild-config.h \ + sbuild-config.c \ + sbuild-session.h \ + sbuild-session.c + +schroot_CFLAGS = $(AM_CFLAGS) $(SCHROOT_CFLAGS) +schroot_LDADD = $(GOBJECT_LIBS) $(PAM_LIBS) + +sysconf_DATA = schroot.conf + +EXTRA_DIST = $(sysconf_DATA) + +install-exec-hook: +# Install setuid root. + chmod 4755 $(DESTDIR)$(bindir)/schroot + diff --git a/schroot/schroot.c b/schroot/schroot.c index 922f17a6..0ce92130 100644 --- a/schroot/schroot.c +++ b/schroot/schroot.c @@ -18,6 +18,8 @@ * *********************************************************************/ +#include <config.h> + #define _GNU_SOURCE #include <stdlib.h> #include <stdio.h> @@ -39,6 +41,7 @@ static struct { gboolean list; gboolean info; gboolean all; + gboolean version; } opt = { .chroots = NULL, @@ -48,7 +51,8 @@ static struct { .quiet = FALSE, .list = FALSE, .info = FALSE, - .all = FALSE + .all = FALSE, + .version = FALSE }; static GOptionEntry entries[] = @@ -60,6 +64,7 @@ static GOptionEntry entries[] = { "info", 'i', 0, G_OPTION_ARG_NONE, &opt.info, "Show information about chroot", NULL }, { "preserve-environment", 'p', 0, G_OPTION_ARG_NONE, &opt.preserve, "Preserve user environment", NULL }, { "quiet", 'q', 0, G_OPTION_ARG_NONE, &opt.quiet, "Show less output", NULL }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &opt.version, "Print version information", NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt.command, NULL, NULL } }; @@ -74,6 +79,16 @@ parse_options(int argc, g_option_context_parse (context, &argc, &argv, &error); } +void +print_version (FILE *file) +{ + g_fprintf(file, "schroot (Debian sbuild) %s\n", VERSION); + g_fprintf(file, "Written by Roger Leigh\n\n"); + g_fprintf(file, "Copyright © 2004-2005 Roger Leigh\n"); + g_fprintf(file, "This is free software; see the source for copying conditions. There is NO\n"); + g_fprintf(file, "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); +} + char ** get_chroot_options(SbuildConfig *config) { @@ -119,8 +134,14 @@ main (int argc, /* Parse command-line options into opt structure. */ parse_options(argc, argv); + if (opt.version == TRUE) + { + print_version(stdout); + exit(EXIT_SUCCESS); + } + /* Initialise chroot configuration. */ - SbuildConfig *config = sbuild_config_new("test.conf"); + SbuildConfig *config = sbuild_config_new(SCHROOT_CONFIG_FILE); g_assert (config != NULL); /* Print chroot list (including aliases). */ |