pkgsrc/audio/ladspa/patches/patch-aa
kamil c2ed108fd9 ladspa: Correct injection of CFLAGS, CXXFLAGS, LDFLAGS
Patch the upstream makefile to rename CFLAGS, CXXFLAGS, LDFLAGS to
LOCAL_*. Retrieve  CFLAGS, CXXFLAGS, LDFLAGS from pkgsrc.

This package uses homegrown hardcoded macros for libraries (-fPIC), this
is not portable and should be adjusted in future.

This unbreaks build on NetBSD/amd64 8.99.7 as of today.
2017-11-25 11:57:28 +00:00

119 lines
3.8 KiB
Text

$NetBSD: patch-aa,v 1.7 2017/11/25 11:57:28 kamil Exp $
* Fix the destination directories
* Use cc(1) to link the plug-ins
* Add support for CFLAGS and LDFLAGS
--- makefile.orig 2007-11-06 10:42:45.000000000 +0000
+++ makefile
@@ -4,9 +4,9 @@
#
# Change these if you want to install somewhere else.
-INSTALL_PLUGINS_DIR = /usr/lib/ladspa/
-INSTALL_INCLUDE_DIR = /usr/include/
-INSTALL_BINARY_DIR = /usr/bin/
+INSTALL_PLUGINS_DIR = ${PREFIX}/lib/ladspa/
+INSTALL_INCLUDE_DIR = ${PREFIX}/include/
+INSTALL_BINARY_DIR = ${PREFIX}/bin/
###############################################################################
#
@@ -14,9 +14,10 @@ INSTALL_BINARY_DIR = /usr/bin/
#
INCLUDES = -I.
-LIBRARIES = -ldl -lm
-CFLAGS = $(INCLUDES) -Wall -Werror -O3 -fPIC
-CXXFLAGS = $(CFLAGS)
+LOCAL_CPPFLAGS = $(INCLUDES) -fPIC $(CPPFLAGS)
+LOCAL_CFLAGS = $(INCLUDES) -fPIC $(CFLAGS)
+LIBRARIES = $(DL_LIBS) -lm
+LOCAL_LDFLAGS = $(LDFLAGS)
PLUGINS = ../plugins/amp.so \
../plugins/delay.so \
../plugins/filter.so \
@@ -25,8 +26,8 @@ PLUGINS = ../plugins/amp.so \
PROGRAMS = ../bin/analyseplugin \
../bin/applyplugin \
../bin/listplugins
-CC = cc
-CPP = c++
+#CC = cc
+#CPP = c++
###############################################################################
#
@@ -34,12 +35,12 @@ CPP = c++
#
../plugins/%.so: plugins/%.c ladspa.h
- $(CC) $(CFLAGS) -o plugins/$*.o -c plugins/$*.c
- $(LD) -o ../plugins/$*.so plugins/$*.o -shared
+ $(CC) $(LOCAL_CPPFLAGS) $(LOCAL_CFLAGS) -o plugins/$*.o -c plugins/$*.c
+ $(CC) -shared $(LOCAL_LDFLAGS) -o ../plugins/$*.so plugins/$*.o
../plugins/%.so: plugins/%.cpp ladspa.h
- $(CPP) $(CXXFLAGS) -o plugins/$*.o -c plugins/$*.cpp
- $(CPP) -o ../plugins/$*.so plugins/$*.o -shared
+ $(CXX) $(LOCAL_CPPFLAGS) $(LOCAL_CXXFLAGS) -o plugins/$*.o -c plugins/$*.cpp
+ $(CXX) -shared $(LOCAL_LDFLAGS) -o ../plugins/$*.so plugins/$*.o
###############################################################################
#
@@ -58,13 +59,13 @@ test: /tmp/test.wav ../snd/noise.wav alw
-sndfile-play /tmp/test.wav
@echo Test complete.
-install: targets
- -mkdirhier $(INSTALL_PLUGINS_DIR)
- -mkdirhier $(INSTALL_INCLUDE_DIR)
- -mkdirhier $(INSTALL_BINARY_DIR)
- cp ../plugins/* $(INSTALL_PLUGINS_DIR)
- cp ladspa.h $(INSTALL_INCLUDE_DIR)
- cp ../bin/* $(INSTALL_BINARY_DIR)
+install:
+ $(BSD_INSTALL_DATA_DIR) ${DESTDIR}$(INSTALL_PLUGINS_DIR)
+ $(BSD_INSTALL_DATA_DIR) ${DESTDIR}$(INSTALL_INCLUDE_DIR)
+ $(BSD_INSTALL_DATA_DIR) ${DESTDIR}$(INSTALL_BINARY_DIR)
+ $(BSD_INSTALL_DATA) ../plugins/* ${DESTDIR}$(INSTALL_PLUGINS_DIR)
+ $(BSD_INSTALL_DATA) ladspa.h ${DESTDIR}$(INSTALL_INCLUDE_DIR)
+ $(BSD_INSTALL_PROGRAM) ../bin/* ${DESTDIR}$(INSTALL_BINARY_DIR)
/tmp/test.wav: targets ../snd/noise.wav
../bin/listplugins
@@ -82,7 +83,7 @@ install: targets
../plugins/delay.so delay_5s 1 0.1 \
../plugins/amp.so amp_mono 4 \
-targets: $(PLUGINS) $(PROGRAMS)
+all: $(PLUGINS) $(PROGRAMS)
###############################################################################
#
@@ -90,17 +91,17 @@ targets: $(PLUGINS) $(PROGRAMS)
#
../bin/applyplugin: applyplugin.o load.o default.o
- $(CC) $(CFLAGS) $(LIBRARIES) \
+ $(CC) $(LOCAL_LDFLAGS) $(LIBRARIES) \
-o ../bin/applyplugin \
applyplugin.o load.o default.o
../bin/analyseplugin: analyseplugin.o load.o default.o
- $(CC) $(CFLAGS) $(LIBRARIES) \
+ $(CC) $(LOCAL_LDFLAGS) $(LIBRARIES) \
-o ../bin/analyseplugin \
analyseplugin.o load.o default.o
../bin/listplugins: listplugins.o search.o
- $(CC) $(CFLAGS) $(LIBRARIES) \
+ $(CC) $(LOCAL_LDFLAGS) $(LIBRARIES) \
-o ../bin/listplugins \
listplugins.o search.o
@@ -123,4 +124,3 @@ backup: clean
tar czf `date '+../backup/ladspa_sdk.%Y%m%d%H%M.tgz'` ladspa_sdk/)
###############################################################################
-