~alpine/aports

[alpine-aports] [PATCH 4/x] testing/ocaml-num: new aport

alpine-mips-patches <info@mobile-stream.com>
Details
Message ID
<20190222132509.DED2158710@mx12.valuehost.ru>
Sender timestamp
1550840027
DKIM signature
missing
Download raw message
Patch: +241 -0
This is an indirect prerequisite (via coq) for CompCert.

Tested with ocaml-4.07.1 only.
---
 testing/ocaml-num/APKBUILD              |  61 ++++++++++++
 testing/ocaml-num/install-DESTDIR.patch |  55 +++++++++++
 testing/ocaml-num/install-findlib.patch | 125 ++++++++++++++++++++++++
 3 files changed, 241 insertions(+)
 create mode 100644 testing/ocaml-num/APKBUILD
 create mode 100644 testing/ocaml-num/install-DESTDIR.patch
 create mode 100644 testing/ocaml-num/install-findlib.patch

diff --git a/testing/ocaml-num/APKBUILD b/testing/ocaml-num/APKBUILD
new file mode 100644
index 0000000000..450736b45a
--- /dev/null
+++ b/testing/ocaml-num/APKBUILD
@@ -0,0 +1,61 @@
# Contributor: alpine-mips-patches <info@mobile-stream.com>
# Maintainer: alpine-mips-patches <info@mobile-stream.com>
pkgname=ocaml-num
_pkgname=num
pkgver=1.1
pkgrel=0
pkgdesc="Arbitray-precision rational arithmetic for OCaml"
url="https://github.com/ocaml/num"
arch="aarch64 ppc64le x86_64"  # reflect ocaml aport platforms
license="LGPL-2.1-or-later-WITH-linking-exception-AND-MIT"
depends="ocaml-runtime"
makedepends="ocaml ocaml-compiler-libs ocaml-findlib"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/ocaml/$_pkgname/archive/v$pkgver.tar.gz
	install-findlib.patch
	install-DESTDIR.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"
	make
}

check() {
	make test
}

package() {
	cd "$builddir"

	local _libdir="usr/lib/ocaml"
	mkdir -p "$pkgdir/$_libdir"

	OCAMLFIND_DESTDIR="$pkgdir/$_libdir" \
	OCAMLFIND_LDCONF="ignore" \
	make DESTDIR="$pkgdir" findlib-install

	# drop temporary files
	find "$pkgdir/$_libdir" -name '*.cmti' -delete

	# move dllnums.so into standard shared stublibs dir
	local _numdir="$_libdir/$_pkgname"
	mkdir -p "$pkgdir/$_libdir/stublibs"
	mv "$pkgdir/$_numdir/"dll*.so "$pkgdir/$_libdir/stublibs"
}

dev() {
	depends="$pkgname=$pkgver-r$pkgrel"
	pkgdesc="$pkgdesc (development files)"

	local _numdir="usr/lib/ocaml/$_pkgname"
	mkdir -p "$subpkgdir/$_numdir"
	for p in '*.a' '*.cmx' '*.cmxa' '*.mli'; do
		mv "$pkgdir/$_numdir/"$p "$subpkgdir/$_numdir"
	done
}

sha512sums="e7ee54e83eaab15ee879c5bb6deb0d76a3adf1ffd2cbd3f93cda63e7bc7b3a90313b94b4be078ecddaeee90a8a98a986d80c2fd6f1ad38faa35a318f77ec890e  ocaml-num-1.1.tar.gz
d07720ba5c0c26d31e4fb054d8d3fd6ab4cd9c0496ccf110efe77ecd17e5a0c8c68b8cade42a1cecb1adc74773b04ced8b08032e9b7a8c7e6e4a722501933c28  install-findlib.patch
536ca5a1b0d76d9e6f1f33a560974bbebaebdcc020040631bb79d93748313691f8681cc6b43dc77a3dee78feb723b68e6220fa76b8276ad2577f23edd04aa15a  install-DESTDIR.patch"
diff --git a/testing/ocaml-num/install-DESTDIR.patch b/testing/ocaml-num/install-DESTDIR.patch
new file mode 100644
index 0000000000..def0b316dd
--- /dev/null
+++ b/testing/ocaml-num/install-DESTDIR.patch
@@ -0,0 +1,55 @@
diff --git a/src/Makefile b/src/Makefile
index 8a88035..2f191af 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -91,10 +91,10 @@ install:
 	cp META.in META
 	$(OCAMLFIND) install num META
 	rm -f META
-	$(INSTALL_DATA) $(TOINSTALL) $(STDLIBDIR)
+	$(INSTALL_DATA) $(TOINSTALL) $(DESTDIR)$(STDLIBDIR)
 ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
-	$(INSTALL_DIR) $(STDLIBDIR)/stublibs
-	$(INSTALL_DLL) $(TOINSTALL_STUBS) $(STDLIBDIR)/stublibs
+	$(INSTALL_DIR) $(DESTDIR)$(STDLIBDIR)/stublibs
+	$(INSTALL_DLL) $(TOINSTALL_STUBS) $(DESTDIR)$(STDLIBDIR)/stublibs
 endif
 
 findlib-install:
@@ -106,9 +106,9 @@ findlib-uninstall:
 	$(OCAMLFIND) remove num
 
 uninstall: findlib-uninstall
-	cd $(STDLIBDIR) && rm -f $(TOINSTALL)
+	cd $(DESTDIR)$(STDLIBDIR) && rm -f $(TOINSTALL)
 ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
-	cd $(STDLIBDIR)/stublibs && rm -f $(TOINSTALL_STUBS) 
+	cd $(DESTDIR)$(STDLIBDIR)/stublibs && rm -f $(TOINSTALL_STUBS) 
 endif
 
 clean:
diff --git a/toplevel/Makefile b/toplevel/Makefile
index 8c91b0b..48a73ce 100644
--- a/toplevel/Makefile
+++ b/toplevel/Makefile
@@ -1,6 +1,7 @@
 OCAMLC=ocamlc
 OCAMLDEP=ocamldep
 OCAMLFIND=ocamlfind
+STDLIBDIR=$(shell $(OCAMLC) -where)
 
 CAMLCFLAGS=-I ../src -I +compiler-libs \
            -w +a-4-9-41-42-44-45-48 -warn-error A \
@@ -22,10 +23,10 @@ TOINSTALL=\
   num_top.cma num_top.cmi num_top_printers.cmi
 
 install:
-	$(OCAMLFIND) install num-top META $(TOINSTALL)
+	$(OCAMLFIND) install -destdir $(DESTDIR)$(STDLIBDIR) num-top META $(TOINSTALL)
 
 uninstall:
-	$(OCAMLFIND) remove num-top
+	$(OCAMLFIND) remove -destdir $(DESTDIR)$(STDLIBDIR) num-top
 
 clean:
 	rm -f *.cm[ioxta] *.cmx[as] *.cmti
diff --git a/testing/ocaml-num/install-findlib.patch b/testing/ocaml-num/install-findlib.patch
new file mode 100644
index 0000000000..5d0c99151c
--- /dev/null
+++ b/testing/ocaml-num/install-findlib.patch
@@ -0,0 +1,125 @@
diff --git a/.gitignore b/.gitignore
index 6acd3bc..4802fdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,6 @@
 *.cmx[as]
 *.cmti
 *.annot
+src/META
+test/test.byt
+test/test.exe
diff --git a/Changelog b/Changelog
index 791b18b..72a3999 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,9 @@
+- GPR#6: provide findlib-install target to install everything using ocamlfind
+- Issue#3: make sur the stublibs/ directory exists before installing DLLs 
+  inside it.
+- Issue#4: wrong DLL file names for Win32 ports, causing errors at
+  installation time.
+
 Release 1.1 (2017-10-13):
 
 - Install .cmx files as well.
diff --git a/Makefile b/Makefile
index 6a5d08f..b40e588 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,16 @@ install:
 	$(MAKE) -C src install
 	$(MAKE) -C toplevel install
 
+findlib-install:
+	$(MAKE) -C src findlib-install
+	$(MAKE) -C toplevel install
+
 uninstall:
 	$(MAKE) -C src uninstall
 	$(MAKE) -C toplevel uninstall
 
-.PHONY: all test clean install uninstall
+findlib-uninstall:
+	$(MAKE) -C src findlib-uninstall
+	$(MAKE) -C toplevel uninstall
+
+.PHONY: all test clean install uninstall findlib-install findlib-uninstall
diff --git a/src/META b/src/META.in
similarity index 72%
rename from src/META
rename to src/META.in
index 66ac170..b5678b7 100644
--- a/src/META
+++ b/src/META.in
@@ -1,6 +1,8 @@
 # This META is the one provided by findlib when the "num" library was
 # part of the core OCaml distribution.  For backward compatibility,
-# it installs into OCaml's standard library directory, not in a subdirectory
+# it is installed into OCaml's standard library directory. If the
+# directory line below is removed, then it's installed in a
+# subdirectory, as normal for a findlib package.
 
 requires = "num.core"
 requires(toploop) = "num.core,num-top"
diff --git a/src/Makefile b/src/Makefile
index 97dc074..8a88035 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -5,6 +5,7 @@ OCAMLMKLIB=ocamlmklib
 OCAMLFIND=ocamlfind
 INSTALL_DATA=install -m 644
 INSTALL_DLL=install
+INSTALL_DIR=install -d
 STDLIBDIR=$(shell $(OCAMLC) -where)
 
 include $(STDLIBDIR)/Makefile.config
@@ -75,29 +76,43 @@ nat_stubs.$(O): bng.h nat.h
 
 TOINSTALL=nums.cma libnums.$(A) $(CMIS) $(CMIS:.cmi=.mli) $(CMIS:.cmi=.cmti)
 ifneq "$(ARCH)" "none"
-TOINSTALL+=nums.cmxa nums.$(A) $(CMIS:.cmi=.cmx)
+TOINSTALL+=nums.cmxa nums.$(A) $(CMXS)
 endif
 ifeq "$(NATDYNLINK)" "true"
 TOINSTALL+=nums.cmxs
 endif
-TOINSTALL_STUBS=dllnums.$(SO)
+ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
+TOINSTALL_STUBS=dllnums$(EXT_DLL)
+else
+TOINSTALL_STUBS=
+endif
 
 install:
+	cp META.in META
 	$(OCAMLFIND) install num META
+	rm -f META
 	$(INSTALL_DATA) $(TOINSTALL) $(STDLIBDIR)
 ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
+	$(INSTALL_DIR) $(STDLIBDIR)/stublibs
 	$(INSTALL_DLL) $(TOINSTALL_STUBS) $(STDLIBDIR)/stublibs
 endif
 
-uninstall:
+findlib-install:
+	grep -Fv '^' META.in > META
+	$(OCAMLFIND) install num META $(TOINSTALL) $(TOINSTALL_STUBS)
+	rm -f META
+
+findlib-uninstall:
+	$(OCAMLFIND) remove num
+
+uninstall: findlib-uninstall
 	cd $(STDLIBDIR) && rm -f $(TOINSTALL)
 ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
 	cd $(STDLIBDIR)/stublibs && rm -f $(TOINSTALL_STUBS) 
 endif
-	$(OCAMLFIND) remove num
 
 clean:
-	rm -f *.cm[ioxta] *.cmx[as] *.cmti *.$(O) *.$(A) *.$(SO)
+	rm -f *.cm[ioxta] *.cmx[as] *.cmti *.$(O) *.$(A) *$(EXT_DLL)
 
 depend:
 	$(OCAMLDEP) -slash *.mli *.ml > .depend
-- 
2.20.1




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)