File pythia-remove-rpaths.patch of Package pythia

Index: pythia8311/Makefile
===================================================================
--- pythia8311.orig/Makefile
+++ pythia8311/Makefile
@@ -36,7 +36,11 @@ LOCAL_TMP=tmp
 LOCAL_MKDIRS:=$(shell mkdir -p $(LOCAL_TMP) $(LOCAL_LIB))
 CXX_COMMON:=-I$(LOCAL_INCLUDE) $(CXX_COMMON)
 OBJ_COMMON:=-MD $(CXX_COMMON) $(OBJ_COMMON)
-LIB_COMMON=-Wl,-rpath,../lib:$(PREFIX_LIB) -ldl $(GZIP_LIB)
+ifneq ($(DISABLE_RPATH),true)
+  LIB_COMMON=-Wl,-rpath,$(PREFIX_LIB) -ldl $(GZIP_LIB)
+else
+  LIB_COMMON=-ldl $(GZIP_LIB)
+endif
 
 # PYTHIA.
 OBJECTS=$(patsubst $(LOCAL_SRC)/%.cc,$(LOCAL_TMP)/%.o,\
@@ -124,7 +128,11 @@ $(LOCAL_LIB)/libpythia8powheg%.so: $(POW
 	$(LOCAL_TMP)/LHAPowheg.o $(LOCAL_LIB)/libpythia8$(LIB_SUFFIX)
 	$(CXX) $(LOCAL_TMP)/LHAPowheg.o -o $@ $(CXX_COMMON) $(CXX_SHARED)\
 	 $(CXX_SONAME)$(notdir $@) -Llib -lpythia8\
+ifneq ($(DISABLE_RPATH),true)
 	 -Wl,-rpath,../lib:$(POWHEG_BIN) -L$(POWHEG_BIN) -l$*
+else
+	 -L$(POWHEG_BIN) -l$*
+endif
 $(LOCAL_LIB)/libpythia8powhegHooks.so: $(LOCAL_TMP)/PowhegHooks.o\
 	$(LOCAL_LIB)/libpythia8$(LIB_SUFFIX)
 	$(CXX) $< -o $@ $(CXX_COMMON) $(CXX_SHARED) $(CXX_SONAME)$(notdir $@)\
Index: pythia8311/configure
===================================================================
--- pythia8311.orig/configure
+++ pythia8311/configure
@@ -30,6 +30,7 @@ Configuration options.
 --help            : Print this help message (also -h, --h, and -help).
 --enable-debug    : Turn on debugging and disable optimization.
 --enable-optdebug : Turn on debugging but allow optimization.
+--disable-rpath   : Disable use of rpath for linking.
 --lcg=PLATFORM    : Specify the LCG platform to use when the
                     --with-PACKAGE-version option, described below,
                     is set for a given optional package
@@ -95,7 +96,7 @@ Advanced options.
 --obj-common='FLAGS' : Set the common C++ flags used for object (.o) compilation
                        only (not linking).
 BLOCKTEXT
-OPTIONS="-h --h -help --help --enable-debug --enable-optdebug --lcg --lcg-ver"
+OPTIONS="-h --h -help --help --enable-debug --enable-optdebug --disable-rpath --lcg --lcg-ver"
 OPTIONS+=" --prefix --prefix-bin --prefix-lib --prefix-include --prefix-share"
 for PKG in "evtgen" "fastjet3" "hepmc2" "hepmc3" "lhapdf5" "lhapdf6" "powheg"\
     "rivet" "root" "gzip" "python" "mg5mes" "openmp" "mpich" "hdf5"\
@@ -320,6 +321,7 @@ done
 # Set the compilation flags and options (order matters).
 [ "$ENABLE_DEBUG_SET"    = true ] && ENABLE_DEBUG="-g "   || ENABLE_DEBUG="-O2 "
 [ "$ENABLE_OPTDEBUG_SET" = true ] && ENABLE_DEBUG="-g -O "
+[ "$DISABLE_RPATH_SET"   = true ] && DISABLE_RPATH="true" || DISABLE_RPATH="false"
 if [ -z "$ARCH" ]; then ARCH=$(uname | grep -i -o -e Linux -e Darwin); fi
 ARCH=$(echo $ARCH | awk '{print toupper($0)}')
 if [ "$ARCH" != "LINUX" ] && [ "$ARCH" != "DARWIN" ]; then
@@ -453,6 +455,7 @@ PREFIX_LIB=$PREFIX_LIB
 PREFIX_SHARE=$PREFIX_SHARE
 
 # Compilation flags (see ./configure --help for further documentation).
+DISABLE_RPATH=$DISABLE_RPATH
 CXX=$CXX
 CXX_COMMON=$CXX_COMMON
 CXX_SHARED=$CXX_SHARED
Index: pythia8311/plugins/mg5mes/Makefile
===================================================================
--- pythia8311.orig/plugins/mg5mes/Makefile
+++ pythia8311/plugins/mg5mes/Makefile
@@ -28,7 +28,11 @@ LOCAL_DIRS:=$(subst $(LOCAL_TMP)/,,$(wil
 LOCAL_MKDIRS:=$(shell mkdir -p $(LOCAL_TMP) $(TOP_LIB))
 LOCAL_MKDIRS:=$(foreach DIR,$(LOCAL_DIRS),$(shell mkdir -p $(LOCAL_TMP)/$(DIR)))
 OBJ_COMMON=-MD -DPYTHIA8 $(CXX_COMMON) -I$(TOP_INCLUDE) -w -fpermissive
-LIB_COMMON=-Wl,-rpath,$(TOP_LIB) -ldl $(GZIP_LIB) -Wl,-undefined,dynamic_lookup
+ifneq ($(DISABLE_RPATH),true)
+  LIB_COMMON=-Wl,-rpath,$(TOP_LIB) -ldl $(GZIP_LIB) -Wl,-undefined,dynamic_lookup
+else
+  LIB_COMMON=-ldl $(GZIP_LIB) -Wl,-undefined,dynamic_lookup
+endif
 PYTHIA=$(TOP_LIB)/libpythia8$(LIB_SUFFIX)
 
 # Set the wrapper, determine the objects and targets.
Index: pythia8311/plugins/python/Makefile
===================================================================
--- pythia8311.orig/plugins/python/Makefile
+++ pythia8311/plugins/python/Makefile
@@ -27,7 +27,11 @@ LOCAL_TMP=tmp
 LOCAL_INCLUDE=include
 LOCAL_MKDIRS:=$(shell mkdir -p $(LOCAL_TMP) $(TOP_LIB))
 OBJ_COMMON=-MD $(CXX_COMMON) -Iinclude $(PYTHON_INCLUDE) -w -fpermissive
-LIB_COMMON=-Wl,-rpath,$(TOP_LIB) -ldl $(GZIP_LIB)
+ifneq ($(DISABLE_RPATH),true)
+  LIB_COMMON=-Wl,-rpath,$(TOP_LIB) -ldl $(GZIP_LIB)
+else
+  LIB_COMMON=-ldl $(GZIP_LIB)
+endif
 PYTHIA=$(TOP_LIB)/libpythia8$(LIB_SUFFIX)
 
 # Determine the headers.
@@ -76,9 +80,15 @@ $(LOCAL_TMP)/%.o: $(LOCAL_SRC)/%.cpp $(L
 
 # Build the library.
 $(TOP_LIB)/pythia8.so: $(PYTHIA) $(HEADERS) $(OBJECTS)
+ifneq ($(DISABLE_RPATH),true)
 	$(CXX) $(OBJECTS) -o $@ $(CXX_COMMON) $(CXX_SHARED)\
 	 $(CXX_SONAME)$(notdir $@) $(LIB_COMMON) -L$(TOP_LIB)\
 	 -Wl,-rpath,$(PREFIX_LIB) -lpythia8 -Wl,-undefined,dynamic_lookup
+else
+	$(CXX) $(OBJECTS) -o $@ $(CXX_COMMON) $(CXX_SHARED)\
+	 $(CXX_SONAME)$(notdir $@) $(LIB_COMMON) -L$(TOP_LIB)\
+	 -lpythia8 -Wl,-undefined,dynamic_lookup
+endif
 
 # Clean.
 clean:
Index: pythia8311/examples/Makefile
===================================================================
--- pythia8311.orig/examples/Makefile
+++ pythia8311/examples/Makefile
@@ -26,7 +26,7 @@ ifneq ("$(wildcard ../lib/libpythia8.*)"
   PREFIX_INCLUDE=../include
 endif
 CXX_COMMON:=$(OBJ_COMMON) -I$(PREFIX_INCLUDE) $(CXX_COMMON) $(GZIP_LIB)
-CXX_COMMON+= -L$(PREFIX_LIB) -Wl,-rpath,$(PREFIX_LIB) -lpythia8 -ldl
+CXX_COMMON+= -L$(PREFIX_LIB) -lpythia8 -ldl
 PYTHIA=$(PREFIX_LIB)/libpythia8$(LIB_SUFFIX)
 
 # Fix missing runtime paths from RIVET and determine C++ standard used.
openSUSE Build Service is sponsored by