autoconf macro for gimptool
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
autoconf macro for gimptool | Roger Leigh | 30 Sep 13:43 |
autoconf macro for gimptool
If you write a plugin as a single C file, gimptool can be used to build and install it. However, things get a little harder when you want to use make to build a bigger plugin, such as the Print plugin.
You might find the following macros useful, perhaps with a little tweaking. They are modified versions of macros used in gimp-print. Just put GIMP_PLUG_IN_DIR in configure.ac, and then you can use
gimp_plug_in_PROGRAMS = myplugin myplugin_SOURCES = foo.c foo.h bar.c bar.h baz.c baz.h
in a Makefile.am, and use the automake/libtool framework instead of custom install rules using gimptool (which won't be pretty when using libtool). You can also use --enable-user-install to install into a home directory instead. autoconf >= 2.50 is required.
Regards, Roger
--------begin m4 macros--------
# This file is part of the GIMP -*- Autoconf -*-
# gimptool support.
# Copyright 2000-2002 Roger Leigh
#
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
## Table of Contents:
## 1. User install
## 1. Plug-in directory
## --------------- ##
## 1. User install ##
## --------------- ##
# GIMP_PLUG_IN_INSTALL
# --------------------
# Install in system or home directory
AC_DEFUN([GIMP_PLUG_IN_INSTALL],
[dnl
AC_MSG_CHECKING([whether to install GIMP plugins in home directory])
AC_ARG_ENABLE([user-install],
[AC_HELP_STRING([--enable-user-install],
[install GIMP plugins in home directory @@])],
[case "${enableval}" in
yes) USER_INSTALL="yes" ; AC_MSG_RESULT([yes]) ;;
no) USER_INSTALL="no" ; AC_MSG_RESULT([no]) ;;
*) AC_MSG_RESULT([unknown])
AC_MSG_ERROR([bad value ${enableval} for --enable-user-install]) ;;
esac],
[AC_MSG_RESULT([no])
USER_INSTALL="no"])
if test x$USER_INSTALL = xyes ; then
PLUG_IN_PATH="bin"
else
PLUG_IN_PATH="admin-bin"
fi
])
## -------------------- ##
## 2. Plug-in directory ##
## -------------------- ##
# GIMP_PLUG_IN_DIR
# --------------------
# Locate the GIMP plugin directory using gimptool
AC_DEFUN([GIMP_PLUG_IN_DIR],
[dnl Extract directory using --dry-run and sed
AC_REQUIRE([GIMP_PLUG_IN_INSTALL])
if test x${BUILD_GIMP} = xyes ; then
AC_PATH_PROG(GIMPTOOL, gimptool)
AC_MSG_CHECKING([for GIMP plug-in directory])
# create temporary "plug-in" to install
touch tmpplugin
chmod 755 tmpplugin
GIMPTOOL_OUTPUT=`$GIMPTOOL --dry-run --install-${PLUG_IN_PATH} tmpplugin`
rm tmpplugin
gimp_plug_indir=`echo "$GIMPTOOL_OUTPUT" | sed -e 's/.* \(.*\)\/tmpplugin/\1/'`
AC_MSG_RESULT([$gimp_plug_indir])
else
gimp_plug_indir="$libdir/gimp/1.2/plug-ins"
fi
AC_SUBST(gimp_plug_indir)
])
--------end m4 macros--------