summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'bindings')
-rw-r--r--bindings/alpm.i23
-rw-r--r--bindings/java/Makefile.in48
-rw-r--r--bindings/perl/Makefile.in42
-rw-r--r--bindings/perl/alpm.i23
-rw-r--r--bindings/python/Makefile.in48
-rw-r--r--bindings/python/alpm.i23
6 files changed, 207 insertions, 0 deletions
diff --git a/bindings/alpm.i b/bindings/alpm.i
new file mode 100644
index 00000000..dc4d680e
--- /dev/null
+++ b/bindings/alpm.i
@@ -0,0 +1,23 @@
+#if defined(SWIGPERL)
+%module "Alpm::Core"
+#else
+%module alpm
+#endif
+%include "cpointer.i"
+
+/* Wrap a class interface around a "long *" */
+%pointer_class(long, longp);
+
+/* Create casting functions */
+
+%pointer_cast(char *, long *, void_to_long);
+%pointer_cast(void *, char *, void_to_char);
+%pointer_cast(void *, unsigned long, void_to_unsigned_long);
+%pointer_cast(void *, PM_LIST *, void_to_PM_LIST);
+%pointer_cast(void *, PM_PKG *, void_to_PM_PKG);
+%pointer_cast(void *, PM_GRP *, void_to_PM_GRP);
+%pointer_cast(void *, PM_SYNCPKG *, void_to_PM_SYNCPKG);
+%pointer_cast(void *, PM_DB *, void_to_PM_DB);
+%pointer_cast(void *, PM_CONFLICT *, void_to_PM_CONFLICT);
+
+%include "alpm.h"
diff --git a/bindings/java/Makefile.in b/bindings/java/Makefile.in
new file mode 100644
index 00000000..3619c0ba
--- /dev/null
+++ b/bindings/java/Makefile.in
@@ -0,0 +1,48 @@
+top_srcdir = @top_srcdir@
+prefix = @prefix@
+
+CFLAGS = $(subst -Werror,,@CFLAGS@)
+CFLAGS += -fno-strict-aliasing # see the swig docs
+ifeq ($(shell arch),x86_64)
+CFLAGS += -fPIC
+endif
+LDFLAGS += -L$(top_srcdir)/lib/libalpm -lalpm
+
+all: libalpm_java.so alpm.jar
+
+libalpm_java.so: alpm_java_wrap.o
+ $(CC) -shared $^ -o $@ $(LDFLAGS)
+
+alpm_java_wrap.o: alpm_java_wrap.c
+ $(CC) $(CFLAGS) -c -o $@ -include alpm.h $^
+
+alpm_java_wrap.c:
+ cp $(top_srcdir)/lib/libalpm/alpm.h ./
+ cp $(top_srcdir)/bindings/alpm.i alpm_java.i
+ swig -java alpm_java.i
+
+alpm.class: alpm.java
+ javac *.java
+
+alpm.jar: alpm.class
+ jar -cf alpm.jar *.class
+
+alpm.java: alpm_java_wrap.c
+
+install: install-so install-jar
+
+install-so: libalpm_java.so
+ mkdir -p $(DESTDIR)$(prefix)/lib
+ install $^ $(DESTDIR)$(prefix)/lib
+
+install-jar: alpm.jar
+ mkdir -p $(DESTDIR)$(prefix)/share/java
+ install -m644 $^ $(DESTDIR)$(prefix)/share/java
+
+clean:
+ rm -f *alpm* *.java *.class
+
+distclean: clean
+ rm -f Makefile
+
+check:
diff --git a/bindings/perl/Makefile.in b/bindings/perl/Makefile.in
new file mode 100644
index 00000000..9ebc2d5d
--- /dev/null
+++ b/bindings/perl/Makefile.in
@@ -0,0 +1,42 @@
+top_srcdir = @top_srcdir@
+prefix = @prefix@
+
+CFLAGS = $(subst -Werror,,@CFLAGS@)
+CFLAGS += $(shell perl -MExtUtils::Embed -e ccopts)
+CFLAGS += -I$(top_srcdir)/lib/libalpm
+ifeq ($(shell arch),x86_64)
+CFLAGS += -fPIC
+endif
+LDFLAGS += -L$(top_srcdir)/lib/libalpm -lalpm
+LIBDIR += $(shell perl -V|grep site|sed 's/^ *//;s|/usr|$(prefix)|;q')
+
+all: Core.so
+
+Core.so: alpm_wrap.o
+ $(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
+
+alpm_wrap.o: alpm_wrap.c
+ $(CC) $(CFLAGS) -c -o $@ -include alpm.h $^
+
+alpm_wrap.c:
+ cp $(top_srcdir)/lib/libalpm/alpm.h ./
+ cp $(top_srcdir)/bindings/alpm.i ./
+ swig -perl alpm.i
+
+install: install-so install-pm
+
+install-so: Core.so
+ mkdir -p $(DESTDIR)$(LIBDIR)/auto/Alpm/Core
+ install $^ $(DESTDIR)$(LIBDIR)/auto/Alpm/Core/
+
+install-pm: Core.pm
+ mkdir -p $(DESTDIR)$(LIBDIR)/Alpm/
+ install -m644 $^ $(DESTDIR)$(LIBDIR)/Alpm/
+
+clean:
+ rm -f Core* alpm{.h,_wrap*}
+
+distclean: clean
+ rm -f Makefile
+
+check:
diff --git a/bindings/perl/alpm.i b/bindings/perl/alpm.i
new file mode 100644
index 00000000..dc4d680e
--- /dev/null
+++ b/bindings/perl/alpm.i
@@ -0,0 +1,23 @@
+#if defined(SWIGPERL)
+%module "Alpm::Core"
+#else
+%module alpm
+#endif
+%include "cpointer.i"
+
+/* Wrap a class interface around a "long *" */
+%pointer_class(long, longp);
+
+/* Create casting functions */
+
+%pointer_cast(char *, long *, void_to_long);
+%pointer_cast(void *, char *, void_to_char);
+%pointer_cast(void *, unsigned long, void_to_unsigned_long);
+%pointer_cast(void *, PM_LIST *, void_to_PM_LIST);
+%pointer_cast(void *, PM_PKG *, void_to_PM_PKG);
+%pointer_cast(void *, PM_GRP *, void_to_PM_GRP);
+%pointer_cast(void *, PM_SYNCPKG *, void_to_PM_SYNCPKG);
+%pointer_cast(void *, PM_DB *, void_to_PM_DB);
+%pointer_cast(void *, PM_CONFLICT *, void_to_PM_CONFLICT);
+
+%include "alpm.h"
diff --git a/bindings/python/Makefile.in b/bindings/python/Makefile.in
new file mode 100644
index 00000000..fe2e84a6
--- /dev/null
+++ b/bindings/python/Makefile.in
@@ -0,0 +1,48 @@
+top_srcdir = @top_srcdir@
+prefix = @prefix@
+
+CFLAGS = $(subst -Werror,,@CFLAGS@)
+CFLAGS += $(shell python -c 'from distutils import sysconfig; print "-I" + sysconfig.get_python_inc()')
+CFLAGS += -I$(top_srcdir)/lib/libalpm
+ifeq ($(shell arch),x86_64)
+CFLAGS += -fPIC
+endif
+LDFLAGS += -L$(top_srcdir)/lib/libalpm -lalpm
+LIBDIR += $(shell python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()'|sed 's|/usr|$(prefix)|')
+
+all: _alpm.so alpm.pyc
+
+_alpm.so: alpm_wrap.o
+ $(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
+
+alpm_wrap.o: alpm_wrap.c
+ $(CC) $(CFLAGS) -c -o $@ -include alpm.h $^
+
+alpm_wrap.c:
+ cp $(top_srcdir)/lib/libalpm/alpm.h ./
+ cp $(top_srcdir)/bindings/alpm.i ./
+ swig -python alpm.i
+ # strip the unnecessary prefixes
+ sed -i 's/^alpm_//;s/^PM_//' alpm.py
+
+alpm.pyc: alpm.py
+ python -c "import compileall; compileall.compile_dir('.',1,'.')"
+
+alpm.py: alpm_wrap.c
+
+install: install-so install-py
+
+install-so: _alpm.so
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ install $^ $(DESTDIR)$(LIBDIR)
+
+install-py: alpm.py alpm.pyc
+ install -m644 $^ $(DESTDIR)$(LIBDIR)
+
+clean:
+ rm -f _alpm* alpm{.h,.py*,_wrap*}
+
+distclean: clean
+ rm -f Makefile
+
+check:
diff --git a/bindings/python/alpm.i b/bindings/python/alpm.i
new file mode 100644
index 00000000..dc4d680e
--- /dev/null
+++ b/bindings/python/alpm.i
@@ -0,0 +1,23 @@
+#if defined(SWIGPERL)
+%module "Alpm::Core"
+#else
+%module alpm
+#endif
+%include "cpointer.i"
+
+/* Wrap a class interface around a "long *" */
+%pointer_class(long, longp);
+
+/* Create casting functions */
+
+%pointer_cast(char *, long *, void_to_long);
+%pointer_cast(void *, char *, void_to_char);
+%pointer_cast(void *, unsigned long, void_to_unsigned_long);
+%pointer_cast(void *, PM_LIST *, void_to_PM_LIST);
+%pointer_cast(void *, PM_PKG *, void_to_PM_PKG);
+%pointer_cast(void *, PM_GRP *, void_to_PM_GRP);
+%pointer_cast(void *, PM_SYNCPKG *, void_to_PM_SYNCPKG);
+%pointer_cast(void *, PM_DB *, void_to_PM_DB);
+%pointer_cast(void *, PM_CONFLICT *, void_to_PM_CONFLICT);
+
+%include "alpm.h"