SHA256
1
0
forked from pool/lxd

Accepting request 689241 from home:cyphar:lxc

- Use RUNPATH instead of RPATH.
- Add libuv version constraint.

OBS-URL: https://build.opensuse.org/request/show/689241
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxd?expand=0&rev=3
This commit is contained in:
Aleksa Sarai 2019-03-28 07:07:34 +00:00 committed by Git OBS Bridge
parent 6f51ca789c
commit 37bd095479

View File

@ -44,7 +44,7 @@ BuildRequires: fdupes
BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: tcl-devel
BuildRequires: libuv-devel
BuildRequires: libuv-devel >= 1.8.0
# Bits required for images and other things at runtime.
Requires: acl
BuildRequires: dnsmasq
@ -124,9 +124,6 @@ autoreconf -fiv
--with-pic
make clean
make %{?_smp_mflags}
# We want to set rpath to our fake _libdir -- not $PWD/../sqlite/.libs/.
# And we *absolutely* want DT_RPATH.
patchelf --force-rpath --set-rpath '%{_libdir}/%{name}' .libs/libdqlite.so
)
popd
@ -142,20 +139,22 @@ for mainpkg in "${mainpkgs[@]}"
do
binary="$(basename "$mainpkg")"
(
if [[ "$binary" == "lxd" ]]
then
# We need to link against sqlite and dqlite only when dealing with lxd proper.
export CGO_CFLAGS="%{optflags} -I$PKGDIR/dist/sqlite/ -I$PKGDIR/dist/dqlite/include/"
export CGO_LDFLAGS="-L$PKGDIR/dist/sqlite/.libs/ -L$PKGDIR/dist/dqlite/.libs/"
export PKG_CONFIG_PATH="$PKGDIR/dist/sqlite:$PKGDIR/dist/dqlite"
fi
go build -buildmode=pie -tags "libsqlite3" -o "bin/$binary" "$mainpkg"
[[ "$binary" == "lxd" ]] && export \
BUILDTAGS="libsqlite3" \
CGO_CFLAGS="%{optflags} -I$PKGDIR/dist/sqlite/ -I$PKGDIR/dist/dqlite/include/" \
CGO_LDFLAGS="-L$PKGDIR/dist/sqlite/.libs/ -L$PKGDIR/dist/dqlite/.libs/" \
PKG_CONFIG_PATH="$PKGDIR/dist/sqlite:$PKGDIR/dist/dqlite" ||:
go build -buildmode=pie -tags "$BUILDTAGS" -o "bin/$binary" "$mainpkg"
)
done
# We want to set rpath for lxd to our fake _libdir. And we *absolutely* want
# DT_RPATH not DT_RUNPATH because we *need* to use our libsqlite3.
patchelf --force-rpath --set-rpath '%{_libdir}/%{name}' bin/lxd
# We want to set r(un)path for lxd (*and* libs) to our fake _libdir. We don't
# pass it as part of ldflags, as we've seen some cases where the RPATH gets
# messed up during compilation.
patchelf --set-rpath '%{_libdir}/%{name}' bin/lxd
patchelf --set-rpath '%{_libdir}/%{name}' "$PKGDIR/dist/sqlite/.libs/libsqlite3.so"
patchelf --set-rpath '%{_libdir}/%{name}' "$PKGDIR/dist/dqlite/.libs/libdqlite.so"
# Generate man pages.
mkdir man