$NetBSD: patch-ab,v 1.25 2022/07/23 15:09:43 leot Exp $ - Handle the various operating systems in the same way avoiding hardcoding - Avoid to use objcopy by setting HAVE_OBJCOPY to no (if `yes', and with `USE_TOOLS+= objcopy' the objcopy-ing fails as follow: OBJCOPY build/release/resources/fonts/urw/Dingbats.cff.o build/release/resources/fonts/urw/Dingbats.cff.o:1: warning: NUL character seen; rest of line ignored build/release/resources/fonts/urw/Dingbats.cff.o:1: *** missing separator. Stop. (also for other fonts)). This needs to be investigated further. - Avoid internal version of freeglut and try to pick it up via pkg-config and set SYS_GLUT_{CFLAGS,LIBS} accordingly. - Avoid internal version of lcms2 and try to pick it up via pkg-config and set SYS_LCMS2_{CFLAGS,LIBS} accordingly. If no lcms2 is available just pass `-DFZ_ENABLE_ICC=0' to disable it via CFLAGS. --- Makerules.orig 2022-06-14 12:19:22.000000000 +0000 +++ Makerules @@ -27,30 +27,6 @@ endif # System specific features -ifeq ($(findstring -fembed-bitcode,$(XCFLAGS)),) - # clang does not support these in combination with -fembed-bitcode - CFLAGS += -ffunction-sections -fdata-sections -endif - -ifeq ($(OS),MACOS) - LDREMOVEUNREACH := -Wl,-dead_strip - SO := dylib -else - LDREMOVEUNREACH := -Wl,--gc-sections - ifeq ($(OS),MINGW) - SO := dll - EXE := .exe - else - SO := so - endif -endif - -ifeq "$(OS)" "ios" - NEONFLAGS = -else - NEONFLAGS = -mneon -endif - SANITIZE_FLAGS += -fsanitize=address SANITIZE_FLAGS += -fsanitize=leak @@ -133,103 +109,79 @@ ifneq "$(CLUSTER)" "" CFLAGS += -DCLUSTER endif -ifeq ($(OS),MINGW) - WINDRES := windres - HAVE_WIN32 := yes - -else ifeq ($(OS),MACOS) - HAVE_GLUT := yes - SYS_GLUT_CFLAGS := -Wno-deprecated-declarations - SYS_GLUT_LIBS := -framework GLUT -framework OpenGL - CC = xcrun cc - AR = xcrun ar - LD = xcrun ld - RANLIB = xcrun ranlib - - ifeq (, $(shell which pkg-config)) - $(warning "No pkg-config found, install it for proper integration of libcrypto") - else - HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes) - ifeq ($(HAVE_LIBCRYPTO),yes) - LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO - LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto) - endif - endif +HAVE_OBJCOPY := no -else ifeq ($(OS),Linux) - HAVE_OBJCOPY := yes - - ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes) +ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes) SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2) SYS_FREETYPE_LIBS := $(shell pkg-config --libs freetype2) - endif - ifeq ($(shell pkg-config --exists gumbo && echo yes),yes) +endif +ifeq ($(shell pkg-config --exists gumbo && echo yes),yes) SYS_GUMBO_CFLAGS := $(shell pkg-config --cflags gumbo) SYS_GUMBO_LIBS := $(shell pkg-config --libs gumbo) - endif - ifeq ($(shell pkg-config --exists harfbuzz && echo yes),yes) +endif +ifeq ($(shell pkg-config --exists harfbuzz && echo yes),yes) SYS_HARFBUZZ_CFLAGS := $(shell pkg-config --cflags harfbuzz) SYS_HARFBUZZ_LIBS := $(shell pkg-config --libs harfbuzz) - endif - ifeq ($(shell pkg-config --exists lcms2 && echo yes),yes) +endif +ifeq ($(shell pkg-config --exists lcms2 && echo yes),yes) SYS_LCMS2_CFLAGS := $(shell pkg-config --cflags lcms2) SYS_LCMS2_LIBS := $(shell pkg-config --libs lcms2) - endif - ifeq ($(shell pkg-config --exists libjpeg && echo yes),yes) +else + CFLAGS += -DFZ_ENABLE_ICC=0 +endif +ifeq ($(shell pkg-config --exists libjpeg && echo yes),yes) SYS_LIBJPEG_CFLAGS := $(shell pkg-config --cflags libjpeg) SYS_LIBJPEG_LIBS := $(shell pkg-config --libs libjpeg) - endif - ifeq ($(shell pkg-config --exists libopenjp2 && echo yes),yes) +endif +ifeq ($(shell pkg-config --exists libopenjp2 && echo yes),yes) SYS_OPENJPEG_CFLAGS := $(shell pkg-config --cflags libopenjp2) SYS_OPENJPEG_LIBS := $(shell pkg-config --libs libopenjp2) - endif - ifeq ($(shell pkg-config --exists zlib && echo yes),yes) +endif +ifeq ($(shell pkg-config --exists zlib && echo yes),yes) SYS_ZLIB_CFLAGS := $(shell pkg-config --cflags zlib) SYS_ZLIB_LIBS := $(shell pkg-config --libs zlib) - endif +endif - HAVE_SYS_LEPTONICA := $(shell pkg-config --exists 'lept >= 1.7.4' && echo yes) - ifeq ($(HAVE_SYS_LEPTONICA),yes) +HAVE_SYS_LEPTONICA := $(shell pkg-config --exists 'lept >= 1.7.4' && echo yes) +ifeq ($(HAVE_SYS_LEPTONICA),yes) SYS_LEPTONICA_CFLAGS := $(shell pkg-config --cflags lept) SYS_LEPTONICA_LIBS := $(shell pkg-config --libs lept) - endif +endif - HAVE_SYS_TESSERACT := $(shell pkg-config --exists 'tesseract >= 4.0.0' && echo yes) - ifeq ($(HAVE_SYS_TESSERACT),yes) +HAVE_SYS_TESSERACT := $(shell pkg-config --exists 'tesseract >= 4.0.0' && echo yes) +ifeq ($(HAVE_SYS_TESSERACT),yes) SYS_TESSERACT_CFLAGS := $(shell pkg-config --cflags tesseract) SYS_TESSERACT_LIBS := $(shell pkg-config --libs tesseract) - endif +endif - HAVE_SYS_CURL := $(shell pkg-config --exists libcurl && echo yes) - ifeq ($(HAVE_SYS_CURL),yes) +HAVE_SYS_CURL := $(shell pkg-config --exists libcurl && echo yes) +ifeq ($(HAVE_SYS_CURL),yes) SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl) SYS_CURL_LIBS := $(shell pkg-config --libs libcurl) - endif +endif - HAVE_GLUT := yes - ifeq ($(HAVE_GLUT),yes) - SYS_GLUT_CFLAGS := - SYS_GLUT_LIBS := -lglut -lGL - endif +HAVE_GLUT := $(shell pkg-config --exists glut && echo yes) +ifeq ($(shell pkg-config --exists glut && echo yes),yes) + SYS_GLUT_CFLAGS := $(shell pkg-config --cflags glut) + SYS_GLUT_LIBS := $(shell pkg-config --libs glut) +endif - HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes) - ifeq ($(HAVE_X11),yes) +HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes) +ifeq ($(HAVE_X11),yes) X11_CFLAGS := $(shell pkg-config --cflags x11 xext) X11_LIBS := $(shell pkg-config --libs x11 xext) - endif +endif - HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes) - ifeq ($(HAVE_LIBCRYPTO),yes) +HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes) +ifeq ($(HAVE_LIBCRYPTO),yes) LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto) - endif +endif - HAVE_PTHREAD := yes - ifeq ($(HAVE_PTHREAD),yes) +HAVE_PTHREAD := yes +ifeq ($(HAVE_PTHREAD),yes) PTHREAD_CFLAGS := PTHREAD_LIBS := -lpthread - endif - endif # The following section has various cross compilation configurations.