2011-05-18

Dynamically linked OCurl 0.5.3

Apply this patch to Makefile.in:

15a16
> OCMKLIB  = @OCAMLMKLIB@
23c24
< CFLAGS  = @CFLAGS@ @DEFS@
---
> CFLAGS  = @CFLAGS@ @DEFS@ -fPIC -O2 -DPIC
30,31c31,32
< CURLFLAGS = -ccopt @CURLFLAGS@
< CURLCLIBS = -cclib -lcurl-helper -cclib "@CURLLIBS@"
---
> CURLFLAGS = @CURLFLAGS@
> CURLCLIBS = @CURLLIBS@
49c50
<   $(OCBYTE) -custom -a $(FLAGS) $(CURLFLAGS) -o $@ $(CURLBCOBJS) $(CURLCLIBS)
---
>   $(OCMKLIB) -linkall -o curl -oc curl-helper $(FLAGS) $(CURLFLAGS) $(CURLCLIBS) $(CURLBCOBJS)
52c53
<   $(OCOPT) -a $(FLAGS) $(CURLFLAGS) $(LIBS) $(CURLOBJS) -o $@ $(CURLCLIBS)
---
>   $(OCMKLIB) -linkall -o curl -oc curl-helper $(FLAGS) $(CURLFLAGS) $(CURLCLIBS) $(CURLOBJS)
64,65c65
<   ar crus libcurl-helper.a $(CURLHELPEROBJS)
<   ranlib libcurl-helper.a
---
>   $(OCMKLIB) -linkall -o curl-helper $(FLAGS) $(CURLFLAGS) $(CURLCLIBS) $(CURLHELPEROBJS)
72c72
<   ocamlfind install curl META $(wildcard *.cmi) \
---
>   ocamlfind install curl META $(wildcard *.cmi) $(wildcard *.so) \
81c81
<   $(INSTALLDATA) curl.a libcurl-helper.a $(INSTALLDIR)
---
>   $(INSTALLDATA) curl.a libcurl-helper.a dllcurl-helper.so $(INSTALLDIR)
86c86
<   @rm -f $(TARGETS) *~ *.cm* *.o *.a .depend core
---
>   @rm -f $(TARGETS) *~ *.cm* *.o *.so *.a .depend core

before doing a ./configure --with-findlib. This allows you to issue a #require "curl" ;; in the Findlib-enabled top-level. In particular, this allows using CDuce from the top-level without having to make a custom one.

Tested on Mac OS X 10.6.7 and on FreeBSD 8.2-RELEASE with OCaml 3.12.0.

No comments: