openbsd-ports/x11/lablgtk2/patches/patch-src_Makefile
dcoppa 6e727b82a7 Support DESTDIR with findlib-install (this unbreaks systraced builds)
adapted from upstream git 58e15c3a33ee747e3e58a2c9687f22234f0055b6

OK sthen@, chrisz@
2013-01-31 21:20:32 +00:00

71 lines
2.4 KiB
Plaintext

$OpenBSD: patch-src_Makefile,v 1.3 2013/01/31 21:20:32 dcoppa Exp $
Support DESTDIR with findlib-install; unbreak systraced builds
(adapted from upstream git 58e15c3a33ee747e3e58a2c9687f22234f0055b6)
--- src/Makefile.orig Thu Aug 23 12:37:48 2012
+++ src/Makefile Thu Jan 31 12:00:38 2013
@@ -48,7 +48,7 @@ CUSTOM = -custom
#MLLINK += -cclib -lcamlrund
MLBYTEFLAGS = -g -dtypes
else
-CFLAGS = -DG_DISABLE_ASSERT -DG_DISABLE_CAST_CHECKS $(GTKCFLAGS)
+CFLAGS += -DG_DISABLE_ASSERT -DG_DISABLE_CAST_CHECKS $(GTKCFLAGS)
ifneq ($(TOOLCHAIN),msvc)
CFLAGS += -O
endif
@@ -63,7 +63,7 @@ endif
THLINK = unix.cma threads.cma
ifdef USE_CC
-CCOMPILER = $(CC) -c -I"$(LIBDIR)" $(CFLAGS)
+CCOMPILER = $(CC) -c -I"$(LIBDIR)" $(CFLAGS) -fPIC
else
CCOMPILER = $(CAMLC) -c -ccopt '$(CFLAGS)' -verbose
endif
@@ -274,7 +274,7 @@ lablgtktop$(XE): $(MLLIBS) $(THOBJS) $(CONFIG)
endif
lablgtk2: Makefile $(CONFIG) lablgtk2.in
- sed -e "s|@INSTALLDIR@|$(INSTALLDIR)|g" \
+ sed -e "s|@INSTALLDIR@|$(LABLGTKDIR)|g" \
-e "s|@LABLGLDIR@|$(LABLGLDIR)|g" \
-e "s|@MLLIBS@|$(MLLINK) $(MLLIBS)|g" \
-e "s|@INITOBJS@|$(INITOBJS)|g" \
@@ -391,7 +391,9 @@ old-uninstall:
# Install using ocamlfind
findlib-install:
mkdir -p "$(BINDIR)"
- ocamlfind install lablgtk2 ../META \
+ mkdir -p "$(DESTDIR)$(FINDLIBDIR)"
+ ocamlfind install -destdir "$(DESTDIR)$(FINDLIBDIR)" \
+ lablgtk2 ../META \
build.ml \
$(CLIBS) \
$(ALLOBJS:.cmo=.cmi) $(EXTRA_OBJS:.cmo=.cmi) \
@@ -427,16 +429,19 @@ findlib-install:
then \
echo $(CLIBS:lib%$(XA)=dll%$(XA)) ; \
fi`
- $(RANLIB) $(CLIBS:%="`ocamlfind query lablgtk2 | tr -d '\r'`"/%)
- @if test -f lablgtk.cmxa; \
- then ($(RANLIB) $(MLLIBS:%.cma="`ocamlfind query lablgtk2 | tr -d '\r'`"/%$(XA)) $(EXTRA_MLLIBS:%.cma="`ocamlfind query lablgtk2 | tr -d '\r'`"/%$(XA)) ); fi
- rm lablgtk2$(XB)
- $(MAKE) INSTALLDIR=`ocamlfind query lablgtk2 | tr -d '\r'` lablgtk2$(XB)
+ rm -f lablgtk2
+ $(MAKE) lablgtk2 LABLGTKDIR="$(FINDLIBDIR)/lablgtk2"
cp lablgtk2$(XB) "$(BINDIR)"
if test -f lablgladecc$(XE); then \
cp lablgladecc$(XE) "$(BINDIR)/lablgladecc2$(XE)"; \
fi
cp gdk_pixbuf_mlsource$(XE) "$(BINDIR)"
+ $(RANLIB) $(CLIBS:%=$(FLINSTALLDIR)/%)
+ @if test -f lablgtk.cmxa; then \
+ echo "Execute $(RANLIB) in $(FLINSTALLDIR)"; \
+ $(RANLIB) $(MLLIBS:%.cma=$(FLINSTALLDIR)/%$(XA)) \
+ $(EXTRA_MLLIBS:%.cma=$(FLINSTALLDIR)/%$(XA)) ; \
+ fi
findlib-uninstall:
ocamlfind remove lablgtk2