SHA256
1
0
forked from pool/lxd

Accepting request 733135 from home:cyphar:lxc

- Clean up a few remaining specfile bits left over from the 3.17 update.

OBS-URL: https://build.opensuse.org/request/show/733135
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxd?expand=0&rev=27
This commit is contained in:
Aleksa Sarai 2019-09-25 11:20:13 +00:00 committed by Git OBS Bridge
parent 662a16aa94
commit 3f8cc8b983
2 changed files with 32 additions and 33 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Sep 25 11:03:42 UTC 2019 - Aleksa Sarai <asarai@suse.com>
- Clean up a few remaining specfile bits left over from the 3.17 update.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 24 12:31:21 UTC 2019 - Aleksa Sarai <asarai@suse.com> Tue Sep 24 12:31:21 UTC 2019 - Aleksa Sarai <asarai@suse.com>

View File

@ -100,24 +100,25 @@ mv -v _dist/src vendor
# Make sure any leftover go build caches are gone. # Make sure any leftover go build caches are gone.
go clean -cache go clean -cache
# Keep track of the current set of paths needed to generate the include-related
# variables for later stages.
declare -a CURRENT_DEPLIST
# Set up GOPATH. # Set up GOPATH.
export GOPATH="$PWD/.gopath" export GOPATH="$PWD/.gopath"
export PKGDIR="$GOPATH/src/%{import_path}" export PKGDIR="$GOPATH/src/%{import_path}"
mkdir -p "$PKGDIR" mkdir -p "$PKGDIR"
cp -a * "$PKGDIR" cp -a * "$PKGDIR"
# First we need to build the sqlite fork and dqlite. We need to build them # Set up temporary installation paths.
# dynamically (to avoid binary bloat), but we also then need to mess with export INSTALL_ROOT="$PKGDIR/.install"
# patchelf to stop us from breaking openSUSE packaging. export INSTALL_INCLUDEDIR="$INSTALL_ROOT/%{_includedir}"
export INSTALL_LIBDIR="$INSTALL_ROOT/%{_libdir}/%{name}"
# We first need to build all of the LXD-specific dependencies. To avoid binary
# bloat, we build them as dylibs -- but we then later need to mess around with
# the ELF headers to stop the openSUSE packaging scripts from freaking out.
export CFLAGS="%{optflags} -fPIC -DPIC" export CFLAGS="%{optflags} -fPIC -DPIC"
# We have a temporary-install directory which contains our pkg-configs. # We have a temporary-install directory which contains all of the dylib deps.
export PKG_CONFIG_SYSROOT_DIR="$PKGDIR/.install" export PKG_CONFIG_SYSROOT_DIR="$INSTALL_ROOT"
export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/%{_libdir}/%{name}/pkgconfig:$PKG_CONFIG_SYSROOT_DIR/%{_datadir}/pkgconfig" export PKG_CONFIG_PATH="$INSTALL_LIBDIR/pkgconfig"
# SQLite # SQLite
pushd "$PKGDIR/_dist/deps/sqlite" pushd "$PKGDIR/_dist/deps/sqlite"
@ -129,9 +130,7 @@ autoreconf -fiv
--disable-tcl --disable-tcl
make clean make clean
make %{?_smp_mflags} make %{?_smp_mflags}
make DESTDIR="$PKGDIR/.install" install make DESTDIR="$INSTALL_ROOT" install
# Add sqlite to dependency list.
CURRENT_DEPLIST+=("$PWD")
popd popd
# libco # libco
@ -141,10 +140,8 @@ make \
PREFIX="" \ PREFIX="" \
INCLUDEDIR="%{_includedir}" \ INCLUDEDIR="%{_includedir}" \
LIBDIR="%{_libdir}/%{name}" \ LIBDIR="%{_libdir}/%{name}" \
DESTDIR="$PKGDIR/.install" \ DESTDIR="$INSTALL_ROOT" \
all install all install
# Add libco to dependency list.
CURRENT_DEPLIST+=("$PWD")
popd popd
# raft # raft
@ -154,9 +151,7 @@ autoreconf -fiv
--libdir="%{_libdir}/%{name}" \ --libdir="%{_libdir}/%{name}" \
--disable-static --disable-static
make %{?_smp_mflags} make %{?_smp_mflags}
make DESTDIR="$PKGDIR/.install" install make DESTDIR="$INSTALL_ROOT" install
# Add raft to dependency list.
CURRENT_DEPLIST+=("$PWD")
popd popd
# dqlite # dqlite
@ -168,10 +163,8 @@ autoreconf -fiv
--disable-static --disable-static
make clean make clean
make %{?_smp_mflags} make %{?_smp_mflags}
make DESTDIR="$PKGDIR/.install" install make DESTDIR="$INSTALL_ROOT" install
) )
# Add raft to dependency list.
CURRENT_DEPLIST+=("$PWD")
popd popd
# Find all of the main packages using go-list. # Find all of the main packages using go-list.
@ -186,11 +179,11 @@ for mainpkg in "${mainpkgs[@]}"
do do
binary="$(basename "$mainpkg")" binary="$(basename "$mainpkg")"
( (
# We need to link against sqlite and dqlite only when dealing with lxd proper. # We need to link against our dylib deps when dealing with lxd proper.
[ "$binary" == "lxd" ] && export \ [ "$binary" == "lxd" ] && export \
BUILDTAGS="libsqlite3" \ BUILDTAGS="libsqlite3" \
CGO_CFLAGS="-I $PKGDIR/.install/%{_includedir}" \ CGO_CFLAGS="-I $INSTALL_INCLUDEDIR" \
CGO_LDFLAGS="-L $PKGDIR/.install/%{_libdir}/%{name}" ||: CGO_LDFLAGS="-L $INSTALL_LIBDIR" ||:
go build -buildmode=pie -tags "$BUILDTAGS" -o "bin/$binary" "$mainpkg" go build -buildmode=pie -tags "$BUILDTAGS" -o "bin/$binary" "$mainpkg"
) )
done done
@ -224,27 +217,29 @@ done
# A simple check that lxd isn't broken. We can't do this after patchelf # A simple check that lxd isn't broken. We can't do this after patchelf
# because we'd need to chroot(2) into {buildroot} which isn't permitted due # because we'd need to chroot(2) into {buildroot} which isn't permitted due
# to user namespaces being blocked inside rpmbuild. boo#1138769 # to user namespaces being blocked inside rpmbuild. boo#1138769
export LD_LIBRARY_PATH="$PKGDIR/.install/%{_libdir}/%{name}" export LD_LIBRARY_PATH="$INSTALL_LIBDIR"
./bin/lxd help >/dev/null ./bin/lxd help
) )
for lib in $PKGDIR/.install/%{_libdir}/%{name}/lib*.so for lib in "$INSTALL_LIBDIR"/lib*.so
do do
# Strip off last two version digits. # Strip off last two version digits.
name="$(basename "$(readlink "$lib")" | sed -E 's/\.[0-9]+\.[0-9]+$//')" name="$(basename "$(readlink "$lib")" | sed -E 's/\.[0-9]+\.[0-9]+$//')"
# Give our libraries unrecognisable DT_SONAME entries. # Give our libraries unrecognisable DT_SONAME entries.
patchelf --set-soname "._LXD_INTERNAL-$name" "$lib" patchelf --set-soname "._LXD_INTERNAL-$name" "$lib"
# Make sure they're executable.
chmod +x "$lib"
done done
# Switch to absolute DT_NEEDED for all dylibs we have as well as the main LXD # Switch to absolute DT_NEEDED for all dylibs we have as well as the main LXD
# binary. We do this for all dylibs to make sure we don't end up with weird # binary. We do this for all dylibs to make sure we don't end up with weird
# chain-loading problems. # chain-loading problems.
for target in bin/lxd $PKGDIR/.install/%{_libdir}/%{name}/lib*.so for target in bin/lxd "$INSTALL_LIBDIR"/lib*.so
do do
# Drop RPATH in case it got included during builds. # Drop RPATH in case it got included during builds.
patchelf --remove-rpath "$target" patchelf --remove-rpath "$target"
# And now replace all the possible DT_NEEDEDs to absolute paths. # And now replace all the possible DT_NEEDEDs to absolute paths.
for lib in $PKGDIR/.install/%{_libdir}/%{name}/lib*.so for lib in "$INSTALL_LIBDIR"/lib*.so
do do
# Strip off last two version digits. # Strip off last two version digits.
name="$(basename "$(readlink "$lib")" | sed -E 's/\.[0-9]+\.[0-9]+$//')" name="$(basename "$(readlink "$lib")" | sed -E 's/\.[0-9]+\.[0-9]+$//')"
@ -267,12 +262,11 @@ popd
%install %install
export GOPATH="$PWD/.gopath" export GOPATH="$PWD/.gopath"
export PKGDIR="$GOPATH/src/%{import_path}" export PKGDIR="$GOPATH/src/%{import_path}"
export INSTALL_LIBDIR="$PKGDIR/.install/%{_libdir}/%{name}"
install -d -m 0755 %{buildroot}%{_libdir}/%{name} install -d -m 0755 %{buildroot}%{_libdir}/%{name}
pushd "$PKGDIR"
# We can't use install because *.so.$n are symlinks. # We can't use install because *.so.$n are symlinks.
cp -avt %{buildroot}%{_libdir}/%{name}/ $PKGDIR/.install/%{_libdir}/%{name}/lib*.so.* cp -avt %{buildroot}%{_libdir}/%{name}/ "$INSTALL_LIBDIR"/lib*.so.*
popd
# Install all the binaries. # Install all the binaries.
pushd bin/ pushd bin/