Import mlgmp for ocaml. This time in the correct place.

OK dcoppa@
This commit is contained in:
edd 2012-07-16 15:51:33 +00:00
parent 2eaec1004a
commit a5c40bad5d
6 changed files with 129 additions and 0 deletions

View File

@ -0,0 +1,46 @@
# $OpenBSD: Makefile,v 1.1.1.1 2012/07/16 15:51:33 edd Exp $
COMMENT = GMP bindings for OCaml
V = 0.13
DISTNAME = mlgmp-${V}
PKGNAME = ocaml-mlgmp-${V}
CATEGORIES = devel math
HOMEPAGE = http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=278
MAINTAINER = Edd Barrett <edd@openbsd.org>
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM =Yes
PERMIT_DISTFILES_FTP = Yes
MASTER_SITES = http://theunixzoo.co.uk/files/
MODULES = lang/ocaml
BUILD_DEPENDS = devel/gmp devel/mpfr
RUN_DEPENDS = ${BUILD_DEPENDS}
USE_GMAKE = Yes
# overide their site specific include/lib paths
MAKE_FLAGS += GMP_LIBDIR=${LOCALBASE}/lib
MAKE_FLAGS += GMP_INCLUDES=-I${LOCALBASE}/include
MAKE_FLAGS += CFLAGS_MISC="${CFLAGS}"
# build does not support just bytecode, but we can
# deal with this my calling certain make targets
LIBS_NATIVE = gmp.a gmp.cmxa
LIBS_OTHER = libmlgmp.a gmp.cma gmp.cmi
MAKE_FLAGS += LIBS="${LIBS_OTHER} ${MODOCAML_NATIVE:L:S/yes/${LIBS_NATIVE}/:S/no//}"
MAKE_FLAGS += TESTS="test_suite ${MODOCAML_NATIVE:L:S/yes/test_suite.opt/:S/no//}"
MAKE_FLAGS += TESTS_RUN="tests-nonative ${MODOCAML_NATIVE:L:S/yes/tests-native/:S/no//}"
REGRESS_TARGET = tests
# make dependencies are screwed up in the release tarball
pre-build:
cd ${WRKBUILD} && ${MAKE_PROGRAM} clean
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (mlgmp-0.13.tar.gz) = +hZQOBUZncthiTeJzN3tkw==
RMD160 (mlgmp-0.13.tar.gz) = mWjeGJvOAwcU3M4pF+LGCnNIAh0=
SHA1 (mlgmp-0.13.tar.gz) = UQTsOOnoaq06NlCL3Qku9cEoPas=
SHA256 (mlgmp-0.13.tar.gz) = Wp+nk5Wxay9dTXketVwvbQlHi5H+S4EgZkG6/BQ64As=
SIZE (mlgmp-0.13.tar.gz) = 973490

View File

@ -0,0 +1,66 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2012/07/16 15:51:33 edd Exp $
- Allow overide of includes and libs.
- Fix DESTDIR clash.
- Honour CFLAGS.
- Allow bytecode-only compilation.
--- Makefile.orig Fri Feb 24 08:17:29 2012
+++ Makefile Sat Jul 14 15:46:26 2012
@@ -2,20 +2,20 @@
RANLIB= ranlib
OCAML_LIBDIR:= $(shell ocamlc -where)
-GMP_INCLUDES= -I/opt/gmp-4.1.2/include -I/users/absint2/local/include -I$(HOME)/packages/gmp/include
+GMP_INCLUDES?= -I/opt/gmp-4.1.2/include -I/users/absint2/local/include -I$(HOME)/packages/gmp/include
-GMP_LIBDIR=/opt/gmp-4.1.2/lib
-DESTDIR= $(OCAML_LIBDIR)/gmp
+GMP_LIBDIR?=/opt/gmp-4.1.2/lib
+INSTDIR= ${DESTDIR}/$(OCAML_LIBDIR)/gmp
#RLIBFLAGS= -cclib "-Wl,-rpath $(GMP_LIBDIR)" # Linux, FreeBSD
#RLIBFLAGS= -cclib "-Wl,-R $(GMP_LIBDIR)" # Solaris
# RLIBFLAGS= # MacOS X
LIBFLAGS= -cclib -L. -cclib -L$(GMP_LIBDIR) $(RLIBFLAGS) \
- -cclib -lmpfr -cclib -lgmp -cclib -L$(DESTDIR)
+ -cclib -lmpfr -cclib -lgmp -cclib -L${OCAML_LIBDIR}
#CC= icc
-CFLAGS_MISC= -Wall -Wno-unused -Werror -g -O3
+CFLAGS_MISC?= -Wall -Wno-unused -Werror -g -O3
#CFLAGS_MISC=
CFLAGS_INCLUDE= -I $(OCAML_LIBDIR) $(GMP_INCLUDES)
CFLAGS= $(CFLAGS_MISC) $(CFLAGS_INCLUDE)
@@ -27,20 +27,24 @@ OCAMLFLAGS=
CMODULES= mlgmp_z.c mlgmp_q.c mlgmp_f.c mlgmp_fr.c mlgmp_random.c mlgmp_misc.c
CMODULES_O= $(CMODULES:%.c=%.o)
-LIBS= libmlgmp.a gmp.a gmp.cma gmp.cmxa gmp.cmi
+LIBS?= libmlgmp.a gmp.a gmp.cma gmp.cmxa gmp.cmi
PROGRAMS= test_creal test_creal.opt essai essai.opt toplevel\
test_suite test_suite.opt
-TESTS= test_suite test_suite.opt
+TESTS?= test_suite test_suite.opt
-all: $(LIBS) tests
+all: $(LIBS)
install: all
- -mkdir $(DESTDIR)
- cp $(LIBS) gmp.mli $(DESTDIR)
+ -mkdir -p $(INSTDIR)
+ cp $(LIBS) gmp.mli $(INSTDIR)
-tests: $(LIBS) $(TESTS)
+tests: $(LIBS) $(TESTS) $(TESTS_RUN)
+
+tests-nonative:
./test_suite
+
+tests-native:
./test_suite.opt
%.i: %.c

View File

@ -0,0 +1,2 @@
An extended precision computation library (integers, rationals, floats)
in OCaml.

View File

@ -0,0 +1,3 @@
@comment $OpenBSD: PFRAG.native,v 1.1.1.1 2012/07/16 15:51:33 edd Exp $
lib/ocaml/gmp/gmp.a
lib/ocaml/gmp/gmp.cmxa

View File

@ -0,0 +1,7 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2012/07/16 15:51:33 edd Exp $
%%native%%
lib/ocaml/gmp/
lib/ocaml/gmp/gmp.cma
lib/ocaml/gmp/gmp.cmi
lib/ocaml/gmp/gmp.mli
lib/ocaml/gmp/libmlgmp.a