summarylogtreecommitdiffstats
path: root/arch-build-system-fix.patch
blob: 8a65a3a3c0c1137fd940efecea4d24ea560a63b4 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From a29e6b96b4574be8eaeb8c9c7514583734108cae Mon Sep 17 00:00:00 2001
From: Bertram Felgenhauer <int-e@gmx.de>
Date: Thu, 27 Oct 2016 10:45:13 +0200
Subject: [PATCH 1/2] arch build system fix

---
 config/Makefile.unix  |  8 +++++---
 lib/Makefile          | 10 ++++++++--
 runtime/Makefile.unix |  2 +-
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/config/Makefile.unix b/config/Makefile.unix
index cf4549c..fc8c063 100644
--- a/config/Makefile.unix
+++ b/config/Makefile.unix
@@ -19,7 +19,7 @@ OSTYPE=unix
 
 # How to invoke the C preprocessor
 # Works on most Unix systems:
-CPP=/lib/cpp
+CPP=$(shell which cpp)
 # Alternatives:
 # CPP=cpp
 # CPP=/usr/ccs/lib/cpp
@@ -31,10 +31,12 @@ RANLIB=ranlib
 #RANLIB=:
 
 # Location of the Objective Caml library in your installation
-OCAMLLIB=/usr/local/lib/ocaml
+OCAMLBASEDIR=$(shell ocamlc -where)
+OCAMLLIB=$(DESTDIR)$(OCAMLBASEDIR)
+OCAMLINCDIR=$(DESTDIR)$(OCAMLBASEDIR)/caml
 
 # Where to install the binaries
-BINDIR=/usr/local/bin
+BINDIR=$(DESTDIR)/usr/bin
 
 # The Objective Caml compilers (the defaults below should be OK)
 OCAMLC=ocamlc -g
diff --git a/lib/Makefile b/lib/Makefile
index 7ce04da..c347d6f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,8 +29,14 @@ $(NATIVELIB): $(NATIVEOBJS)
 	$(OCAMLOPT) -a -o $(NATIVELIB) $(NATIVEOBJS)
 
 install:
-	cp $(INTERFACES) $(BYTELIB) $(NATIVELIB) $(NATIVELIB:.cmxa=.$(LIBEXT)) $(OCAMLLIB)
-	cd $(OCAMLLIB); $(RANLIB) $(NATIVELIB:.cmxa=.$(LIBEXT))
+	cp $(INTERFACES) $(BYTELIB) $(OCAMLLIB)
+	if [ -x /usr/bin/ocamlopt ]; then \
+		cp $(NATIVELIB) $(NATIVELIB:.cmxa=.$(LIBEXT)) $(OCAMLLIB); \
+		cd $(OCAMLLIB); \
+		$(RANLIB) $(NATIVELIB:.cmxa=.$(LIBEXT));  \
+	else \
+		true; \
+	fi
 
 .SUFFIXES: .mli .ml .cmi .cmo .cmx
 
diff --git a/runtime/Makefile.unix b/runtime/Makefile.unix
index 5617349..737b048 100644
--- a/runtime/Makefile.unix
+++ b/runtime/Makefile.unix
@@ -22,7 +22,7 @@ libcamlidl.a: $(OBJS)
 	$(RANLIB) $@
 
 install:
-	cp camlidlruntime.h $(OCAMLLIB)/caml/camlidlruntime.h
+	cp camlidlruntime.h $(OCAMLINCDIR)/camlidlruntime.h
 	cp libcamlidl.a $(OCAMLLIB)/libcamlidl.a
 	cd $(OCAMLLIB); $(RANLIB) libcamlidl.a
 
-- 
2.10.1