Rework to use libhif as git submodule

https://github.com/projectatomic/rpm-ostree/pull/357
This commit is contained in:
Colin Walters 2016-06-28 21:36:04 -04:00
parent d452ad1837
commit 3959c0616e

View File

@ -1,4 +1,3 @@
%bcond_without bundled_libhif
Summary: Client side upgrade program and server side compose tool
Name: rpm-ostree
Version: 2016.3.3.g17fb980
@ -6,15 +5,6 @@ Release: 2%{?dist}
#VCS: https://github.com/cgwalters/rpm-ostree
# This tarball is generated via "make -f Makefile.dist-packaging dist-snapshot"
Source0: rpm-ostree-%{version}.tar.xz
# https://github.com/rpm-software-management/libhif
# Bundled because the library is API/ABI unstable, and we're trying to
# avoid being version locked with PackageKit/dnf right now.
# This source is generated via
# git archive --format=tar --prefix=libhif/
%if %{with bundled_libhif}
Source1: libhif.tar.gz
Provides: bundled(libhif) = 0.7.0
%endif
License: LGPLv2+
URL: https://github.com/projectatomic/rpm-ostree
# We always run autogen.sh
@ -38,7 +28,7 @@ BuildRequires: libattr-devel
# We currently interact directly with librepo
BuildRequires: pkgconfig(librepo)
%if %{with bundled_libhif}
# libhif bundling
# We're using RPATH to pick up our bundled version
%global __requires_exclude ^libhif[.]so[.].*$
@ -52,9 +42,6 @@ BuildRequires: libsolv-devel
%else
BuildRequires: pkgconfig(libsolv)
%endif
%else
BuildRequires: pkgconfig(libhif)
%endif
Requires: ostree >= 2014.6
@ -78,58 +65,13 @@ The %{name}-devel package includes the header files for the %{name} library.
%prep
%autosetup -Sgit -n %{name}-%{version}
%if %{with bundled_libhif}
tar xf %{SOURCE1}
%endif
%build
%if %{with bundled_libhif}
(cd libhif
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=%{_libexecdir}/rpm-ostree \
-DINCLUDE_INSTALL_DIR:PATH=%{_libexecdir}/rpm-ostree/include \
-DLIB_INSTALL_DIR:PATH=%{_libexecdir}/rpm-ostree \
-DSYSCONF_INSTALL_DIR:PATH=%{_libexecdir}/rpm-ostree/etc \
-DSHARE_INSTALL_PREFIX:PATH=%{_libexecdir}/rpm-ostree/share \
-DLIB_SUFFIX=64 \
-DBUILD_SHARED_LIBS:BOOL=ON .
make %{?_smp_mflags}
cat > libhif/libhif.pc<<EOF
Name: libhif
Description: Simple package manager interface and librepo
Version:
Requires: glib-2.0, gobject-2.0, librepo, rpm
Libs: -L$(pwd)/libhif -lhif
Cflags: -I$(pwd) -I$(pwd)/libhif
EOF
)
export PKG_CONFIG_PATH=$(pwd)/libhif/libhif${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
export LD_LIBRARY_PATH=$(pwd)/libhif/libhif${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
%endif
env NOCONFIGURE=1 ./autogen.sh
%configure --disable-silent-rules --enable-gtk-doc \
%if %{with bundled_libhif}
LDFLAGS='-Wl,-rpath=%{_libdir}/rpm-ostree'
%else
%endif
%configure --disable-silent-rules --enable-gtk-doc
make %{?_smp_mflags}
%install
%if %{with bundled_libhif}
(cd libhif
make install DESTDIR=$RPM_BUILD_ROOT
for path in %{_libdir}/python2.7 %{_libexecdir}/rpm-ostree/include %{_libexecdir}/rpm-ostree/pkg-config \
%{_libexecdir}/rpm-ostree/share/man; do \
rm $RPM_BUILD_ROOT/${path} -rf; \
done
install -d $RPM_BUILD_ROOT/%{_libdir}/rpm-ostree
# Cherry pick the shared library...
mv $RPM_BUILD_ROOT/%{_libexecdir}/rpm-ostree/lib*/libhif*.so.* $RPM_BUILD_ROOT/%{_libdir}/rpm-ostree
# and nuke everything else.
rm $RPM_BUILD_ROOT/%{_libexecdir}/rpm-ostree -rf
)
%endif
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p -c"
find $RPM_BUILD_ROOT -name '*.la' -delete