@@ -5,7 +5,7 @@ CURRENT_DIR := $(subst $(SPACE),"\\ ",$(CURDIR))
5
5
6
6
LUA_DIR =lua-5.4.2
7
7
HIGHLIGHT_DIR =highlight
8
- MAGIC_DIR =file-5.39
8
+ MAGIC_DIR =file-5.41
9
9
10
10
ifeq ($(BUILT_PRODUCTS_DIR ) ,)
11
11
BUILD_DIR=${CURRENT_DIR}/build
@@ -219,19 +219,29 @@ ${BUILD_DIR}/libmagic-x86_64.a:
219
219
ifneq ("$(wildcard $(MAGIC_DIR ) /Makefile) ","")
220
220
@${MAKE} -C ${MAGIC_DIR} clean
221
221
endif
222
- cd $(MAGIC_DIR) && CFLAGS="${CFLAGS_x86_64}" ./configure --enable-static --disable-zlib --disable-bzlib --disable-xzlib
223
- ${MAKE} -C ${MAGIC_DIR}
222
+ cd $(MAGIC_DIR) && CFLAGS="${CFLAGS_x86_64}" ./configure --host=x86_64-apple --enable-static --disable-zlib --disable-bzlib --disable-xzlib
223
+ # Change the PATH to use the native `file`.
224
+ PATH="${BUILD_DIR}:${PATH}" ${MAKE} -C ${MAGIC_DIR}
224
225
mv ${MAGIC_DIR}/src/.libs/libmagic.a ${BUILD_DIR}/libmagic-x86_64.a
226
+ ifeq ($(NATIVE_ARCH ) ,x86_64)
227
+ # Copy the file executable for the current cpu to be used to compile the magic.mgc file for a different cpu target.
228
+ cp ${MAGIC_DIR}/src/file ${BUILD_DIR}/file
229
+ endif
225
230
@echo ""
226
231
227
232
${BUILD_DIR}/libmagic-arm64.a :
228
233
@echo " ${bold} Building magic for arm64 platform...${normal} "
229
234
ifneq ("$(wildcard $(MAGIC_DIR ) /Makefile) ","")
230
235
@${MAKE} -C ${MAGIC_DIR} clean
231
236
endif
232
- cd $(MAGIC_DIR) && CFLAGS="-target arm64-apple-macos11.0" ./configure --host=arm-apple --enable-static --disable-zlib --disable-bzlib --disable-xzlib
233
- ${MAKE} -C ${MAGIC_DIR}
237
+ cd $(MAGIC_DIR) && CFLAGS="${CFLAGS_arm64}" ./configure --host=arm-apple --enable-static --disable-zlib --disable-bzlib --disable-xzlib
238
+ # Change the PATH to use the native `file`.
239
+ PATH="${BUILD_DIR}:${PATH}" ${MAKE} -C ${MAGIC_DIR}
234
240
mv ${MAGIC_DIR}/src/.libs/libmagic.a ${BUILD_DIR}/libmagic-arm64.a
241
+ ifeq ($(NATIVE_ARCH ) ,arm64)
242
+ # Copy the file executable for the current cpu to be used to compile the magic.mgc file for a different cpu target.
243
+ cp ${MAGIC_DIR}/src/file ${BUILD_DIR}/file
244
+ endif
235
245
@echo ""
236
246
237
247
${BUILD_DIR}/libmagic.a : ${magic_libraries}
@@ -246,6 +256,7 @@ endif
246
256
@echo ""
247
257
248
258
${BUILD_DIR}/magic.mgc :
259
+ @echo " ${bold} Creating magic.mgc...${normal} "
249
260
file -C -m magic
250
261
mv magic.mgc ${BUILD_DIR} /
251
262
338
349
cp ${BUILD_DIR}/libwrapper_highlight-${NATIVE_ARCH}.dylib ${BUILD_DIR}/libwrapper_highlight.dylib
339
350
endif
340
351
341
- all : check_arch build_dir lua highlight magic magic_db goutils highlight-wrapper
352
+ all : check_arch build_dir magic magic_db lua highlight goutils highlight-wrapper
353
+ install : check_arch build_dir magic magic_db lua highlight goutils highlight-wrapper
342
354
343
355
clean_intermediate : clean_lua clean_highlight clean_magic clean_goutils clean_highlight-wrapper
344
356
0 commit comments