Commit 32d9a745 authored by Stefan Pfeifer's avatar Stefan Pfeifer

Add rudimentary rpm package build

parent 07c6d15d
Pipeline #39941784 failed with stage
in 9 minutes and 48 seconds
......@@ -29,7 +29,11 @@ build-linux:
# Build deb-package
- make deb-package
# Build rpm-package
- make rpm-package
artifacts:
paths:
- build/*.AppImage
- build/*.deb
- build/*.rpm
......@@ -24,21 +24,49 @@ add_custom_command(
configure_file(control.in ${CMAKE_BINARY_DIR}/deb/DEBIAN/control)
add_custom_target(deb-package DEPENDS package.deb)
add_custom_target(deb-package DEPENDS bow-simulator.deb)
add_custom_command(
OUTPUT package.deb
OUTPUT bow-simulator.deb
DEPENDS linux-files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/linux-files ${CMAKE_BINARY_DIR}/deb
COMMAND dpkg-deb --build ${CMAKE_BINARY_DIR}/deb ${CMAKE_BINARY_DIR}/package.deb
COMMAND dpkg-deb --build ${CMAKE_BINARY_DIR}/deb ${CMAKE_BINARY_DIR}/bow-simulator.deb
)
# Create rpm package
configure_file(spec.in ~/rpmbuild/SPECS/application.spec)
# Set up rpm build environment. Todo: Find a way to do this in the local build folder instead of in the users home?
file(MAKE_DIRECTORY
~/rpmbuild/RPMS
~/rpmbuild/SRPMS
~/rpmbuild/BUILD
~/rpmbuild/SOURCES
~/rpmbuild/SPECS
~/rpmbuild/tmp
)
add_custom_target(rpm-package DEPENDS bow-simulator.rpm)
set(RPM_TEMP_NAME ${APPLICATION_NAME}-${APPLICATION_VERSION})
add_custom_command(
OUTPUT bow-simulator.rpm
DEPENDS linux-files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/linux-files ~/rpmbuild/SOURCES/${RPM_TEMP_NAME}
COMMAND cd ~/rpmbuild/SOURCES && tar -zcvf ${RPM_TEMP_NAME}.tar.gz ${RPM_TEMP_NAME} && cd -
COMMAND rpmbuild -bb ~/rpmbuild/SPECS/application.spec
COMMAND cp ~/rpmbuild/RPMS/*/*.rpm ${CMAKE_BINARY_DIR}/bow-simulator.rpm
)
# Create AppImage
add_custom_target(appimage DEPENDS Bow_Simulator-x86_64.AppImage)
add_custom_target(appimage DEPENDS bow-simulator.AppImage)
add_custom_command(
OUTPUT Bow_Simulator-x86_64.AppImage
OUTPUT bow-simulator.AppImage
DEPENDS linux-files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/linux-files ${CMAKE_BINARY_DIR}/appimage
COMMAND linuxdeployqt ${CMAKE_BINARY_DIR}/appimage/usr/share/applications/bow-simulator.desktop -appimage -bundle-non-qt-libs -no-translations
COMMAND mv ${CMAKE_BINARY_DIR}/*.AppImage ${CMAKE_BINARY_DIR}/bow-simulator.AppImage
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
# https://stackoverflow.com/questions/880227/what-is-the-minimum-i-have-to-do-to-create-an-rpm-file
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{_dbpath}/brp-compress
Summary: @APPLICATION_DESCRIPTION_SHORT@
Name: @APPLICATION_NAME@
Version: @APPLICATION_VERSION@
Release: 1
License: @APPLICATION_LICENSE@
SOURCE0 : %{name}-%{version}.tar.gz
URL: http://bow-simulator.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
%{summary}
%prep
%setup -q
%build
# Empty section.
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
cp -a * %{buildroot}
%clean
rm -rf %{buildroot}
%files
%defattr(755,root,root)
/usr/bin/bow-simulator
%defattr(644,root,root)
/usr/share/applications/bow-simulator.desktop
/usr/share/icons/hicolor/scalable/apps/bow-simulator.svg
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment