Correctly set RPATH for private libraries

Fix the --bindir/libdir/datadir args passed to premake: they need to
have = in it for premake to understand it. Getting this right makes the
build system correctly set RPATH so that it's set to $libdir/0ad where
we have the private libs.

This makes it possible to drop the 0ad-rpath.patch and 0ad launcher
shell script that set LD_LIBRARY_PATH and instead just rely on the
RPATH and the datadir being correct.
This commit is contained in:
Kalev Lember 2019-02-06 16:19:32 +01:00
commit a2935abb20
2 changed files with 8 additions and 76 deletions

View file

@ -1,60 +0,0 @@
diff -uNr 0ad-0.0.23-alpha.orig/build/premake/premake4.lua 0ad-0.0.23-alpha/build/premake/premake4.lua
--- 0ad-0.0.23-alpha.orig/build/premake/premake4.lua 2018-04-29 17:44:48.000000000 +0200
+++ 0ad-0.0.23-alpha/build/premake/premake4.lua 2018-05-22 13:23:25.238894337 +0200
@@ -356,26 +356,6 @@
defines { "INSTALLED_LIBDIR=" .. _OPTIONS["libdir"] }
end
- if os.is("linux") or os.is("bsd") then
- -- To use our local shared libraries, they need to be found in the
- -- runtime dynamic linker path. Add their path to -rpath.
- if _OPTIONS["libdir"] then
- linkoptions {"-Wl,-rpath," .. _OPTIONS["libdir"] }
- else
- -- On FreeBSD we need to allow use of $ORIGIN
- if os.is("bsd") then
- linkoptions { "-Wl,-z,origin" }
- end
-
- -- Adding the executable path and taking care of correct escaping
- if _ACTION == "gmake" then
- linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
- elseif _ACTION == "codeblocks" then
- linkoptions { "-Wl,-R\\\\$$$ORIGIN" }
- end
- end
- end
-
end
end
diff -uNr 0ad-0.0.23-alpha.orig/build/premake/premake5.lua 0ad-0.0.23-alpha/build/premake/premake5.lua
--- 0ad-0.0.23-alpha.orig/build/premake/premake5.lua 2018-04-22 20:14:45.000000000 +0200
+++ 0ad-0.0.23-alpha/build/premake/premake5.lua 2018-05-22 13:23:29.022903711 +0200
@@ -344,26 +344,6 @@
defines { "INSTALLED_LIBDIR=" .. _OPTIONS["libdir"] }
end
- if os.istarget("linux") or os.istarget("bsd") then
- -- To use our local shared libraries, they need to be found in the
- -- runtime dynamic linker path. Add their path to -rpath.
- if _OPTIONS["libdir"] then
- linkoptions {"-Wl,-rpath," .. _OPTIONS["libdir"] }
- else
- -- On FreeBSD we need to allow use of $ORIGIN
- if os.istarget("bsd") then
- linkoptions { "-Wl,-z,origin" }
- end
-
- -- Adding the executable path and taking care of correct escaping
- if _ACTION == "gmake" then
- linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
- elseif _ACTION == "codeblocks" then
- linkoptions { "-Wl,-R\\\\$$$ORIGIN" }
- end
- end
- end
-
end
end

View file

@ -19,7 +19,7 @@
Name: 0ad
Version: 0.0.23b
Release: 4%{?dist}
Release: 5%{?dist}
# BSD License:
# build/premake/*
# libraries/source/miniupnpc/* (not built/used)
@ -98,9 +98,6 @@ BuildRequires: /usr/bin/python
ExclusiveArch: %{ix86} x86_64 %{arm} aarch64
# http://trac.wildfiregames.com/ticket/1421
Patch0: %{name}-rpath.patch
# Only do fcollada debug build with enabling debug maintainer mode
# It also prevents assumption there that it is building in x86
Patch1: %{name}-debug.patch
@ -127,7 +124,6 @@ hobbyist game developers, since 2001.
#-----------------------------------------------------------------------
%prep
%setup -q -n %{name}-%{version}-alpha
%patch0 -p1
%if ! %{with debug}
# disable debug build, and "int 0x3" to trap to debugger (x86 only)
%patch1 -p0
@ -150,9 +146,9 @@ export CFLAGS="%{optflags}"
# avoid warnings with gcc 4.7 due to _FORTIFY_SOURCE in CPPFLAGS
export CPPFLAGS="`echo %{optflags} | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//'`"
build/workspaces/update-workspaces.sh \
--bindir %{_bindir} \
--datadir %{_datadir}/%{name} \
--libdir %{_libdir}/%{name} \
--bindir=%{_bindir} \
--datadir=%{_datadir}/%{name} \
--libdir=%{_libdir}/%{name} \
--with-system-mozjs38 \
%if %{with system_nvtt}
--with-system-nvtt \
@ -176,6 +172,7 @@ LD_LIBRARY_PATH=binaries/system binaries/system/test%{dbg} -libdir binaries/syst
#-----------------------------------------------------------------------
%install
install -d -m 755 %{buildroot}%{_bindir}
install -p -m 755 build/resources/0ad.sh %{buildroot}%{_bindir}/0ad
install -p -m 755 binaries/system/pyrogenesis%{dbg} %{buildroot}%{_bindir}/pyrogenesis%{dbg}
install -d -m 755 %{buildroot}%{_libdir}/%{name}
@ -207,14 +204,6 @@ ln -sf %{name}.6 %{buildroot}%{_mandir}/man6/pyrogenesis.6
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
cat > %{buildroot}%{_bindir}/0ad <<EOF
#!/bin/sh
cd %{_datadir}/0ad
LD_LIBRARY_PATH=%{_libdir}/0ad %{_bindir}/pyrogenesis%{dbg} "\$@"
EOF
chmod +x %{buildroot}%{_bindir}/0ad
%if %{with debug}
export STRIP=/bin/true
%endif
@ -234,6 +223,9 @@ export STRIP=/bin/true
%{_mandir}/man6/*.6*
%changelog
* Wed Feb 06 2019 Kalev Lember <klember@redhat.com> - 0.0.23b-5
- Correctly set RPATH for private libraries
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.23b-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild