* Makefile (get-po-files): New.
+ * configure.ac (AC_OUTPUT): Add tests/setup.py.
+
2008-02-27 François Pinard <pinard@iro.umontreal.ca>
To solve linker namespace pollution:
-ac_config_files="$ac_config_files Makefile cleaner.h contrib/Makefile doc/Makefile lib/Makefile libiconv/Makefile po/Makefile.in src/Makefile tests/Makefile"
+ac_config_files="$ac_config_files Makefile cleaner.h contrib/Makefile doc/Makefile lib/Makefile libiconv/Makefile po/Makefile.in src/Makefile tests/Makefile tests/setup.py"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
"po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+ "tests/setup.py") CONFIG_FILES="$CONFIG_FILES tests/setup.py" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
])
AC_OUTPUT(Makefile cleaner.h contrib/Makefile doc/Makefile lib/Makefile
- libiconv/Makefile po/Makefile.in src/Makefile tests/Makefile)
+ libiconv/Makefile po/Makefile.in src/Makefile tests/Makefile
+ tests/setup.py)
+2008-03-06 François Pinard <pinard@iro.umontreal.ca>
+
+ Increase Recode.so portability, by depending on distutils:
+ * setup.py.in: New file.
+ * Makefile.am (Recode.so): Use it.
+ (all-local, Recode.o): Deleted.
+ Reported by Bruno Haible and Dagobert Michelsen.
+
2008-03-05 François Pinard <pinard@iro.umontreal.ca>
* Makefile.am (CLEANFILES): Added.
PYTHON = python
-CLEANFILES = Recode.o Recode.so
+CLEANFILES = Recode.so
-all-local: Recode.so
-
-check-local:
+check-local: Recode.so
RECODE=../src/recode PYTHONPATH=.:$(srcdir) \
$(PYTHON) $(srcdir)/pytest $(srcdir)/t*.py
-Recode.so: Recode.o
- $(CC) -shared $< -lrecode `python-config --libs` -o $@
-
-Recode.o: Recode.c
- $(CC) -c -fPIC `python-config --cflags` \
- -I $(top_builddir) -I $(top_srcdir)/src $<
+Recode.so: Recode.c setup.py
+ $(PYTHON) setup.py build
Recode.c: Recode.pyx
cd $(srcdir) && pyrexc Recode.pyx
-
build_triplet = @build@
host_triplet = @host@
subdir = tests
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/setup.py.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = setup.py
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
EXTRA_DIST = NOTES Recode.c Recode.pyx pytest common.py $(SUITE)
PYTHON = python
-CLEANFILES = Recode.o Recode.so
+CLEANFILES = Recode.so
all: all-am
.SUFFIXES:
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+setup.py: $(top_builddir)/config.status $(srcdir)/setup.py.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-local
check: check-am
-all-am: Makefile all-local
+all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
.MAKE: install-am install-strip
-.PHONY: all all-am all-local check check-am check-local clean \
- clean-generic clean-libtool distclean distclean-generic \
- distclean-libtool distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
+.PHONY: all all-am check check-am check-local clean clean-generic \
+ clean-libtool distclean distclean-generic distclean-libtool \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
uninstall uninstall-am
-all-local: Recode.so
-
-check-local:
+check-local: Recode.so
RECODE=../src/recode PYTHONPATH=.:$(srcdir) \
$(PYTHON) $(srcdir)/pytest $(srcdir)/t*.py
-Recode.so: Recode.o
- $(CC) -shared $< -lrecode `python-config --libs` -o $@
-
-Recode.o: Recode.c
- $(CC) -c -fPIC `python-config --cflags` \
- -I $(top_builddir) -I $(top_srcdir)/src $<
+Recode.so: Recode.c setup.py
+ $(PYTHON) setup.py build
Recode.c: Recode.pyx
cd $(srcdir) && pyrexc Recode.pyx
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+from distutils.core import setup, Extension
+
+build = 'build'
+srcdir = '@srcdir@'
+top_builddir = '@top_builddir@'
+top_srcdir = '@top_srcdir@'
+
+try:
+
+ if srcdir != '.':
+ buffer = file(os.path.join(srcdir, 'Recode.c')).read()
+ file('Recode.c', 'w').write(buffer)
+
+ setup(ext_modules=[
+ Extension('Recode', ['Recode.c'],
+ include_dirs=[top_builddir, os.path.join(top_srcdir, 'src')],
+ libraries=['recode'])
+ ])
+
+finally:
+
+ if srcdir != '.':
+ if os.path.exists('Recode.c'):
+ os.remove('Recode.c')
+
+def extract_and_clean(directory):
+ for base in os.listdir(directory):
+ name = os.path.join(directory, base)
+ if base == 'Recode.so':
+ buffer = file(name, 'rb').read()
+ file('Recode.so', 'wb').write(buffer)
+ if os.path.isdir(name):
+ extract_and_clean(name)
+ else:
+ os.remove(name)
+ os.rmdir(directory)
+
+extract_and_clean(build)