ports/devel/capstone/main/patches/patch-Makefile

59 lines
1.5 KiB
Text

1. Do not force some compilation flags.
2. Set library version, respecting OpenBSD policy.
3. Avoid duplication of defines, linked to (2).
4. Do not use $(INSTALL_*) at the build stage.
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -38,7 +38,7 @@ ifneq (,$(findstring yes,$(CAPSTONE_DIET)))
CFLAGS ?= -Os
CFLAGS += -DCAPSTONE_DIET
else
-CFLAGS ?= -O3
+CFLAGS ?=
endif
ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
@@ -100,8 +100,11 @@ INSTALL_DATA ?= $(INSTALL_BIN) -m0644
INSTALL_LIB ?= $(INSTALL_BIN) -m0755
LIBNAME = capstone
+LIBVER ?= 0.0.0
+ifdef LIB$(LIBNAME)_VERSION
+LIBVER = $(LIB$(LIBNAME)_VERSION)
+endif
-
DEP_ARM =
DEP_ARM += $(wildcard arch/ARM/ARM*.inc)
@@ -320,7 +323,7 @@ else
EXT = so
VERSION_EXT = $(EXT).$(API_MAJOR)
AR_EXT = a
-$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(VERSION_EXT)
+$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(EXT).$(LIBVER)
endif
endif
endif
@@ -331,7 +334,7 @@ LIBRARY = $(BLDIR)/$(LIBNAME).$(VERSION_EXT)
else ifeq ($(IS_CYGWIN),1)
LIBRARY = $(BLDIR)/$(LIBNAME).$(VERSION_EXT)
else # *nix
-LIBRARY = $(BLDIR)/lib$(LIBNAME).$(VERSION_EXT)
+LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT).$(LIBVER)
CFLAGS += -fvisibility=hidden
endif
endif
@@ -501,10 +504,6 @@ endif
ifeq ($(CAPSTONE_SHARED),yes)
define install-library
$(INSTALL_LIB) $(LIBRARY) $1
- $(if $(VERSION_EXT),
- cd $1 && \
- rm -f lib$(LIBNAME).$(EXT) && \
- ln -s lib$(LIBNAME).$(VERSION_EXT) lib$(LIBNAME).$(EXT))
endef
else
define install-library