Author: Andreas Tille <tille@debian.org>
Date: Thu, 26 Jul 2012 12:15:21 +0200
Description: Some adaptations to Debian
  * Enable building with Debian default compiler
  * Enable fixing rpath issue when build under Debian
  * Fix X11 path
  * Enable propagation of hardening flags

--- arb-5.3.orig/Makefile
+++ arb-5.3/Makefile
@@ -58,7 +58,9 @@
 	4.1.1 4.1.2 4.1.3 \
 	4.2.0 4.2.1 4.2.3 4.2.4 \
 	4.3 4.3.1 4.3.2 4.3.3 \
-	4.4.1 4.4.3 \
+	4.4.1 4.4.3 4.4.5 \
+	4.6 \
+	4.7
 
 ALLOWED_GCC_VERSIONS=$(ALLOWED_GCC_3xx_VERSIONS) $(ALLOWED_GCC_4xx_VERSIONS)
 
@@ -95,7 +97,12 @@
 	dflags := -DNDEBUG# defines
 	cflags := -O4# compiler flags (C and C++)
  ifndef DARWIN
-	lflags += -O99 --strip-all# linker flags
+	ifdef DEBIAN
+		lflags += -O2 -Wl,-rpath=/usr/lib/arb/lib # linker flags
+		# remark:  --strip-all option breaks g++ 4.6 and it's unwanted anyway
+	else
+		lflags += -O99 --strip-all# linker flags
+	endif
  endif
 endif
 
@@ -199,7 +206,11 @@
 
 #---------------------- X11 location
 
-XHOME:=/usr/X11R6
+ifdef DEBIAN
+	XHOME:=/usr
+else
+	XHOME:=/usr/X11R6
+endif
 XINCLUDES:=-I$(XHOME)/include
 
 ifdef DARWIN
@@ -281,9 +292,9 @@
 #	(instead define variables above)
 # -------------------------------------------------------------------------
 
-cflags += -W -Wall $(dflags) $(extended_warnings) $(cdynamic)
+cflags += $(CFLAGS) -W -Wall $(dflags) $(extended_warnings) $(cdynamic)
 
-cppflags := $(extended_cpp_warnings)
+cppflags := $(extended_cpp_warnings) $(CPPFLAGS)
 
 ifeq ($(DEVELOPER),RALF)
 HAVE_GNUPP0X=`SOURCE_TOOLS/requireVersion.pl 4.3 $(GCC_VERSION_FOUND)`
@@ -302,9 +313,9 @@
 
 PP := $(CPPreal)# preprocessor
 
-lflags += $(ldynamic)
+lflags += $(ldynamic) $(LDFLAGS)
 
-LINK_STATIC_LIB := ld $(lflags) -r -o# link static lib
+LINK_STATIC_LIB := ld -rpath=/usr/lib/arb/lib -r -o# link static lib
 LINK_EXECUTABLE := $(GPP) $(lflags) $(cdynamic) -o# link executable (c++)
 
 ifeq ($(LINK_STATIC),1)
