summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeri Harris <keri@gentoo.org>2020-07-19 11:45:59 +0200
committerKeri Harris <keri@gentoo.org>2020-07-19 11:46:27 +0200
commitbbe7289e65c8a40bbaf449083cf77087a3e72e63 (patch)
tree6003111de4503c2bb489d5a12955455388239264 /dev-lang/cxprolog
parentwww-servers/puma: backport CVE-2020-11077 fixes (diff)
downloadgentoo-bbe7289e65c8a40bbaf449083cf77087a3e72e63.tar.gz
gentoo-bbe7289e65c8a40bbaf449083cf77087a3e72e63.tar.bz2
gentoo-bbe7289e65c8a40bbaf449083cf77087a3e72e63.zip
dev-lang/cxprolog: initial ebuild
Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Keri Harris <keri@gentoo.org>
Diffstat (limited to 'dev-lang/cxprolog')
-rw-r--r--dev-lang/cxprolog/Manifest1
-rw-r--r--dev-lang/cxprolog/cxprolog-0.98.2.ebuild119
-rw-r--r--dev-lang/cxprolog/files/build.xml49
-rw-r--r--dev-lang/cxprolog/files/cxprolog-0.98.2-portage.patch52
-rw-r--r--dev-lang/cxprolog/files/cxprolog-0.98.2-test-io.patch20
-rw-r--r--dev-lang/cxprolog/metadata.xml8
6 files changed, 249 insertions, 0 deletions
diff --git a/dev-lang/cxprolog/Manifest b/dev-lang/cxprolog/Manifest
new file mode 100644
index 00000000000..22b1f5ee490
--- /dev/null
+++ b/dev-lang/cxprolog/Manifest
@@ -0,0 +1 @@
+DIST cxprolog-0.98.2.src.tgz 548222 BLAKE2B e1e834384ff161efde961e7a319d9987cb368ed561fa613a4dd2ede353a099de9146de68dedab3d5e74bb5421c880f743b669eb43eb0b265112dbf938820b0ad SHA512 7e16ce238201da2520da3575311a8c56c9fc3926b290ef505e74ca208af9e6a070d4137ae21e708e1d6c9b83e44566ecd818d51a90f033c983c589b65bcbf2b1
diff --git a/dev-lang/cxprolog/cxprolog-0.98.2.ebuild b/dev-lang/cxprolog/cxprolog-0.98.2.ebuild
new file mode 100644
index 00000000000..b4cf9c3904e
--- /dev/null
+++ b/dev-lang/cxprolog/cxprolog-0.98.2.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+WX_GTK_VER="3.0"
+VIRTUALX_REQUIRED="manual"
+
+inherit flag-o-matic java-pkg-opt-2 java-ant-2 toolchain-funcs virtualx wxwidgets
+
+DESCRIPTION="A WAM based Prolog system"
+HOMEPAGE="http://ctp.di.fct.unl.pt/~amd/cxprolog"
+SRC_URI="http://ctp.di.fct.unl.pt/~amd/cxprolog/cxunix/${P}.src.tgz"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="examples java +readline test wxwidgets"
+RESTRICT="!test? ( test )"
+
+RDEPEND="readline? ( sys-libs/readline:= )
+ java? ( >=virtual/jdk-1.8:= )
+ wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
+
+DEPEND="${RDEPEND}
+ test? (
+ java? ( ${VIRTUALX_DEPEND} )
+ wxwidgets? ( ${VIRTUALX_DEPEND} )
+ )"
+
+S="${WORKDIR}"/${P}
+
+src_prepare() {
+ eapply "${FILESDIR}"/${P}-portage.patch
+ eapply "${FILESDIR}"/${P}-test-io.patch
+ eapply_user
+
+ sed -i -e "s|lib/cxprolog|$(get_libdir)/cxprolog|" "${S}"/src/FileSys.c || die
+ cp "${FILESDIR}"/build.xml "${S}"/build.xml || die
+ rm -f "${S}"/pl/test_file_io_1.txt
+
+ use wxwidgets && setup-wxwidgets
+}
+
+src_compile() {
+ local CXPROLOG_EXT_LIBS
+
+ if use readline; then
+ append-cflags "-DUSE_READLINE"
+ CXPROLOG_EXT_LIBS="$CXPROLOG_EXT_LIBS -lreadline"
+ fi
+
+ if use java; then
+ local java_arch
+ use x86 && java_arch=i386
+ use amd64 && java_arch=amd64
+ CXPROLOG_JVM="${JAVA_HOME}/jre/lib/${java_arch}/server"
+ append-cflags "-DUSE_JAVA $(java-pkg_get-jni-cflags) -Wl,-rpath,${CXPROLOG_JVM}"
+ CXPROLOG_EXT_LIBS="$CXPROLOG_EXT_LIBS -L${CXPROLOG_JVM} -ljvm -Wl,-rpath,${CXPROLOG_JVM}"
+ fi
+
+ if use wxwidgets; then
+ append-cflags "-DUSE_WXWIDGETS $(${WX_CONFIG} --cflags)"
+ CXPROLOG_EXT_LIBS="$CXPROLOG_EXT_LIBS $(${WX_CONFIG} --libs)"
+ fi
+
+ emake lib \
+ PREFIX=/usr \
+ TMP_DIR="${S}/tmp" \
+ CC=$(tc-getCC) \
+ CPP=$(tc-getCXX) \
+ LD=$(tc-getLD) \
+ CFLAGS="-g -Wall ${CFLAGS}" \
+ EXT_LIBS="${CXPROLOG_EXT_LIBS}"
+
+ if use java; then
+ JAVA_SRC_DIR="${S}/lib/cxprolog/java"
+ eant jar
+ fi
+}
+
+cxprolog_src_test() {
+ cd "${S}"/pl
+
+ LD_LIBRARY_PATH="${S}" \
+ PREFIX="${S}" \
+ "${S}"/cxprolog_shared \
+ --script "${S}"/pl/test_all.pl \
+ | tee "${S}"/cxprolog_test.log
+}
+
+src_test() {
+ virtx cxprolog_src_test
+
+ grep -q "ALL THE TESTS PASSED" "${S}"/cxprolog_test.log \
+ || die "cxprolog unit tests failed"
+}
+
+src_install() {
+ newbin cxprolog_shared cxprolog
+ dolib.so libcxprolog.so
+
+ insinto /usr/$(get_libdir)/cxprolog
+ doins lib/cxprolog/lib.pl
+
+ insinto /usr/share/${PN}/pl
+ doins pl/*.{pl,txt}
+
+ if use java; then
+ insinto /usr/$(get_libdir)/cxprolog/java
+ doins dist/prolog.jar
+ fi
+
+ dodoc ChangeLog.txt MANUAL.txt README.txt
+
+ if use examples; then
+ dodoc -r examples
+ fi
+}
diff --git a/dev-lang/cxprolog/files/build.xml b/dev-lang/cxprolog/files/build.xml
new file mode 100644
index 00000000000..3d4d4fba16e
--- /dev/null
+++ b/dev-lang/cxprolog/files/build.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" ?><project default="jar" name="cxprolog">
+
+ <!-- some properties -->
+ <property name="src.dir" value="lib/cxprolog/java/prolog"/>
+ <property name="build.dir" value="build"/>
+ <property name="dist.dir" value="dist"/>
+ <property file="build.properties"/>
+
+ <path id="compile.classpath">
+ <pathelement path="${gentoo.classpath}"/>
+ </path>
+
+ <!-- init -->
+ <target name="init">
+ <tstamp/>
+ <mkdir dir="${dist.dir}"/>
+ <mkdir dir="${build.dir}"/>
+ </target>
+
+ <!-- compile everything -->
+ <target depends="init" name="compile">
+ <javac deprecation="off"
+ destdir="${build.dir}"
+ encoding="ISO-8859-1"
+ srcdir="${src.dir}"
+ source="1.8"
+ target="1.8">
+ <classpath>
+ <path refid="compile.classpath"/>
+ </classpath>
+ </javac>
+ <copy todir="${build.dir}">
+ <fileset dir="${src.dir}">
+ <exclude name="**/*.java"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- build the jar file -->
+ <target depends="compile" name="jar">
+ <jar basedir="${build.dir}" jarfile="${dist.dir}/prolog.jar"/>
+ </target>
+
+ <!-- clean up -->
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+</project>
diff --git a/dev-lang/cxprolog/files/cxprolog-0.98.2-portage.patch b/dev-lang/cxprolog/files/cxprolog-0.98.2-portage.patch
new file mode 100644
index 00000000000..ed9fb3864c6
--- /dev/null
+++ b/dev-lang/cxprolog/files/cxprolog-0.98.2-portage.patch
@@ -0,0 +1,52 @@
+--- cxprolog-0.98.2.orig/Makefile 2016-09-17 20:33:35.000000000 +0200
++++ cxprolog-0.98.2/Makefile 2020-07-18 18:18:02.605499273 +0200
+@@ -20,9 +20,9 @@
+ ######################################################################
+
+ ##############################################################################
+-# To disable READLINE SUPPORT, uncomment the following line:
++# For READLINE SUPPORT, uncomment the following line:
+ #
+-# READLINE := n
++# READLINE := y
+ #
+ # Nothing more is required.
+ # This functionality is active by default.
+@@ -165,8 +165,7 @@
+ ZLIBS := $(EXTRA) $(LIBS) $(EXT_LIBS)
+ ZPRE :=
+
+-ifeq ($(READLINE),n)
+-else
++ifeq ($(READLINE),y)
+ ifneq ($(OS),MINGW32)
+ ifeq ($(shell if test -e "/usr/local/opt/readline"; then echo "y" ; fi),y)
+ ZDEFINES += -DUSE_READLINE=4 -I/usr/local/opt/readline/include
+@@ -329,7 +328,7 @@
+ endif
+
+ cxprolog_testlib.exe: libcxprolog.a cxprolog.dll
+- gcc -DTESTLIB=1 -o src/TestLib.o -c src/TestLib.c
++ $(CC) -DTESTLIB=1 -o src/TestLib.o -c src/TestLib.c
+ $(CPP) -enable-auto-import -o cxprolog_testlib src/TestLib.o -L./ -lcxprolog
+ rm src/TestLib.o
+
+@@ -337,14 +336,14 @@
+
+ else # Assume Unix
+ libcxprolog.so: $(OBJ_DIR) $(OBJS)
+- $(CPP) -shared -o libcxprolog.so $(OBJS) -lc $(ZLIBS)
++ $(CPP) -shared -Wl,-soname,libcxprolog.so -o libcxprolog.so $(filter-out src/obj/CxProlog.o,$(OBJS)) -lc $(ZLIBS)
+
+ cxprolog_shared: libcxprolog.so
+- $(CPP) $(ZDEFINES) -o cxprolog_shared -L./ -lcxprolog
++ $(CPP) $(ZDEFINES) -o cxprolog_shared src/obj/CxProlog.o -L./ -lcxprolog $(ZLIBS)
+
+ cxprolog_testlib: libcxprolog.so
+- gcc $(ZDEFINES) -DTESTLIB=1 -o src/TestLib.o -c src/TestLib.c
+- $(CPP) $(ZDEFINES) -o cxprolog_testlib src/TestLib.o -L./ -lcxprolog
++ $(CC) $(ZDEFINES) -DTESTLIB=1 -o src/TestLib.o -c src/TestLib.c
++ $(CPP) $(ZDEFINES) -o cxprolog_testlib src/TestLib.o -L./ -lcxprolog $(ZLIBS)
+ rm src/TestLib.o
+
+ lib: libcxprolog.so cxprolog_shared cxprolog_testlib
diff --git a/dev-lang/cxprolog/files/cxprolog-0.98.2-test-io.patch b/dev-lang/cxprolog/files/cxprolog-0.98.2-test-io.patch
new file mode 100644
index 00000000000..d9f7be7b0cf
--- /dev/null
+++ b/dev-lang/cxprolog/files/cxprolog-0.98.2-test-io.patch
@@ -0,0 +1,20 @@
+--- cxprolog-0.98.2.orig/pl/test_io.pl 2016-01-23 22:07:48.000000000 +0100
++++ cxprolog-0.98.2/pl/test_io.pl 2020-07-18 21:26:20.911026745 +0200
+@@ -17,7 +17,7 @@
+ concat([X,'.\n'],T).
+
+ test_file_io(L,Encoding) :-
+- FileName = 'test_file_io_1.txt',
++ FileName = '/tmp/test_file_io_1.txt',
+ open(FileName,write,S1,[encoding(Encoding),bom(true)]),
+ name(T,L),
+ write(S1,T),
+@@ -25,7 +25,7 @@
+ open(FileName,read,S2), % relies on bom
+ read(S2,X),
+ close(S2),
+- %fs_delete(FileName),
++ fs_delete(FileName),
+ concat([X,'.\n'],T).
+
+ :- current_prolog_flag(encoding,Curr),
diff --git a/dev-lang/cxprolog/metadata.xml b/dev-lang/cxprolog/metadata.xml
new file mode 100644
index 00000000000..96eff3ea40c
--- /dev/null
+++ b/dev-lang/cxprolog/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>prolog@gentoo.org</email>
+ <name>Prolog</name>
+</maintainer>
+</pkgmetadata>