usage of pkg-config to get library information in configure; automake for the

python module;
This commit is contained in:
Frédéric Péters 2004-07-22 17:00:23 +00:00
parent bc8081c0cd
commit 71e99e47e3
17 changed files with 224 additions and 474 deletions

View File

@ -1,6 +1,7 @@
dll:
-/usr/bin/windres -i win32/lasso.rc -o win32/lasso.rc.o
-/usr/bin/dllwrap.exe --target=i386-mingw32 --def win32/lasso.def -o lasso/.libs/liblasso.dll -mno-cygwin --add-stdcall-alias -mwindows -s lasso/lasso.o win32/lasso.rc.o lasso/xml/.libs/liblasso-xml.al lasso/protocols/.libs/liblasso-protocols.al lasso/environs/.libs/liblasso-environs.al -L/usr/local/lib /usr/local/lib/libglib-2.0-0.dll /usr/local/lib/libxmlsec-openssl.dll /usr/local/lib/libxmlsec.dll -lssl -lcrypto /usr/local/lib/libxslt.dll /usr/local/lib/libxml2.dll -lpthread -lz -lm /usr/local/lib/libgobject-2.0-0.dll
install-dll:
-cp -f lasso/.libs/liblasso.dll /usr/local/lib
-cp -f lasso/.libs/liblasso.a /usr/local/lib/liblasso.dll.a
@ -15,9 +16,7 @@ install-dll:
-mkdir -p /usr/local/include/lasso/xml
-cp -f lasso/xml/*.h /usr/local/include/lasso/xml
SUBDIRS = lasso docs
SUBDIRS = lasso docs python
ABS_BUILDDIR = $(shell pwd)

View File

@ -156,196 +156,10 @@ else
fi
fi
dnl ==========================================================================
dnl find glib
dnl ==========================================================================
if test "$GLIB_FOUND" = "no"; then
GLIB_MIN_VERSION="2.2.3"
GLIB_CONFIG="glib-config"
GLIB_CFLAGS=""
GLIB_LIBS=""
AC_ARG_WITH(glib, [ --with-glib=[PFX] glib location])
if test "z$with_glib" = "zno" ; then
AC_MSG_CHECKING(for glib libraries >= $GLIB_MIN_VERSION)
AC_MSG_ERROR(glib >= $GLIB_MIN_VERSION is required for $PACKAGE)
elif test "z$with_glib" = "z" -a "z$PKG_CONFIG_ENABLED" = "zyes" ; then
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_MIN_VERSION,
[GLIB_FOUND=yes],
[GLIB_FOUND=no])
fi
fi
if test "z$GLIB_FOUND" = "zno" ; then
AC_MSG_CHECKING(for glib libraries >= $GLIB_MIN_VERSION)
if test "z$with_glib" != "z" ; then
GLIB_CONFIG=$with_glib/bin/$GLIB_CONFIG
fi
if ! $GLIB_CONFIG --version > /dev/null 2>&1 ; then
AC_MSG_ERROR(Could not find glib anywhere (see config.log for details).)
fi
vers=`$GLIB_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $GLIB_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
GLIB_LIBS="`$GLIB_CONFIG --libs`"
GLIB_CFLAGS="`$GLIB_CONFIG --cflags`"
GLIB_FOUND="yes"
AC_MSG_RESULT(yes ('$GLIB_VERSION'))
else
AC_MSG_ERROR(You need at least glib $GLIB_MIN_VERSION for this version of $PACKAGE)
fi
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CONFIG)
AC_SUBST(GLIB_MIN_VERSION)
dnl ==========================================================================
dnl find libxml
dnl ==========================================================================
if test "z$LIBXML_FOUND" = "zno" ; then
LIBXML_MIN_VERSION="2.4.2"
LIBXML_CONFIG="xml2-config"
LIBXML_CFLAGS=""
LIBXML_LIBS=""
AC_ARG_WITH(libxml, [ --with-libxml=[PFX] libxml2 location])
if test "z$with_libxml" = "zno" ; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION)
AC_MSG_ERROR(libxml2 >= $LIBXML_MIN_VERSION is required for $PACKAGE)
elif test "z$with_libxml" = "z" -a "z$PKG_CONFIG_ENABLED" = "zyes" ; then
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_MIN_VERSION,
[LIBXML_FOUND=yes],
[LIBXML_FOUND=no])
PKG_CHECK_MODULES(LIBXML262, libxml-2.0 >= 2.6.2,
[LIBXML262_FOUND=yes],
[LIBXML262_FOUND=no])
fi
fi
if test "z$LIBXML_FOUND" = "zno" ; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION)
if test "z$with_libxml" != "z" ; then
LIBXML_CONFIG=$with_libxml/bin/$LIBXML_CONFIG
fi
if ! $LIBXML_CONFIG --version > /dev/null 2>&1 ; then
AC_MSG_ERROR(Could not find libxml2 anywhere (see config.log for details).)
fi
vers=`$LIBXML_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $LIBXML_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
LIBXML_LIBS="`$LIBXML_CONFIG --libs`"
LIBXML_CFLAGS="`$LIBXML_CONFIG --cflags`"
LIBXML_FOUND="yes"
if test "$vers" -ge "2006002" ; then
LIBXML262_FOUND="yes"
fi
AC_MSG_RESULT(yes ('$LIBXML_VERSION'))
else
AC_MSG_ERROR(You need at least libxml2 $LIBXML_MIN_VERSION for this version of $PACKAGE)
fi
fi
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)
AC_SUBST(LIBXML_CONFIG)
AC_SUBST(LIBXML_MIN_VERSION)
dnl ==========================================================================
dnl find libxslt
dnl ==========================================================================
LASSO_NO_LIBXSLT="1"
if test "z$LIBXSLT_FOUND" = "zno" ; then
LIBXSLT_MIN_VERSION=1.0.20
LIBXSLT_CONFIG="xslt-config"
LIBXSLT_CFLAGS=""
LIBXSLT_LIBS=""
AC_ARG_WITH(libxslt, [ --with-libxslt=[PFX] libxslt location])
if test "z$with_libxslt" = "zno" ; then
AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_MIN_VERSION)
AC_MSG_RESULT(no)
LIBXSLT_FOUND="without"
elif test "z$with_libxslt" = "z" -a "z$PKG_CONFIG_ENABLED" = "zyes" ; then
PKG_CHECK_MODULES(LIBXSLT, libxslt >= $LIBXSLT_MIN_VERSION,
[LIBXSLT_FOUND=yes],
[LIBXSLT_FOUND=no])
fi
fi
if test "z$LIBXSLT_FOUND" = "zno" ; then
AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_MIN_VERSION)
if test "z$LIBXSLT_CONFIG" != "z" ; then
LIBXSLT_CONFIG=$with_libxslt/bin/$LIBXSLT_CONFIG
fi
if ! $LIBXSLT_CONFIG --version > /dev/null 2>&1 ; then
if test "z$with_libxslt" != "z" ; then
AC_MSG_ERROR(Unable to find libxslt at '$with_libxslt')
else
AC_MSG_RESULT(no)
fi
else
vers=`$LIBXSLT_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $LIBXSLT_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
LIBXSLT_LIBS="`$LIBXSLT_CONFIG --libs`"
LIBXSLT_CFLAGS="`$LIBXSLT_CONFIG --cflags`"
AC_MSG_RESULT(yes ('$LIBXSLT_VERSION'))
else
AC_MSG_ERROR(You need at least libxslt $LIBXSLT_MIN_VERSION for this version of $PACKAGE)
fi
fi
fi
if test "z$LIBXSLT_FOUND" = "zyes" ; then
LASSO_NO_LIBXSLT="0"
else
LASSO_DEFINES="$LASSO_DEFINES -DLASSO_NO_XSLT=1"
fi
AC_SUBST(LASSO_NO_LIBXSLT)
AC_SUBST(LIBXSLT_CFLAGS)
AC_SUBST(LIBXSLT_LIBS)
AC_SUBST(LIBXSLT_CONFIG)
AC_SUBST(LIBXSLT_MIN_VERSION)
dnl ==========================================================================
dnl find xmlsec1
dnl ==========================================================================
if test "z$XMLSEC1_FOUND" = "zno" ; then
XMLSEC1_MIN_VERSION="1.2.4"
XMLSEC1_CONFIG="xmlsec1-config"
XMLSEC1_CFLAGS=""
XMLSEC1_LIBS=""
AC_ARG_WITH(xmlsec1, [ --with-xmlsec1=[PFX] xmlsec1 location])
if test "z$with_xmlsec1" = "zno" ; then
AC_MSG_CHECKING(for xmlsec1 libraries >= $XMLSEC1_MIN_VERSION)
AC_MSG_ERROR(xmlsec1 >= $XMLSEC1_MIN_VERSION is required for $PACKAGE)
elif test "z$with_xmlsec1" = "z" -a "z$PKG_CONFIG_ENABLED" = "zyes" ; then
PKG_CHECK_MODULES(XMLSEC1, xmlsec1 >= $XMLSEC1_MIN_VERSION,
[XMLSEC1_FOUND=yes],
[XMLSEC1_FOUND=no])
fi
fi
if test "z$XMLSEC1_FOUND" = "zno" ; then
AC_MSG_CHECKING(for xmlsec1 libraries >= $XMLSEC1_MIN_VERSION)
if test "z$with_xmlsec1" != "z" ; then
XMLSEC1_CONFIG=$with_xmlsec1/bin/$XMLSEC1_CONFIG
fi
if ! $XMLSEC1_CONFIG --version > /dev/null 2>&1 ; then
AC_MSG_ERROR(Could not find xmlsec1 anywhere (see config.log for details).)
fi
vers=`$XMLSEC1_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $XMLSEC1_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
XMLSEC1_LIBS="`$XMLSEC1_CONFIG --libs`"
XMLSEC1_CFLAGS="`$XMLSEC1_CONFIG --cflags`"
XMLSEC1_VERSION="`$XMLSEC1_CONFIG --version`"
XMLSEC1_FOUND="yes"
AC_MSG_RESULT(yes ('$XMLSEC1_VERSION'))
else
AC_MSG_ERROR(You need at least xmlsec1 $XMLSEC1_MIN_VERSION for this version of $PACKAGE)
fi
fi
PKG_CHECK_MODULES(LASSO, glib-2.0 gobject-2.0 libxml-2.0 libxslt xmlsec1 xmlsec1-openssl)
AC_SUBST(LASSO_LIBS)
AC_SUBST(LASSO_CFLAGS)
dnl find xmlsec crypto library (openssl) if not under Windows(c)
if test "z$CWINDOWS" = "zno" ; then
@ -365,10 +179,43 @@ if test "z$CWINDOWS" = "zno" ; then
fi
fi
AC_SUBST(XMLSEC1_CFLAGS)
AC_SUBST(XMLSEC1_LIBS)
AC_SUBST(XMLSEC1_CONFIG)
AC_SUBST(XMLSEC1_MIN_VERSION)
dnl ==========================================================================
dnl python
dnl ==========================================================================
AC_CHECK_PROG(python_val, python, true, false)
if $python_val; then
AC_MSG_CHECKING(for Python development files)
PY_PREFIX=`python -c 'import sys ; print sys.prefix'`
PY_EXEC_PREFIX=`python -c 'import sys ; print sys.exec_prefix'`
changequote(<<, >>)dnl
PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'`
changequote([, ])dnl
PYTHON_H=$PY_PREFIX/include/python$PY_VERSION/Python.h
LIBPYTHON_SO=$PY_PREFIX/lib/libpython$PY_VERSION.so
if test -f $PYTHON_H; then
AC_MSG_RESULT(yes)
PYTHON="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_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS"
PY_DYNLOAD="$PY_EXEC_PREFIX/lib/python$PY_VERSION/lib-dynload"
PY_LIB_A="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config/libpython$PY_VERSION.a"
PY_SITE_PACKAGES="$PY_EXEC_PREFIX/lib/python$PY_VERSION/site-packages"
AC_SUBST(PYTHON)
AC_SUBST(PY_LIB_LOC)
AC_SUBST(PY_CFLAGS)
AC_SUBST(PY_EXTRA_LIBS)
AC_SUBST(PY_DYNLOAD)
AC_SUBST(PY_LIB_A)
AC_SUBST(PY_SITE_PACKAGES)
else
AC_MSG_RESULT("no")
fi
fi
dnl ==========================================================================
dnl find gtk-doc
@ -479,8 +326,8 @@ LASSO_CORE_LIBS="-llasso "
AC_SUBST(LASSO_CORE_CFLAGS)
AC_SUBST(LASSO_CORE_LIBS)
LASSO_CFLAGS="$LASSO_CORE_CFLAGS $GLIB_CFLAGS $LIBXML_CFLAGS $LIBXSLT_CFLAGS $XMLSEC1_CFLAGS $LASSO_CRYPTO_CFLAGS"
LASSO_LIBS="-L${libdir} $LASSO_CRYPTO_LIB $LASSO_CORE_LIBS $GLIB_LIBS $LIBXML_LIBS $LIBXSLT_LIBS $XMLSEC1_LIBS $LASSO_CRYPTO_LIBS"
LASSO_CFLAGS="$LASSO_CORE_CFLAGS $LASSO_CFLAGS"
LASSO_LIBS="-L${libdir} $LASSO_LIBS"
AC_SUBST(LASSO_CFLAGS)
AC_SUBST(LASSO_LIBS)
@ -513,6 +360,15 @@ lasso/protocols/elements/Makefile
lasso/environs/Makefile
docs/Makefile
docs/reference/Makefile
python/Makefile
python/doc/Makefile
python/doc/tutorial/Makefile
python/environs/Makefile
python/examples/Makefile
python/protocols/Makefile
python/protocols/elements/Makefile
python/tests/Makefile
python/xml/Makefile
]
[lasso.pc:lasso.pc.in]
dnl [lasso-config:lasso-config.in]

View File

@ -6,20 +6,14 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(GLIB_CFLAGS) \
$(LIBXSLT_CFLAGS) \
$(LIBXML_CFLAGS) \
$(XMLSEC1_CFLAGS) \
$(LASSO_CFLAGS) \
-DG_LOG_DOMAIN=\"lasso\"
noinst_LTLIBRARIES = liblasso-protocols.la
liblasso_protocols_la_LIBADD = \
$(top_builddir)/lasso/protocols/elements/liblasso-elements.la \
$(GLIB_LIBS) \
$(LIBXSLT_LIBS) \
$(LIBXML_LIBS) \
$(XMLSEC1_LIBS)
$(LASSO_LIBS)
liblasso_protocols_la_SOURCES = \
protocols.c \

View File

@ -4,10 +4,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(GLIB_CFLAGS) \
$(LIBXSLT_CFLAGS) \
$(LIBXML_CFLAGS) \
$(XMLSEC1_CFLAGS) \
$(LASSO_CFLAGS) \
-DG_LOG_DOMAIN=\"lasso\"
noinst_LTLIBRARIES = liblasso-elements.la

View File

@ -8,10 +8,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(GLIB_CFLAGS) \
$(LIBXSLT_CFLAGS) \
$(LIBXML_CFLAGS) \
$(XMLSEC1_CFLAGS) \
$(LASSO_CFLAGS) \
$(NULL)
EXTRA_DIST = \
@ -35,10 +32,7 @@ liblasso_la_LIBADD = \
$(top_builddir)/lasso/xml/liblasso-xml.la \
$(top_builddir)/lasso/protocols/liblasso-protocols.la \
$(top_builddir)/lasso/environs/liblasso-environs.la \
$(GLIB_LIBS) \
$(LIBXSLT_LIBS) \
$(LIBXML_LIBS) \
$(XMLSEC1_LIBS) \
$(LASSO_LIBS) \
$(NULL)
liblasso_la_LDFLAGS = \

View File

@ -6,10 +6,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(GLIB_CFLAGS) \
$(LIBXSLT_CFLAGS) \
$(LIBXML_CFLAGS) \
$(XMLSEC1_CFLAGS) \
$(LASSO_CFLAGS) \
-DG_LOG_DOMAIN=\"lasso\"
noinst_LTLIBRARIES = liblasso-environs.la

View File

@ -4,10 +4,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(GLIB_CFLAGS) \
$(LIBXSLT_CFLAGS) \
$(LIBXML_CFLAGS) \
$(XMLSEC1_CFLAGS) \
$(LASSO_CFLAGS) \
-DG_LOG_DOMAIN=\"lasso\"
noinst_LTLIBRARIES = liblasso-xml.la

31
python/Makefile.am Normal file
View File

@ -0,0 +1,31 @@
SUBDIRS = doc environs examples protocols tests xml
INCLUDES = \
-DPACKAGE=\"@PACKAGE@\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(LASSO_CFLAGS) \
$(PY_CFLAGS)
pythondir = $(PY_DYNLOAD)
python_LTLIBRARIES = lassomod.la
pythonspdir = $(PY_SITE_PACKAGES)
pythonsp_DATA = lasso.py lasso_strings.py
mylibs = $(top_builddir)/lasso/liblasso.la
lassomod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/lasso/.libs
lassomod_la_SOURCES = lassomod.c py_lasso.c utils.c wrap_objs.c
lassomod_la_LIBADD = $(mylibs) \
./protocols/elements/libelements.a \
./protocols/libprotocols.a \
./xml/libxml.a \
./environs/libenvirons.a
EXTRA_DIST = lassomod.h py_lasso.h utils.h wrap_objs.h \
generator_lasso_strings.py lasso.py lasso_strings.py setup.py

6
python/doc/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
SUBDIRS = tutorial
EXTRA_DIST = doxygen.conf pythfilter.py
all:

View File

@ -0,0 +1,7 @@
EXTRA_DIST = sp-init.py \
sp-login-process-authn-response.py \
sp-login-send-authn-request.py \
sp-logout-process-idp-initiated-redirect-request.py \
sp-logout-process-idp-initiated-soap-request.py \
sp-logout-process-response.py \
sp-logout-send-request.py

View File

@ -0,0 +1,16 @@
noinst_LIBRARIES = libenvirons.a
INCLUDES = \
-DPACKAGE=\"@PACKAGE@\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(LASSO_CFLAGS) \
$(PY_CFLAGS) \
$(NULL)
libenvirons_a_SOURCES = py_federation_termination.c py_login.c py_logout.c py_profile_context.c py_register_name_identifier.c py_server.c py_user.c
EXTRA_DIST = py_federation_termination.h py_login.h py_logout.h py_profile_context.h py_register_name_identifier.h py_server.h py_user.h

View File

@ -0,0 +1,9 @@
EXTRA_DIST = \
defederation.py \
login.py \
logout-from-idp.py \
logout.py \
mapping.py \
registration.py \
test.py \
user.py

View File

@ -0,0 +1,35 @@
SUBDIRS = elements
INCLUDES = \
-DPACKAGE=\"@PACKAGE@\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(LASSO_CFLAGS) \
$(PY_CFLAGS) \
$(NULL)
noinst_LIBRARIES = libprotocols.a
libprotocols_a_SOURCES = \
py_authn_request.c \
py_authn_response.c \
py_federation_termination_notification.c \
py_logout_request.c \
py_logout_response.c \
py_name_identifier_mapping_request.c \
py_name_identifier_mapping_response.c \
py_register_name_identifier_request.c \
py_register_name_identifier_response.c
EXTRA_DIST = \
py_authn_request.h \
py_authn_response.h \
py_federation_termination_notification.h \
py_logout_request.h \
py_logout_response.h \
py_name_identifier_mapping_request.h \
py_name_identifier_mapping_response.h \
py_register_name_identifier_request.h \
py_register_name_identifier_response.h

View File

@ -0,0 +1,15 @@
noinst_LIBRARIES = libelements.a
INCLUDES = \
-DPACKAGE=\"@PACKAGE@\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(LASSO_CFLAGS) \
$(PY_CFLAGS) \
$(NULL)
noinst_LIBRARIES = libelements.a
libelements_a_SOURCES = py_assertion.c py_authentication_statement.c
EXTRA_DIST = py_assertion.h py_authentication_statement.h

View File

@ -1,247 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# $Id$
#
# PyLasso - Python bindings for Lasso library
#
# Copyright (C) 2004 Entr'ouvert
# http://lasso.entrouvert.org
#
# Author: Valéry Febvre <vfebvre@easter-eggs.com>
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
__doc__ = """Python bindings for Lasso Library
PyLasso is a set of Python bindings for Lasso Library.
"""
classifiers = """\
Development Status :: 2 - Pre-Alpha
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License (GPL)
Operating System :: POSIX
Programming Language :: C
Programming Language :: Python
Topic :: Software Development :: Libraries :: Python Modules
"""
from distutils.core import setup, Extension
import sys, commands
# check python version
if not hasattr(sys, 'version_info') or sys.version_info < (2,2):
raise SystemExit, "PyLasso requires Python version 2.2 or above."
# sanity check for any arguments
if len(sys.argv) == 1:
msg = 'Choose an action :\n' \
' 1. Build module\n' \
' 2. Build documentation\n' \
' 3. Install\n' \
' 4. Clean\n' \
' 5. Exit\n' \
'Your choice : '
reply = raw_input(msg)
choice = None
if reply:
choice = reply[0]
if choice == '1':
sys.argv.append('build')
elif choice == '2':
print commands.getoutput('doxygen doc/doxygen.conf')
sys.exit(0)
elif choice == '3':
sys.argv.append('install')
elif choice == '4':
sys.argv.append('clean')
sys.argv.append('-a')
elif choice == '5':
sys.exit(0)
# the crypto engine name : openssl, gnutls or nss
xmlsec1_crypto = "openssl"
if 'build' in sys.argv:
msg = '\nChoose a crypto engine :\n' \
' 1. OpenSSL\n' \
' 2. GnuTLS\n' \
' 3. NSS\n' \
'Your choice : '
reply = raw_input(msg)
choice = None
if reply:
choice = reply[0]
if choice == '1':
xmlsec1_crypto = "openssl"
elif choice == '2':
xmlsec1_crypto = "gnutls"
elif choice == '3':
xmlsec1_crypto = "nss"
define_macros = []
include_dirs = []
library_dirs = []
libraries = []
def extract_cflags(cflags):
global define_macros, include_dirs
list = cflags.split(' ')
for flag in list:
if flag == '':
continue
flag = flag.replace("\\\"", "")
if flag[:2] == "-I":
if flag[2:] not in include_dirs:
include_dirs.append(flag[2:])
elif flag[:2] == "-D":
t = tuple(flag[2:].split('='))
if t not in define_macros:
define_macros.append(t)
else:
print "Warning : cflag %s skipped" % flag
def extract_libs(libs):
global library_dirs, libraries
list = libs.split(' ')
for flag in list:
if flag == '':
continue
if flag[:2] == "-l":
if flag[2:] not in libraries:
libraries.append(flag[2:])
elif flag[:2] == "-L":
if flag[2:] not in library_dirs:
library_dirs.append(flag[2:])
else:
print "Warning : linker flag %s skipped" % flag
# GObject
gobject_cflags = commands.getoutput('pkg-config gobject-2.0 --cflags')
if gobject_cflags[:2] not in ["-I", "-D"]:
print "Error : cannot get GObject pre-processor and compiler flags"
gobject_libs = commands.getoutput('pkg-config gobject-2.0 --libs')
if gobject_libs[:2] not in ["-l", "-L"]:
print "Error : cannot get GObject linker flags"
# LibXML2
libxml2_cflags = commands.getoutput('pkg-config libxml-2.0 --cflags')
if libxml2_cflags[:2] not in ["-I", "-D"]:
libxml2_cflags = commands.getoutput('xml2-config --cflags')
if libxml2_cflags[:2] not in ["-I", "-D"]:
print "Error : cannot get LibXML2 pre-processor and compiler flags"
libxml2_libs = commands.getoutput('pkg-config libxml-2.0 --libs')
if libxml2_libs[:2] not in ["-l", "-L"]:
libxml2_libs = commands.getoutput('xml2-config --libs')
if libxml2_libs[:2] not in ["-l", "-L"]:
print "Error : cannot get LibXML2 linker flags"
# XMLSec1
cmd = 'pkg-config xmlsec1-%s --cflags' % xmlsec1_crypto
xmlsec1_cflags = commands.getoutput(cmd)
if xmlsec1_cflags[:2] not in ["-I", "-D"]:
cmd = 'xmlsec1-config --cflags --crypto=%s' % xmlsec1_crypto
xmlsec1_cflags = commands.getoutput(cmd)
if xmlsec1_cflags[:2] not in ["-I", "-D"]:
print "Error : cannot get XMLSec1 pre-processor and compiler flags"
cmd = 'pkg-config xmlsec1-%s --libs' % xmlsec1_crypto
xmlsec1_libs = commands.getoutput(cmd)
if xmlsec1_libs[:2] not in ["-l", "-L"]:
cmd = 'xmlsec1-config --libs --crypto=%s' % xmlsec1_crypto
xmlsec1_libs = commands.getoutput(cmd)
if xmlsec1_libs[:2] not in ["-l", "-L"]:
print "Error : cannot get XMLSec1 linker flags"
#print gobject_cflags
#print gobject_libs
#print libxml2_cflags
#print libxml2_libs
#print xmlsec1_cflags
#print xmlsec1_libs
extract_cflags(gobject_cflags)
extract_libs(gobject_libs)
extract_cflags(libxml2_cflags)
extract_libs(libxml2_libs)
extract_cflags(xmlsec1_cflags)
extract_libs(xmlsec1_libs)
# FIXME : cflags & libs for lasso
include_dirs.append('..')
library_dirs.append('../lasso/.libs')
#include_dirs.append('/usr/local/include')
#library_dirs.append('/usr/local/lib')
libraries.append('lasso')
em = Extension("lassomod",
sources = ["py_lasso.c",
"xml/py_xml.c",
"xml/py_lib_authentication_statement.c",
"xml/py_lib_authn_request.c",
"xml/py_lib_federation_termination_notification.c",
"xml/py_lib_logout_request.c",
"xml/py_lib_logout_response.c",
"xml/py_lib_name_identifier_mapping_request.c",
"xml/py_lib_name_identifier_mapping_response.c",
"xml/py_lib_register_name_identifier_request.c",
"xml/py_saml_assertion.c",
"xml/py_saml_authentication_statement.c",
"xml/py_saml_name_identifier.c",
"xml/py_samlp_response.c",
"protocols/py_authn_request.c",
"protocols/py_authn_response.c",
"protocols/py_federation_termination_notification.c",
"protocols/py_logout_request.c",
"protocols/py_logout_response.c",
"protocols/py_name_identifier_mapping_request.c",
"protocols/py_name_identifier_mapping_response.c",
"protocols/py_register_name_identifier_request.c",
"protocols/py_register_name_identifier_response.c",
"protocols/elements/py_assertion.c",
"protocols/elements/py_authentication_statement.c",
"environs/py_federation_termination.c",
"environs/py_login.c",
"environs/py_logout.c",
"environs/py_profile_context.c",
"environs/py_register_name_identifier.c",
"environs/py_server.c",
"environs/py_user.c",
"lassomod.c",
"utils.c", "wrap_objs.c"],
define_macros = define_macros,
include_dirs = include_dirs,
library_dirs = library_dirs,
libraries = libraries
)
doclines = __doc__.split("\n")
setup(name = "pylasso",
version = "0.0.1",
description = doclines[0],
long_description = "\n" . join(doclines[2:]),
author = "Valery Febvre",
author_email = "vfebvre@easter-eggs.com",
license = "GNU GPL",
platforms = ["any"],
url = "http://lasso.entrouvert.org",
ext_modules = [em],
py_modules = ["lasso", "lasso_strings"]
)

1
python/tests/Makefile.am Normal file
View File

@ -0,0 +1 @@
EXTRA_DIST = login_tests.py tests.py

43
python/xml/Makefile.am Normal file
View File

@ -0,0 +1,43 @@
noinst_LIBRARIES = libxml.a
INCLUDES = \
-DPACKAGE=\"@PACKAGE@\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(LASSO_CFLAGS) \
$(PY_CFLAGS) \
$(NULL)
noinst_LIBRARIES = libxml.a
libxml_a_SOURCES = \
py_lib_authentication_statement.c \
py_lib_authn_request.c \
py_lib_federation_termination_notification.c \
py_lib_logout_request.c \
py_lib_logout_response.c \
py_lib_name_identifier_mapping_request.c \
py_lib_name_identifier_mapping_response.c \
py_lib_register_name_identifier_request.c \
py_saml_assertion.c \
py_saml_authentication_statement.c \
py_saml_name_identifier.c \
py_samlp_response.c \
py_xml.c
EXTRA_DIST = \
py_lib_authentication_statement.h \
py_lib_authn_request.h \
py_lib_federation_termination_notification.h \
py_lib_logout_request.h \
py_lib_logout_response.h \
py_lib_name_identifier_mapping_request.h \
py_lib_name_identifier_mapping_response.h \
py_lib_register_name_identifier_request.h \
py_saml_assertion.h \
py_saml_authentication_statement.h \
py_saml_name_identifier.h \
py_samlp_response.h \
py_xml.h