openbsd-ports/graphics/openjpeg/patches/patch-Makefile
2007-12-03 00:36:44 +00:00

77 lines
2.9 KiB
Plaintext

$OpenBSD: patch-Makefile,v 1.3 2007/12/03 00:36:44 todd Exp $
--- Makefile.orig Mon Jun 4 08:27:25 2007
+++ Makefile Sun Dec 2 18:03:43 2007
@@ -1,7 +1,7 @@
# Linux makefile for OpenJPEG
-VER_MAJOR = 2
-VER_MINOR = 1.2.0
+VER_MAJOR ?= 2
+VER_MINOR ?= 1.2.0
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h
@@ -11,7 +11,7 @@ INCLUDE = -Ilibopenjpeg
CC = gcc
AR = ar
-PREFIX = /usr
+PREFIX ?= /usr
INSTALL_LIBDIR = $(PREFIX)/lib
INSTALL_INCLUDE = $(PREFIX)/include
@@ -19,14 +19,15 @@ INSTALL_INCLUDE = $(PREFIX)/include
DOS2UNIX = dos2unix
COMPILERFLAGS = -O3 -fPIC
-LIBRARIES = -lstdc++
+LIBRARIES =
MODULES = $(SRCS:.c=.o)
+SOMODULES = $(SRCS:.c=.so)
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
TARGET = openjpeg
STATICLIB = lib$(TARGET).a
-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
+SHAREDLIB = lib$(TARGET).so.$(LIBopenjpeg_VERSION)
LIBNAME = lib$(TARGET).so.$(VER_MAJOR)
@@ -47,23 +48,26 @@ dos2unix:
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
+.SUFFIXES: .c .o .so
+
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
+.c.so:
+ $(CC) $(CFLAGS) -fPIC -c $< -o $@
+
$(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
-$(SHAREDLIB): $(MODULES)
- $(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
+$(SHAREDLIB): $(SOMODULES)
+ $(CC) -s -shared -fPIC -o $@ $(SOMODULES) $(LIBRARIES)
install: OpenJPEG
- install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
- install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
- ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
- install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
- ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
- install -m 644 -o root -g root libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
- -ldconfig
+ ${BSD_INSTALL_DATA_DIR} '$(INSTALL_LIBDIR)' '$(INSTALL_INCLUDE)'
+ ${BSD_INSTALL_DATA} $(STATICLIB) '$(INSTALL_LIBDIR)'
+ ranlib '$(INSTALL_LIBDIR)/$(STATICLIB)'
+ ${BSD_INSTALL_DATA} $(SHAREDLIB) '$(INSTALL_LIBDIR)'
+ ${BSD_INSTALL_DATA} libopenjpeg/openjpeg.h '$(INSTALL_INCLUDE)'
clean:
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)