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