Accepting request 733136 from Virtualization:containers
OBS-URL: https://build.opensuse.org/request/show/733136 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lxd?expand=0&rev=5
This commit is contained in:
commit
3cf51b50af
@ -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>
|
||||
|
||||
|
60
lxd.spec
60
lxd.spec
@ -100,24 +100,25 @@ mv -v _dist/src vendor
|
||||
# Make sure any leftover go build caches are gone.
|
||||
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.
|
||||
export GOPATH="$PWD/.gopath"
|
||||
export PKGDIR="$GOPATH/src/%{import_path}"
|
||||
mkdir -p "$PKGDIR"
|
||||
cp -a * "$PKGDIR"
|
||||
|
||||
# First we need to build the sqlite fork and dqlite. We need to build them
|
||||
# dynamically (to avoid binary bloat), but we also then need to mess with
|
||||
# patchelf to stop us from breaking openSUSE packaging.
|
||||
# Set up temporary installation paths.
|
||||
export INSTALL_ROOT="$PKGDIR/.install"
|
||||
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"
|
||||
|
||||
# We have a temporary-install directory which contains our pkg-configs.
|
||||
export PKG_CONFIG_SYSROOT_DIR="$PKGDIR/.install"
|
||||
export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/%{_libdir}/%{name}/pkgconfig:$PKG_CONFIG_SYSROOT_DIR/%{_datadir}/pkgconfig"
|
||||
# We have a temporary-install directory which contains all of the dylib deps.
|
||||
export PKG_CONFIG_SYSROOT_DIR="$INSTALL_ROOT"
|
||||
export PKG_CONFIG_PATH="$INSTALL_LIBDIR/pkgconfig"
|
||||
|
||||
# SQLite
|
||||
pushd "$PKGDIR/_dist/deps/sqlite"
|
||||
@ -129,9 +130,7 @@ autoreconf -fiv
|
||||
--disable-tcl
|
||||
make clean
|
||||
make %{?_smp_mflags}
|
||||
make DESTDIR="$PKGDIR/.install" install
|
||||
# Add sqlite to dependency list.
|
||||
CURRENT_DEPLIST+=("$PWD")
|
||||
make DESTDIR="$INSTALL_ROOT" install
|
||||
popd
|
||||
|
||||
# libco
|
||||
@ -141,10 +140,8 @@ make \
|
||||
PREFIX="" \
|
||||
INCLUDEDIR="%{_includedir}" \
|
||||
LIBDIR="%{_libdir}/%{name}" \
|
||||
DESTDIR="$PKGDIR/.install" \
|
||||
DESTDIR="$INSTALL_ROOT" \
|
||||
all install
|
||||
# Add libco to dependency list.
|
||||
CURRENT_DEPLIST+=("$PWD")
|
||||
popd
|
||||
|
||||
# raft
|
||||
@ -154,9 +151,7 @@ autoreconf -fiv
|
||||
--libdir="%{_libdir}/%{name}" \
|
||||
--disable-static
|
||||
make %{?_smp_mflags}
|
||||
make DESTDIR="$PKGDIR/.install" install
|
||||
# Add raft to dependency list.
|
||||
CURRENT_DEPLIST+=("$PWD")
|
||||
make DESTDIR="$INSTALL_ROOT" install
|
||||
popd
|
||||
|
||||
# dqlite
|
||||
@ -168,10 +163,8 @@ autoreconf -fiv
|
||||
--disable-static
|
||||
make clean
|
||||
make %{?_smp_mflags}
|
||||
make DESTDIR="$PKGDIR/.install" install
|
||||
make DESTDIR="$INSTALL_ROOT" install
|
||||
)
|
||||
# Add raft to dependency list.
|
||||
CURRENT_DEPLIST+=("$PWD")
|
||||
popd
|
||||
|
||||
# Find all of the main packages using go-list.
|
||||
@ -186,11 +179,11 @@ for mainpkg in "${mainpkgs[@]}"
|
||||
do
|
||||
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 \
|
||||
BUILDTAGS="libsqlite3" \
|
||||
CGO_CFLAGS="-I $PKGDIR/.install/%{_includedir}" \
|
||||
CGO_LDFLAGS="-L $PKGDIR/.install/%{_libdir}/%{name}" ||:
|
||||
CGO_CFLAGS="-I $INSTALL_INCLUDEDIR" \
|
||||
CGO_LDFLAGS="-L $INSTALL_LIBDIR" ||:
|
||||
go build -buildmode=pie -tags "$BUILDTAGS" -o "bin/$binary" "$mainpkg"
|
||||
)
|
||||
done
|
||||
@ -224,27 +217,29 @@ done
|
||||
# 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
|
||||
# to user namespaces being blocked inside rpmbuild. boo#1138769
|
||||
export LD_LIBRARY_PATH="$PKGDIR/.install/%{_libdir}/%{name}"
|
||||
./bin/lxd help >/dev/null
|
||||
export LD_LIBRARY_PATH="$INSTALL_LIBDIR"
|
||||
./bin/lxd help
|
||||
)
|
||||
|
||||
for lib in $PKGDIR/.install/%{_libdir}/%{name}/lib*.so
|
||||
for lib in "$INSTALL_LIBDIR"/lib*.so
|
||||
do
|
||||
# Strip off last two version digits.
|
||||
name="$(basename "$(readlink "$lib")" | sed -E 's/\.[0-9]+\.[0-9]+$//')"
|
||||
# Give our libraries unrecognisable DT_SONAME entries.
|
||||
patchelf --set-soname "._LXD_INTERNAL-$name" "$lib"
|
||||
# Make sure they're executable.
|
||||
chmod +x "$lib"
|
||||
done
|
||||
|
||||
# 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
|
||||
# chain-loading problems.
|
||||
for target in bin/lxd $PKGDIR/.install/%{_libdir}/%{name}/lib*.so
|
||||
for target in bin/lxd "$INSTALL_LIBDIR"/lib*.so
|
||||
do
|
||||
# Drop RPATH in case it got included during builds.
|
||||
patchelf --remove-rpath "$target"
|
||||
# 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
|
||||
# Strip off last two version digits.
|
||||
name="$(basename "$(readlink "$lib")" | sed -E 's/\.[0-9]+\.[0-9]+$//')"
|
||||
@ -267,12 +262,11 @@ popd
|
||||
%install
|
||||
export GOPATH="$PWD/.gopath"
|
||||
export PKGDIR="$GOPATH/src/%{import_path}"
|
||||
export INSTALL_LIBDIR="$PKGDIR/.install/%{_libdir}/%{name}"
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_libdir}/%{name}
|
||||
pushd "$PKGDIR"
|
||||
# We can't use install because *.so.$n are symlinks.
|
||||
cp -avt %{buildroot}%{_libdir}/%{name}/ $PKGDIR/.install/%{_libdir}/%{name}/lib*.so.*
|
||||
popd
|
||||
cp -avt %{buildroot}%{_libdir}/%{name}/ "$INSTALL_LIBDIR"/lib*.so.*
|
||||
|
||||
# Install all the binaries.
|
||||
pushd bin/
|
||||
|
Loading…
Reference in New Issue
Block a user