summaryrefslogtreecommitdiff
path: root/lang/ocaml/patches/patch-otherlibs_systhreads_Makefile
blob: a8290838d52853a751e1111514e30a4a7974ed2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$NetBSD: patch-otherlibs_systhreads_Makefile,v 1.13 2022/05/24 18:25:38 jaapb Exp $

Use BSD_INSTALL_* instead of mkdir
Honor LDFLAGS.

--- otherlibs/systhreads/Makefile.orig	2021-09-30 15:40:11.000000000 +0000
+++ otherlibs/systhreads/Makefile
@@ -30,6 +30,7 @@ NATIVE_CPPFLAGS = \
   -DNATIVE_CODE -DTARGET_$(ARCH) -DMODEL_$(MODEL) -DSYS_$(SYSTEM)
 
 LIBS = -nostdlib -I $(ROOTDIR)/stdlib -I $(ROOTDIR)/otherlibs/$(UNIXLIB)
+LDOPTS = -ldopt "$(LDFLAGS)"
 
 CAMLC=$(BEST_OCAMLC) $(LIBS)
 CAMLOPT=$(BEST_OCAMLOPT) $(LIBS)
@@ -66,7 +67,7 @@ all: lib$(LIBNAME).$(A) $(LIBNAME).cma $
 allopt: lib$(LIBNAME)nat.$(A) $(LIBNAME).cmxa $(CMIFILES)
 
 lib$(LIBNAME).$(A): $(BYTECODE_C_OBJS)
-	$(MKLIB_CMD) -o $(LIBNAME) $(BYTECODE_C_OBJS) $(PTHREAD_LIBS)
+	$(MKLIB_CMD) -o $(LIBNAME) $(BYTECODE_C_OBJS) $(PTHREAD_LIBS) $(LDOPTS)
 
 lib$(LIBNAME)nat.$(A): $(NATIVECODE_C_OBJS)
 	$(MKLIB_CMD) -o $(LIBNAME)nat $^
@@ -74,7 +75,7 @@ lib$(LIBNAME)nat.$(A): $(NATIVECODE_C_OB
 $(LIBNAME).cma: $(THREADS_BCOBJS)
 ifeq "$(UNIX_OR_WIN32)" "unix"
 	$(MKLIB) -o $(LIBNAME) -ocamlc '$(CAMLC)' -cclib -lunix -linkall \
-	  $(PTHREAD_CAML_LIBS) $^
+	  $(PTHREAD_CAML_LIBS) $(LDOPTS) $^
 # TODO: Figure out why -cclib -lunix is used here.
 # It may be because of the threadsUnix module which is deprecated.
 # It may hence be good to figure out whether this module shouldn't be
@@ -122,7 +123,7 @@ install:
 	fi
 	$(INSTALL_DATA) libthreads.$(A) "$(INSTALL_LIBDIR)"
 	cd "$(INSTALL_LIBDIR)"; $(RANLIB) libthreads.$(A)
-	mkdir -p "$(INSTALL_THREADSLIBDIR)"
+	$(BSD_INSTALL_LIB_DIR) "$(INSTALL_THREADSLIBDIR)"
 	$(INSTALL_DATA) \
 	  $(CMIFILES) threads.cma \
 	  "$(INSTALL_THREADSLIBDIR)"