Commit 86089d29 authored by Tom Dyas's avatar Tom Dyas
Browse files

Sync sync. Changed how Python LIBS are detecting as per sample code posted

by James Henstridge <james@daa.com.au>.

Perl plugin should hopefully now build but the Makefile.am is horrible in
terms of portability.

The Gnumeric Perl extension needs to be installed manually. After normal
build is done, just do "make install" in plugins/perl/ext.
parent 4ded61c3
......@@ -49,8 +49,14 @@ if $perl_val; then
AC_MSG_RESULT(yes)
dnl Use ExtUtils::Embed to figure out the other options.
PERL_CCCDLFLAGS=`perl -MConfig -e 'print $Config{cccdlflags},"\n";'`
PERL_LDDLFLAGS=`perl -MConfig -e 'print $Config{lddlflags},"\n";'`
PERL_LD=`perl -MConfig -e 'print $Config{ld},"\n";'`
PERL_CCOPTS=`perl -MExtUtils::Embed -e ccopts`
PERL_LDOPTS=`perl -MExtUtils::Embed -e ldopts`
AC_SUBST(PERL_CCCDLFLAGS)
AC_SUBST(PERL_LDDLFLAGS)
AC_SUBST(PERL_LD)
AC_SUBST(PERL_CCOPTS)
AC_SUBST(PERL_LDOPTS)
else
......@@ -66,18 +72,24 @@ dnl Check for Python
dnl
AC_CHECK_PROG(python_val, python, true, false)
if $python_val; then
PYTHON_PREFIX=`python -c 'import sys ; print sys.prefix'`
PYTHON_EXEC_PREFIX=`python -c 'import sys ; print sys.exec_prefix'`
PY_PREFIX=`python -c 'import sys ; print sys.prefix'`
PY_EXEC_PREFIX=`python -c 'import sys ; print sys.exec_prefix'`
changequote(<<, >>)dnl
PYTHON_VERSION=`python -c 'import sys ; print sys.version[0:3]'`
PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'`
changequote([, ])dnl
if test -f $PYTHON_PREFIX/include/python$PYTHON_VERSION/Python.h; then
PYTHON_LIBS="python$PYTHON_VERSION"
PYTHON_LIB_LOC="-L$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
PYTHON_CFLAGS="-I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_LIB_LOC)
AC_SUBST(PYTHON_CFLAGS)
if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
PY_LIBS="python$PY_VERSION"
PY_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
PY_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config/Makefile"
PY_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS"
AC_SUBST(PY_LIBS)
AC_SUBST(PY_LIB_LOC)
AC_SUBST(PY_CFLAGS)
AC_SUBST(PY_EXTRA_LIBS)
else
python_val=false
fi
......@@ -91,10 +103,16 @@ plugins/Makefile
plugins/sample/Makefile
plugins/python/Makefile
plugins/perl/Makefile
plugins/perl/ext/Makefile.PL
plugins/stat/Makefile
intl/Makefile
po/Makefile.in
macros/Makefile
stamp.h],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
stamp.h
],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
if test "x$perl_val" = "xtrue"; then
cd plugins/perl/ext
perl Makefile.PL LIB="${datadir}/gnumeric/perl/lib" >/dev/null 2>&1
cd ../../..
fi
#
# Makefile for the Python Gnumeric plugin.
#
#
# We should build in the extension subdirectory as well.
#
SUBDIRS = ext
#
# Where can we find the Gnumeric include files.
#
......@@ -10,29 +17,27 @@ GNUMERIC_SRC_DIR = $(srcdir)/../../src
#
plugindir = $(libdir)/gnumeric/plugins
# CFLAGS += -g -Wall \
# -Wshadow -Wpointer-arith \
# -Wmissing-prototypes -Wmissing-declarations
plugin_LTLIBRARIES = libperl.la
libperl_la_SOURCES = perl.c xsinit.c
xsinit.c:
perl -MExtUtils::Embed -e xsinit -- -o xsinit.c
INCLUDES = \
CFLAGS += $(PERL_CCCDLFLAGS) \
-I$(GNUMERIC_SRC_DIR) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
$(PERL_CCOPTS) \
$(GNOME_INCLUDEDIR)
libperl_la_LDADD = $(PERL_LDOPTS)
plugin_PROGRAMS = perl.so
.c.o:
$(CC) $(CFLAGS) -c $<
perl.so: perl.o xsinit.o
$(PERL_LD) $(PERL_LDDLFLAGS) -o perl.so perl.o xsinit.o $(PERL_LDOPTS)
xsinit.c:
perl -MExtUtils::Embed -e xsinit -- -o xsinit.c
Perlscriptsdir = $(datadir)/gnumeric/perl
Perlscripts_DATA = startup.pl
EXTRA_DIST = startup.pl
......@@ -17,25 +17,26 @@ static PerlInterpreter *gnumeric_perl_interp;
static int
no_unloading_for_me (PluginData *pd)
{
return 0;
return 0;
}
int
init_plugin(PluginData *pd)
{
char *argv[] = { "", NULL, NULL };
char *name;
/* Initialize Gnumeric plugin information. */
pd->can_unload = no_unloading_for_me;
pd->title = "Perl Plugin";
/* Initialize the Perl interpreter. */
argv[1] = gnome_unconditional_datadir_file("gnumeric/perl/startup.pl");
gnumeric_perl_interp = perl_alloc();
perl_construct(gnumeric_perl_interp);
perl_parse(gnumeric_perl_interp, xs_init, 2, argv, NULL);
perl_run(gnumeric_perl_interp);
g_free(argv[1]);
char *argv[] = { "", NULL, NULL, NULL };
char *name;
/* Initialize Gnumeric plugin information. */
pd->can_unload = no_unloading_for_me;
pd->title = "Perl Plugin";
/* Initialize the Perl interpreter. */
argv[1] = gnome_unconditional_datadir_file("gnumeric/perl/lib");
argv[2] = gnome_unconditional_datadir_file("gnumeric/perl/startup.pl");
gnumeric_perl_interp = perl_alloc();
perl_construct(gnumeric_perl_interp);
perl_parse(gnumeric_perl_interp, xs_init, 3, argv, NULL);
perl_run(gnumeric_perl_interp);
return 0;
}
......@@ -22,15 +22,14 @@ INCLUDES = \
-I$(GNUMERIC_SRC_DIR) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
$(PYTHON_CFLAGS) \
$(PY_CFLAGS) \
$(GNOME_INCLUDEDIR)
libpython_la_LDFLAGS = $(PYTHON_LIB_LOC)
libpython_la_LIBADD = -l$(PYTHON_LIBS) $(PTHREAD_LIB)
libpython_la_LDFLAGS = $(PY_LIB_LOC)
libpython_la_LIBADD = -l$(PY_LIBS) $(PY_EXTRA_LIBS)
Pythonscriptsdir = $(datadir)/gnumeric/python
Pythonscripts_DATA = gnumeric_startup.py
EXTRA_DIST = gnumeric_startup.py
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment