Skip to content

Commit

Permalink
Generate RPM packages
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed May 9, 2019
1 parent 065773c commit 6f43a58
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ addons:
- fakeroot
- dpkg
- lintian
# Stuff for building .rpm files
- rpm
- rpmlint

# These commands simulate having a graphical display, which is needed
# for our GUI tests.
Expand All @@ -46,6 +49,7 @@ script:
before_deploy:
- ./build osx
- ./build deb
- ./build rpm

deploy:
# Releases (which are tagged) go to github
Expand All @@ -58,6 +62,7 @@ deploy:
- _build/repack/$BUILD_CONFIGURATION/ckan.exe
- _build/osx/CKAN.dmg
- _build/deb/ckan_*.deb
- _build/rpm/RPMS/noarch/ckan*.rpm
- _build/out/AutoUpdater/$BUILD_CONFIGURATION/bin/AutoUpdater.exe
on:
repo: KSP-CKAN/CKAN
Expand Down
14 changes: 14 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ Task("deb-clean")
.Does(() => StartProcess("make",
new ProcessSettings { Arguments = "clean", WorkingDirectory = "debian" }));

Task("rpm")
.IsDependentOn("Ckan")
.Does(() => StartProcess("make",
new ProcessSettings { WorkingDirectory = "rpm" }));

Task("rpm-test")
.IsDependentOn("Ckan")
.Does(() => StartProcess("make",
new ProcessSettings { Arguments = "test", WorkingDirectory = "rpm" }));

Task("rpm-clean")
.Does(() => StartProcess("make",
new ProcessSettings { Arguments = "clean", WorkingDirectory = "rpm" }));

Task("Restore-Nuget")
.Does(() =>
{
Expand Down
30 changes: 30 additions & 0 deletions rpm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: clean test

# Borrow files from .deb
DEBDIR:=$(shell pwd)/../debian

TOPDIR:=$(shell pwd)/../_build/rpm
SCRIPTSRC:=$(DEBDIR)/ckan
MANSRC:=$(DEBDIR)/ckan.1
DESKTOPSRC:=$(DEBDIR)/ckan.desktop
ICONSRC:=$(DEBDIR)/ckan.ico
EXESRC:=$(shell pwd)/../_build/repack/Release/ckan.exe
CHANGELOGSRC:=../CHANGELOG.md
VERSION:=$(shell egrep '^\s*\#\#\s+v.*$$' $(CHANGELOGSRC) | head -1 | sed -e 's/^\s*\#\#\s\+v//' )
RPM:=$(shell pwd)/../_build/rpm/RPMS/noarch/ckan-$(VERSION)-1.noarch.rpm

# rpmbuild tries to use $HOME/rpmbuild by default
# rpmbuild can't handle relative paths for its topdir
# rpmbuild assumes we'll copy files into its SOURCES dir for it

$(RPM): $(SCRIPTSRC) $(EXESRC) $(MANSRC) $(DESKTOPSRC) $(ICONSRC)
mkdir -p "${TOPDIR}/SOURCES"
cp $^ "${TOPDIR}/SOURCES"
rpmbuild --define "_topdir ${TOPDIR}" --define "_version $(VERSION)" -bb ckan.spec

clean:
rm -r "$(TOPDIR)"

test: $(RPM)
rpm -qlp $<
rpmlint $<
43 changes: 43 additions & 0 deletions rpm/ckan.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Name: ckan
Version: %{_version}
Release: 1%{?dist}
Summary: Mod manager for Kerbal Space Program
URL: https://ksp-ckan.space
Packager: The CKAN authors <rpm@ksp-ckan.space>
License: MIT
BuildArch: noarch
Requires: mono
Source0: ckan
Source1: ckan.exe
Source2: ckan.1
Source3: ckan.desktop
Source4: ckan.ico

%description
KSP-CKAN official client.
Official client for the Comprehensive Kerbal Archive Network (CKAN).
Acts as a mod manager for Kerbal Space Program mods.

%install
umask 0022
mkdir -p %{buildroot}%{_bindir}
cp %{SOURCE0} %{buildroot}%{_bindir}
mkdir -p %{buildroot}/usr/lib/ckan
cp %{SOURCE1} %{buildroot}/usr/lib/ckan
mkdir -p %{buildroot}%{_mandir}/man1
cp %{SOURCE2} %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_datadir}/applications
cp %{SOURCE3} %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/icons
cp %{SOURCE4} %{buildroot}%{_datadir}/icons

%files
%{_bindir}/*
/usr/lib/ckan
%{_datadir}/applications/*
%{_datadir}/icons/*
%{_mandir}/man1/*

%changelog
* Thu May 9 2019 The CKAN authors <rpm@ksp-ckan.space> 1.26.3-1
- Initial RPM release

0 comments on commit 6f43a58

Please sign in to comment.