delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/10/11/02:17:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-50.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SARE_OBFU_PART_INA
X-Spam-Check-By: sourceware.org
Subject: ocaml: patches needed
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
To: cygwin <cygwin AT cygwin DOT com>
Date: Mon, 11 Oct 2010 01:16:54 -0500
Message-ID: <1286777814.5824.48.camel@YAAKOV04>
Mime-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--=-kVmi/OTLwPLua7e2VmEY
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Damien,

Thanks for updating OCaml to use FlexDLL.  There are some further
patches required for a fully-functional OCaml:

1) libcamlrun_shared is not a dynlink module, it is a
dynamically-linkable OCaml interpreter (similar to libperl or libpython)
to be used by mod_ocaml.  Therefore, it must be a DLL installed
into /usr/bin with only an import lib in /usr/lib/ocaml.

2) ocamlmktop is a script, not a program, so it must not have an .exe
suffix.

3) On Cygwin we use *NIX APIs, not Win32 ones, and ocaml is coded to
work with either.  Therefore the _WIN32 define must be removed for
Cygwin so that the correct APIs are used.

As for the packaging, there are several enhancements which I would
suggest:

1) install the emacs mode;
2) package camlp4 separately due to its size;
3) install the compiler libs, packaged separately;
4) strip the libcamlrun_shared DLL and /usr/bin/*.opt.exe native
executables.

A .cygport for 3.12.0 which does all these things is attached.  All
these files are also available from Ports git:

http://cygwin-ports.git.sourceforge.net/git/gitweb.cgi?p=cygwin-ports/ports;a=tree;f=lang/ocaml

HTH,


Yaakov


--=-kVmi/OTLwPLua7e2VmEY
Content-Disposition: attachment; filename="3.11.1-libcamlrun_shared.patch"
Content-Type: text/x-patch; name="3.11.1-libcamlrun_shared.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

--- origsrc/ocaml-3.11.1/byterun/Makefile	2009-05-25 07:25:25.000000000 -0500
+++ src/ocaml-3.11.1/byterun/Makefile	2009-07-21 16:59:57.831069300 -0500
@@ -23,7 +23,7 @@ DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
 PICOBJS=$(OBJS:.o=.pic.o)
 
 SHARED_LIBS_TMP=$(SUPPORTS_SHARED_LIBRARIES:%false=)
-SHARED_LIBS_DEPS=$(SHARED_LIBS_TMP:%true=libcamlrun_shared.so)
+SHARED_LIBS_DEPS=$(SHARED_LIBS_TMP:%true=libcamlrun_shared.dll.a)
 
 all:: $(SHARED_LIBS_DEPS)
 
@@ -43,15 +43,16 @@ libcamlrund.a: $(DOBJS)
 	ar rc libcamlrund.a $(DOBJS)
 	$(RANLIB) libcamlrund.a
 
-libcamlrun_shared.so: $(PICOBJS)
-	$(MKDLL) -o libcamlrun_shared.so $(PICOBJS) $(BYTECCLIBS)
+libcamlrun_shared.dll.a: $(PICOBJS)
+	$(MKDLL) -o cygcamlrun_shared.dll -link -Wl,--out-implib,libcamlrun_shared.dll.a $(PICOBJS) $(BYTECCLIBS)
 
 install::
-	if test -f libcamlrun_shared.so; then \
-	  cp libcamlrun_shared.so $(LIBDIR)/libcamlrun_shared.so; fi
+	if test -f libcamlrun_shared.dll.a; then \
+	  cp cygcamlrun_shared.dll $(BINDIR); \
+	  cp libcamlrun_shared.dll.a $(LIBDIR)/libcamlrun_shared.dll.a; fi
 
 clean::
-	rm -f libcamlrun_shared.so
+	rm -f libcamlrun_shared.dll.a
 
 
 .SUFFIXES: .d.o .pic.o

--=-kVmi/OTLwPLua7e2VmEY
Content-Disposition: attachment; filename="3.11.2-exeext.patch"
Content-Type: text/x-patch; name="3.11.2-exeext.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

--- origsrc/ocaml-3.11.2/tools/Makefile.shared	2007-11-22 16:14:43.000000000 -0600
+++ src/ocaml-3.11.2/tools/Makefile.shared	2010-02-14 20:00:07.159668000 -0600
@@ -77,7 +77,7 @@ clean::
 	rm -f ocamlprof ocamlcp
 
 install::
-	cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE)
+	cp ocamlmktop $(BINDIR)/ocamlmktop
 
 clean::
 	rm -f ocamlmktop
@@ -121,7 +121,7 @@ clean::
 # To make custom toplevels (see Makefile/Makefile.nt)
 
 install::
-	cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE)
+	cp ocamlmktop $(BINDIR)/ocamlmktop
 
 clean::
 	rm -f ocamlmktop

--=-kVmi/OTLwPLua7e2VmEY
Content-Disposition: attachment; filename="3.11.2-not-win32.patch"
Content-Type: text/x-patch; name="3.11.2-not-win32.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

--- origsrc/ocaml-3.11.2/configure	2009-11-17 07:28:44.000000000 -0600
+++ src/ocaml-3.11.2/configure	2010-02-14 20:22:59.897184100 -0600
@@ -304,7 +304,7 @@ case "$bytecc,$host" in
     bytecccompopts="-D_XOPEN_SOURCE=500";;
   gcc*,*-*-cygwin*)
     bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
-    dllccompopts="-D_WIN32 -DCAML_DLL"
+    dllccompopts="-DCAML_DLL"
     if test $withsharedlibs = yes; then
       flexlink="flexlink -chain cygwin -merge-manifest"
       flexdir=`$flexlink -where | dos2unix`

--=-kVmi/OTLwPLua7e2VmEY
Content-Disposition: attachment; filename="ocaml-3.12.0-1.cygport"
Content-Type: text/plain; name="ocaml-3.12.0-1.cygport"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

DESCRIPTION="Objective Caml interpreter"
HOMEPAGE="http://caml.inria.fr/ocaml/"
SRC_URI="http://caml.inria.fr/pub/distrib/ocaml-${PV_MAJ_MIN}/${P}.tar.bz2"
PATCH_URI="
	3.11.2-not-win32.patch
	3.11.1-libcamlrun_shared.patch
	3.11.2-exeext.patch
"

OCAML_LIBDIR=/usr/lib/ocaml

PKG_NAMES="${PN} ${PN}-camlp4 ${PN}-compiler-libs emacs-caml"
PKG_HINTS="setup camlp4 compiler-libs labltk emacs"
ocaml_CONTENTS="--exclude=*camlp4* --exclude=compiler-libs --exclude=labltk
                --exclude=dll*tk*.so --exclude=emacs usr/"
ocaml_camlp4_CONTENTS="usr/bin/*camlp4* ${OCAML_LIBDIR#/}/camlp4/"
ocaml_compiler_libs_CONTENTS="${OCAML_LIBDIR#/}/compiler-libs/"
#ocaml_labltk_CONTENTS="usr/bin/labltk ${OCAML_LIBDIR#/}/labltk/
#                       ${OCAML_LIBDIR#/}/stublibs/dll*tk*.so"
emacs_caml_CONTENTS="usr/share/emacs/"

src_compile() {
	lndirs
	cd ${B}
	./configure \
		-prefix /usr \
		-bindir /usr/bin \
		-libdir ${OCAML_LIBDIR} \
		-mandir /usr/share/man \
		-cc "${CC}" \
		-with-pthread \
		|| error "configure failed"
	cygmake -j1 world opt opt.opt # ocamlnat
	cygmake -C emacs ocamltags
}

src_test() { :; }

src_install() {
	cd ${B}
	cyginstall -j1 \
		BINDIR=${D}/usr/bin \
		LIBDIR=${D}${OCAML_LIBDIR} \
		MANDIR=${D}/usr/share/man

	cygmake -j1 -C emacs install-ocamltags simple-install \
		BINDIR=${D}/usr/bin \
		EMACSDIR=${D}/usr/share/emacs/site-lisp

	# http://alain.frisch.fr/natdynlink.html#topl
#	dobin ocamlnat.exe

	# Install the compiler libs
	for d in parsing typing utils
	do
		insinto ${OCAML_LIBDIR}/compiler-libs/${d}
		doins ${d}/*.{mli,cmi,cmo,cmx,o}
	done

	# Symlink the headers to the right place
	dodir /usr/include
	dosym ../${OCAML_LIBDIR#/usr/}/caml /usr/include/caml

	# Remove ${D} from ld.conf, as the buildsystem isn't $(DESTDIR) aware
	sed -i -e "s:${D}::g" ${D}${OCAML_LIBDIR}/ld.conf

	dodoc Updating

	# These are false positives with the 'Caml1999X008' file magic test
	strip ${D}/usr/bin/*.{dll,opt.exe}
}


--=-kVmi/OTLwPLua7e2VmEY
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--=-kVmi/OTLwPLua7e2VmEY--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019