mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
build-system: create separate OBS make-package
It seemed very odd to have those steps mixed in with the Ubuntu/Debian instructions. Yes, there is a bunch of overlap, but this seems much cleaner. This also updates the spec files to something that works for the current sources. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
37badf2746
commit
83a963bc37
2 changed files with 100 additions and 12 deletions
89
packaging/OBS/make-package.sh
Normal file
89
packaging/OBS/make-package.sh
Normal file
|
@ -0,0 +1,89 @@
|
|||
#!/bin/bash -e
|
||||
# start from the directory above the subsurface directory
|
||||
#
|
||||
# we need to build the google maps plugin which is not part of our sources, so let's make sure
|
||||
# it is included in our source tar file
|
||||
|
||||
if [[ $(pwd | grep "subsurface$") || ! -d subsurface || ! -d subsurface/libdivecomputer ]] ; then
|
||||
echo "Please start this script from the folder ABOVE the subsurface source directory"
|
||||
exit 1;
|
||||
fi
|
||||
if [[ ! -d googlemaps ]] ; then
|
||||
echo "Please make sure you have the current master of git://github.com/Subsurface-divelog/googlemaps"
|
||||
echo "checked out in parallel to the Subsurface directory"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# ensure that the libdivecomputer module is there and current
|
||||
cd subsurface
|
||||
git submodule init
|
||||
git submodule update
|
||||
cd -
|
||||
|
||||
GITVERSION=$(cd subsurface ; git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//')
|
||||
GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//')
|
||||
VERSION=$(echo $GITVERSION | sed -e 's/-/./')
|
||||
GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)
|
||||
LIBDCREVISION=$(cd subsurface/libdivecomputer ; git rev-parse --verify HEAD)
|
||||
|
||||
if [[ "$GITVERSION" = "" ]] ; then
|
||||
SUFFIX=".release"
|
||||
else
|
||||
SUFFIX=".daily"
|
||||
fi
|
||||
|
||||
echo "building Subsurface" $VERSION "with libdivecomputer" $LIBDCREVISION
|
||||
|
||||
# we put all of the files into the distrobuilds directory in order not to clutter the 'src' directory
|
||||
mkdir -p distrobuilds
|
||||
cd distrobuilds
|
||||
|
||||
if [[ ! -d subsurface_$VERSION ]]; then
|
||||
mkdir subsurface_$VERSION
|
||||
if [[ "$GITREVISION" != "" ]] ; then
|
||||
rm -f subsurfacedaily-$VERSION
|
||||
ln -s subsurface_$VERSION subsurfacedaily-$VERSION
|
||||
else
|
||||
rm -f subsurface-$VERSION
|
||||
ln -s subsurface_$VERSION subsurface-$VERSION
|
||||
fi
|
||||
|
||||
echo "copying sources"
|
||||
|
||||
(cd ../subsurface ; tar cf - . ) | (cd subsurface_$VERSION ; tar xf - )
|
||||
cd subsurface_$VERSION;
|
||||
cp -a ../../googlemaps .
|
||||
|
||||
rm -rf .git libdivecomputer/.git googlemaps/.git build build-mobile libdivecomputer/build googlemaps/build
|
||||
echo $GITVERSION > .gitversion
|
||||
echo $GITDATE > .gitdate
|
||||
echo $LIBDCREVISION > libdivecomputer/revision
|
||||
|
||||
if [[ "$GITREVISION" != "" ]] ; then
|
||||
(cd .. ; tar ch subsurfacedaily-$VERSION | xz > home:Subsurface-Divelog/Subsurface-daily/subsurface-$VERSION.orig.tar.xz) &
|
||||
else
|
||||
(cd .. ; tar ch subsurface-$VERSION | xz > home:Subsurface-Divelog/Subsurface/subsurface-$VERSION.orig.tar.xz) &
|
||||
fi
|
||||
else
|
||||
echo "using existing source tree"
|
||||
fi
|
||||
|
||||
if [[ "$1" = "post" ]] ; then
|
||||
# daily vs. release
|
||||
if [[ "$GITREVISION" == "" ]] ; then
|
||||
# this is a release
|
||||
cd home:Subsurface-Divelog/Subsurface
|
||||
osc rm $(ls subsurface*.tar.xz | grep -v $VERSION)
|
||||
osc add subsurface-$VERSION.orig.tar.xz
|
||||
sed -i "s/%define latestVersion.*/%define latestVersion $VERSION/" subsurface.spec
|
||||
sed -i "s/%define gitVersion .*/%define gitVersion 0/" subsurface.spec
|
||||
osc commit -m "next release build"
|
||||
else
|
||||
cd home:Subsurface-Divelog/Subsurface-daily
|
||||
osc rm $(ls subsurface*.tar.xz | grep -v $VERSION)
|
||||
osc add subsurface-$VERSION.orig.tar.xz
|
||||
sed -i "s/%define latestVersion.*/%define latestVersion $VERSION/" subsurfacedaily.spec
|
||||
sed -i "s/%define gitVersion .*/%define gitVersion $GITREVISION/" subsurfacedaily.spec
|
||||
osc commit -m "next daily build"
|
||||
fi
|
||||
fi
|
|
@ -1,12 +1,12 @@
|
|||
#
|
||||
# spec file for package subsurface
|
||||
#
|
||||
# Copyright (c) 2014 Dirk Hohndel
|
||||
# Copyright (c) 2014-2020 Dirk Hohndel
|
||||
#
|
||||
|
||||
%define latestVersion 4.6.4.1031
|
||||
%define latestVersion 4.9.3.1464
|
||||
|
||||
%define gitVersion 1031
|
||||
%define gitVersion 1464
|
||||
|
||||
|
||||
Name: subsurfacedaily
|
||||
|
@ -28,7 +28,7 @@ BuildRequires: automake
|
|||
BuildRequires: libtool
|
||||
BuildRequires: cmake
|
||||
%if 0%{?suse_version}
|
||||
# kde4-filesystem needed for some folders not owned (%{_datadir}/icons/hicolor and others)
|
||||
# kde4-filesystem needed for some folders not owned (% {_datadir}/icons/hicolor and others)
|
||||
BuildRequires: kde4-filesystem
|
||||
%endif
|
||||
BuildRequires: libzip-devel
|
||||
|
@ -36,6 +36,7 @@ BuildRequires: libxml2-devel
|
|||
BuildRequires: libxslt-devel
|
||||
BuildRequires: libssh2-devel
|
||||
BuildRequires: libcurl-devel
|
||||
BuildRequires: libgit2-devel
|
||||
BuildRequires: grantlee5-devel
|
||||
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
|
||||
BuildRequires: netpbm-devel
|
||||
|
@ -55,6 +56,7 @@ BuildRequires: qt5-qtbase-odbc
|
|||
BuildRequires: qt5-qtbase-tds
|
||||
BuildRequires: qt5-qtconnectivity-devel
|
||||
BuildRequires: qt5-qtlocation-devel
|
||||
BuildRequires: libappstream-glib
|
||||
%else
|
||||
BuildRequires: update-desktop-files
|
||||
BuildRequires: libopenssl-devel
|
||||
|
@ -102,13 +104,6 @@ mkdir -p install-root
|
|||
./configure --prefix=$RPM_BUILD_DIR/install-root --disable-shared --disable-examples ; \
|
||||
make %{?_smp_mflags} ; \
|
||||
make install)
|
||||
(cd libgit2; mkdir build; cd build; \
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$RPM_BUILD_DIR/install-root -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF \
|
||||
-DCMAKE_C_FLAGS:STRING="%optflags" \
|
||||
-DCMAKE_CXX_FLAGS:STRING="%optflags" \
|
||||
.. ; \
|
||||
make %{?_smp_mflags} ; \
|
||||
make install)
|
||||
( cd googlemaps ; mkdir -p build ; cd build ; \
|
||||
qmake-qt5 "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro ; \
|
||||
make -j4 )
|
||||
|
@ -119,7 +114,6 @@ mkdir -p install-root
|
|||
-DLIBDIVECOMPUTER_INCLUDE_DIR=$RPM_BUILD_DIR/install-root/include \
|
||||
-DLIBGIT2_INCLUDE_DIR=$RPM_BUILD_DIR/install-root/include \
|
||||
-DLIBDIVECOMPUTER_LIBRARIES=$RPM_BUILD_DIR/install-root/lib/libdivecomputer.a \
|
||||
-DLIBGIT2_LIBRARIES=$RPM_BUILD_DIR/install-root/lib/libgit2.a \
|
||||
-DCMAKE_C_FLAGS:STRING="%optflags" \
|
||||
-DCMAKE_CXX_FLAGS:STRING="%optflags" \
|
||||
-DNO_PRINTING=OFF \
|
||||
|
@ -131,8 +125,11 @@ mkdir -p %{buildroot}/%{_libdir}
|
|||
(cd googlemaps/build ; make install_target INSTALL_ROOT=$RPM_BUILD_ROOT )
|
||||
(cd subsurface-build ; make VERBOSE=1 install )
|
||||
install subsurface.debug %{buildroot}%{_bindir}
|
||||
install appdata/subsurface.appdata.xml %{buildroot}%{_datadir}/metainfo
|
||||
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
|
||||
desktop-file-install --dir=%{buildroot}/%{_datadir}/applications subsurface.desktop
|
||||
cat %{buildroot}%{_datadir}/metainfo/subsurface.appdata.xml
|
||||
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/subsurface.appdata.xml
|
||||
%else
|
||||
%suse_update_desktop_file -r subsurface Utility DesktopUtility
|
||||
%endif
|
||||
|
@ -152,6 +149,8 @@ desktop-file-install --dir=%{buildroot}/%{_datadir}/applications subsurface.desk
|
|||
%{_bindir}/subsurface*
|
||||
%{_libdir}/qt5/plugins/geoservices/libqtgeoservices_googlemaps.so
|
||||
%{_datadir}/applications/subsurface.desktop
|
||||
%dir %{_datadir}/metainfo
|
||||
%{_datadir}/metainfo/subsurface.appdata.xml
|
||||
%{_datadir}/icons/hicolor/*/apps/subsurface-icon.*
|
||||
%{_datadir}/subsurface/
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue