diff --git a/lxd.spec b/lxd.spec index 30c3d78..da8f44e 100644 --- a/lxd.spec +++ b/lxd.spec @@ -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