gnu: python-babel: Update to 2.7.0.
[guix.git] / gnu / packages / patches / ocaml-bisect-fix-camlp4-in-another-directory.patch
blobfd9a4c9401ad2906fff3dfd8c6842b8468df8987
1 From bc3b353cb2f26cf10aa5c5caebddf6d3d5b1e318 Mon Sep 17 00:00:00 2001
2 From: Julien Lepiller <julien@lepiller.eu>
3 Date: Fri, 21 Sep 2018 22:31:29 +0200
4 Subject: [PATCH] fix camlp4 in another directory
6 ---
7 Makefile | 11 ++++++-----
8 configure | 13 ++++++++++++-
9 tests/Makefile | 2 +-
10 tests/camlp4-comments/Makefile | 2 +-
11 tests/camlp4-exclude-file/Makefile | 2 +-
12 tests/camlp4-exclude/Makefile | 2 +-
13 tests/camlp4-instrument-fast/Makefile | 2 +-
14 tests/camlp4-instrument/Makefile | 2 +-
15 tests/combine-expr/Makefile | 2 +-
16 tests/ppx-comments/Makefile | 2 +-
17 tests/ppx-exclude-file/Makefile | 2 +-
18 tests/ppx-exclude/Makefile | 2 +-
19 tests/ppx-instrument-fast/Makefile | 2 +-
20 tests/ppx-instrument/Makefile | 2 +-
21 tests/report/Makefile | 2 +-
22 15 files changed, 31 insertions(+), 19 deletions(-)
24 diff --git a/Makefile b/Makefile
25 index b0980ee..6697922 100644
26 --- a/Makefile
27 +++ b/Makefile
28 @@ -25,7 +25,7 @@ PATH_BUILD=$(PATH_BASE)/_build
29 PATH_OCAMLDOC=$(PATH_BASE)/ocamldoc
30 PATH_SRC=$(PATH_BASE)/src
31 PATH_TESTS=$(PATH_BASE)/tests
32 -PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
33 +PATH_INSTALL=$(PREFIX)/lib/ocaml/bisect
36 # DEFINITIONS
37 @@ -33,7 +33,8 @@ PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
38 PROJECT_NAME=bisect
39 OCAMLBUILD=ocamlbuild
40 OCAMLBUILD_ENV=WARNINGS=$(WARNINGS) PATH_OCAML_PREFIX=$(PATH_OCAML_PREFIX)
41 -OCAMLBUILD_FLAGS=-classic-display -no-links
42 +CAMLP4_INCLUDE=$(shell test -z $(CAMLP4_LIBDIR) || echo "-cflags -I,$(CAMLP4_LIBDIR)")
43 +OCAMLBUILD_FLAGS=-classic-display -no-links $(CAMLP4_INCLUDE)
44 MODULES_ODOCL=$(PROJECT_NAME).odocl
45 MODULES_MLPACK=$(PROJECT_NAME).mlpack
46 MODULES_MLPACK_PP=$(PROJECT_NAME)_pp.mlpack
47 @@ -80,11 +81,11 @@ veryclean: clean
48 rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css
50 install: FORCE
51 - cp $(PATH_BUILD)/src/report/report.byte $(PATH_OCAML_PREFIX)/bin/bisect-report; \
52 + cp $(PATH_BUILD)/src/report/report.byte $(PREFIX)/bin/bisect-report; \
53 if [ "$(PPX)" = "TRUE" ]; then \
54 - cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PATH_OCAML_PREFIX)/bin; \
55 + cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PREFIX)/bin; \
56 fi; \
57 - (which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \
58 + (which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \
59 if [ -x "$(PATH_OCAMLFIND)" ]; then \
60 $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \
61 $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \
62 diff --git a/configure b/configure
63 index bb7ebf4..43ef46b 100755
64 --- a/configure
65 +++ b/configure
66 @@ -21,7 +21,9 @@
67 # default values
68 ocamlbuild=`which ocamlbuild || echo '/usr/local/bin/ocamlbuild'`
69 bin_path=`dirname $ocamlbuild`
70 +prefix=''
71 ocaml_prefix=`dirname $bin_path`
72 +camlp4_prefix=`dirname $(dirname $(which camlp4of))`
73 ocamlfind=`which ocamlfind 2> /dev/null || echo ''`
74 native_dynlink='TRUE'
75 devel='FALSE'
76 @@ -32,8 +34,12 @@ ppx='FALSE'
77 while [ $# -gt 0 ]
79 case "$1" in
80 + -prefix)
81 + prefix="$2"; shift;;
82 -ocaml-prefix)
83 ocaml_prefix="$2"; shift;;
84 + -camlp4-prefix)
85 + camlp4_prefix="$2"; shift;;
86 -ocamlfind)
87 ocamlfind="$2"; shift;;
88 -no-native-dynlink)
89 @@ -45,7 +51,7 @@ do
90 -ppx)
91 ppx='TRUE';;
93 - echo "usage: $0 [-ocaml-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
94 + echo "usage: $0 [-prefix <path>] [-ocaml-prefix <path>] [-camlp4-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
95 exit 1;;
96 esac
97 shift
98 @@ -57,6 +63,9 @@ if [ "$no_camlp4" = "TRUE" -a "$ppx" = "FALSE" ]; then
99 exit 1
102 +# prefix default value
103 +test -z $prefix && prefix=$ocaml_prefix
105 # make options
106 make_quiet=`make -f - <<EOF
107 default: gnumake
108 @@ -66,7 +75,9 @@ EOF`
110 # file creation
111 echo "# timestamp: `date`" > Makefile.config
112 +echo "PREFIX=$prefix" >> Makefile.config
113 echo "PATH_OCAML_PREFIX=$ocaml_prefix" >> Makefile.config
114 +echo "PATH_CAMLP4_PREFIX=$camlp4_prefix" >> Makefile.config
115 echo "PATH_OCAMLFIND=$ocamlfind" >> Makefile.config
116 echo "NATIVE_DYNLINK=$native_dynlink" >> Makefile.config
117 echo "WARNINGS=$devel" >> Makefile.config
118 diff --git a/tests/Makefile b/tests/Makefile
119 index 1aba27f..9642323 100644
120 --- a/tests/Makefile
121 +++ b/tests/Makefile
122 @@ -41,7 +41,7 @@ one: FORCE
123 else \
124 echo "Running tests for '$(NAME)'..." | tee -a _log; \
125 (cd $(NAME) && \
126 - $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin \
127 + $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin PATH_CAMLP4_PREFIX=$(PATH_CAMLP4_PREFIX) \
128 COMPILER=ocamlc EXECUTABLE=bytecode RUN=./ LIB_EXT=cma EXE_SUFFIX='' \
129 REPORT=../../_build/src/report/report.byte && \
130 cd ..) || echo '*** error' >> _log; \
131 diff --git a/tests/camlp4-comments/Makefile b/tests/camlp4-comments/Makefile
132 index 33fca72..a918118 100644
133 --- a/tests/camlp4-comments/Makefile
134 +++ b/tests/camlp4-comments/Makefile
135 @@ -2,7 +2,7 @@ default:
136 @rm -fr *.result *.cmp
137 @for file in *.ml; do \
138 echo " testing '$$file' ..."; \
139 - $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
140 + $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
141 diff -q $$file.reference $$file.result || exit 1; \
142 done
143 @rm -fr *.result *.cmp
144 diff --git a/tests/camlp4-exclude-file/Makefile b/tests/camlp4-exclude-file/Makefile
145 index ab13983..e2520fa 100644
146 --- a/tests/camlp4-exclude-file/Makefile
147 +++ b/tests/camlp4-exclude-file/Makefile
148 @@ -2,7 +2,7 @@ default:
149 @rm -fr *.result *.cmp
150 @for file in *.ml; do \
151 echo " testing '$$file' ..."; \
152 - $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
153 + $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
154 diff -q $$file.reference $$file.result || exit 1; \
155 done
156 @rm -fr *.result *.cmp
157 diff --git a/tests/camlp4-exclude/Makefile b/tests/camlp4-exclude/Makefile
158 index 18aada4..d71a7bc 100644
159 --- a/tests/camlp4-exclude/Makefile
160 +++ b/tests/camlp4-exclude/Makefile
161 @@ -2,7 +2,7 @@ default:
162 @rm -fr *.result *.cmp
163 @for file in *.ml; do \
164 echo " testing '$$file' ..."; \
165 - $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
166 + $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
167 diff -q $$file.reference $$file.result || exit 1; \
168 done
169 @rm -fr *.result *.cmp
170 diff --git a/tests/camlp4-instrument-fast/Makefile b/tests/camlp4-instrument-fast/Makefile
171 index f60767f..8506e38 100644
172 --- a/tests/camlp4-instrument-fast/Makefile
173 +++ b/tests/camlp4-instrument-fast/Makefile
174 @@ -2,7 +2,7 @@ default:
175 @rm -fr *.result *.cmp
176 @for file in *.ml; do \
177 echo " testing '$$file' ..."; \
178 - $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
179 + $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
180 diff -q $$file.reference $$file.result || exit 1; \
181 done
182 @rm -fr *.result *.cmp
183 diff --git a/tests/camlp4-instrument/Makefile b/tests/camlp4-instrument/Makefile
184 index 33fca72..a918118 100644
185 --- a/tests/camlp4-instrument/Makefile
186 +++ b/tests/camlp4-instrument/Makefile
187 @@ -2,7 +2,7 @@ default:
188 @rm -fr *.result *.cmp
189 @for file in *.ml; do \
190 echo " testing '$$file' ..."; \
191 - $(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
192 + $(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
193 diff -q $$file.reference $$file.result || exit 1; \
194 done
195 @rm -fr *.result *.cmp
196 diff --git a/tests/combine-expr/Makefile b/tests/combine-expr/Makefile
197 index 46ae9eb..e8e2af2 100644
198 --- a/tests/combine-expr/Makefile
199 +++ b/tests/combine-expr/Makefile
200 @@ -1,4 +1,4 @@
201 -COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
202 +COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
204 default: clean compile run report
206 diff --git a/tests/ppx-comments/Makefile b/tests/ppx-comments/Makefile
207 index f8c645a..667526f 100644
208 --- a/tests/ppx-comments/Makefile
209 +++ b/tests/ppx-comments/Makefile
210 @@ -2,7 +2,7 @@ default:
211 @rm -fr *.result *.cm*
212 @for file in *.ml; do \
213 echo " testing '$$file' ..."; \
214 - $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
215 + $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
216 diff -q $$file.reference $$file.result || exit 1; \
217 done
218 @rm -fr *.result *.cm*
219 diff --git a/tests/ppx-exclude-file/Makefile b/tests/ppx-exclude-file/Makefile
220 index a575a77..0dd1a20 100644
221 --- a/tests/ppx-exclude-file/Makefile
222 +++ b/tests/ppx-exclude-file/Makefile
223 @@ -2,7 +2,7 @@ default:
224 @rm -fr *.result *.cm*
225 @for file in *.ml; do \
226 echo " testing '$$file' ..."; \
227 - $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
228 + $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
229 diff -q $$file.reference $$file.result || exit 1; \
230 done
231 @rm -fr *.result *.cm*
232 diff --git a/tests/ppx-exclude/Makefile b/tests/ppx-exclude/Makefile
233 index a517af4..f502a42 100644
234 --- a/tests/ppx-exclude/Makefile
235 +++ b/tests/ppx-exclude/Makefile
236 @@ -2,7 +2,7 @@ default:
237 @rm -fr *.result *.cm*
238 @for file in *.ml; do \
239 echo " testing '$$file' ..."; \
240 - $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
241 + $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
242 diff -q $$file.reference $$file.result || exit 1; \
243 done
244 @rm -fr *.result *.cm*
245 diff --git a/tests/ppx-instrument-fast/Makefile b/tests/ppx-instrument-fast/Makefile
246 index da78bb6..1195988 100644
247 --- a/tests/ppx-instrument-fast/Makefile
248 +++ b/tests/ppx-instrument-fast/Makefile
249 @@ -2,7 +2,7 @@ default:
250 @rm -fr *.result *.cm*
251 @for file in *.ml; do \
252 echo " testing '$$file' ..."; \
253 - $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
254 + $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
255 diff -q $$file.reference $$file.result || exit 1; \
256 done
257 @rm -fr *.result *.cm*
258 diff --git a/tests/ppx-instrument/Makefile b/tests/ppx-instrument/Makefile
259 index f8c645a..667526f 100644
260 --- a/tests/ppx-instrument/Makefile
261 +++ b/tests/ppx-instrument/Makefile
262 @@ -2,7 +2,7 @@ default:
263 @rm -fr *.result *.cm*
264 @for file in *.ml; do \
265 echo " testing '$$file' ..."; \
266 - $(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
267 + $(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
268 diff -q $$file.reference $$file.result || exit 1; \
269 done
270 @rm -fr *.result *.cm*
271 diff --git a/tests/report/Makefile b/tests/report/Makefile
272 index a7ffe44..a968bf9 100644
273 --- a/tests/report/Makefile
274 +++ b/tests/report/Makefile
275 @@ -1,4 +1,4 @@
276 -COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
277 +COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
278 XMLLINT=$(shell which xmllint)
280 default: clean compile run report
282 2.18.0