public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Keri Harris" <keri@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/cxprolog/, dev-lang/cxprolog/files/
Date: Sun, 19 Jul 2020 09:47:17 +0000 (UTC)	[thread overview]
Message-ID: <1595151987.bbe7289e65c8a40bbaf449083cf77087a3e72e63.keri@gentoo> (raw)

commit:     bbe7289e65c8a40bbaf449083cf77087a3e72e63
Author:     Keri Harris <keri <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 19 09:45:59 2020 +0000
Commit:     Keri Harris <keri <AT> gentoo <DOT> org>
CommitDate: Sun Jul 19 09:46:27 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbe7289e

dev-lang/cxprolog: initial ebuild

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Keri Harris <keri <AT> gentoo.org>

 dev-lang/cxprolog/Manifest                         |   1 +
 dev-lang/cxprolog/cxprolog-0.98.2.ebuild           | 119 +++++++++++++++++++++
 dev-lang/cxprolog/files/build.xml                  |  49 +++++++++
 .../cxprolog/files/cxprolog-0.98.2-portage.patch   |  52 +++++++++
 .../cxprolog/files/cxprolog-0.98.2-test-io.patch   |  20 ++++
 dev-lang/cxprolog/metadata.xml                     |   8 ++
 6 files changed, 249 insertions(+)

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>


             reply	other threads:[~2020-07-19  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-19  9:47 Keri Harris [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-07-22  7:13 [gentoo-commits] repo/gentoo:master commit in: dev-lang/cxprolog/, dev-lang/cxprolog/files/ Keri Harris
2022-05-21  8:12 Keri Harris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1595151987.bbe7289e65c8a40bbaf449083cf77087a3e72e63.keri@gentoo \
    --to=keri@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox