1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-28 07:29:45 +00:00

Merge pull request #790 from ajacocks/master

Create RPM package and man page
This commit is contained in:
Thomas Harte 2020-05-11 13:06:47 -04:00 committed by GitHub
commit 3f2fb1fa58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 503 additions and 0 deletions

8
Packaging/README.md Normal file
View File

@ -0,0 +1,8 @@
# RPM packaging for clksignal
This simple Ansible playbook creates and installs an RPM package of the current release of clksignal
If the version that you build is newer than what you have installed, it will be automatically upgraded.
## Usage
`ansible-playbook main.yml -K

174
Packaging/main.yml Normal file
View File

@ -0,0 +1,174 @@
- name: Automatically generate RPMs from CLK git repo
hosts: localhost
vars:
- arch: "amd64"
- deps:
- gcc-c++
- mesa-libGL-devel
- python3-github3py
- python3-scons
- SDL2-devel
- zlib-devel
- github_repo: "CLK"
- github_user: "TomHarte"
- packageName: "{{ github_repo }}"
- releaseURL: "https://github.com/TomHarte/CLK/releases/latest"
- rpmLicense: "MIT"
- rpmSummary: "A latency-hating emulator of 8- and 16-bit platforms: the Acorn Electron, Amstrad CPC, Apple II/II+/IIe and early Macintosh, Atari 2600 and ST, ColecoVision, Commodore Vic-20, MSX 1, Oric 1/Atmos, Sega Master System and Sinclair ZX80/81."
- rpmTools:
- pandoc
- rpm-build
- rpmdevtools
# - version: "head"
- version: "current"
# - version: "2020-05-10"
tasks:
- name: set the date
set_fact:
dateStamp: "{{ lookup('pipe','date \"+%0d %B %Y\"') }}"
- name: install required rpm development tools
package:
name: "{{ item }}"
state: latest
with_items:
- "{{ rpmTools }}"
- "{{ deps }}"
become: yes
- name: create rpm development tree in user home directory
command: rpmdev-setuptree
- name: create temp working directory
tempfile:
state: directory
prefix: "{{ packageName }}."
register: tempdir
- name: Find current release tag
github_release:
user: "{{ github_user }}"
repo: "{{ github_repo }}"
action: latest_release
register: release_data
- name: Fetch HEAD
git:
repo: "https://github.com/{{ github_user }}/{{ github_repo }}.git"
dest: "{{ tempdir.path }}/source"
version: "HEAD"
when: version == "head"
- name: Fetch current release
git:
repo: "https://github.com/{{ github_user }}/{{ github_repo }}.git"
dest: "{{ tempdir.path }}/source"
version: "{{ release_data.tag }}"
when: version == "current"
- name: Fetch named release
git:
repo: "https://github.com/{{ github_user }}/{{ github_repo }}.git"
dest: "{{ tempdir.path }}/source"
version: "{{ version }}"
when: ( version != "current" ) and ( version != "head" )
- name: set the release variable (head)
set_fact:
version: "git{{ ansible_date_time.epoch }}"
when: version == "head"
- name: set the release variable (current)
set_fact:
version: "{{ release_data.tag | regex_replace( '-','' ) }}"
when: version == "current"
- debug:
var: version
- name: convert README.md to text for packaging
command: "pandoc -f markdown -t plain --wrap=none {{ tempdir.path }}/source/README.md -o {{ tempdir.path }}/source/README.txt"
- name: set description from README.txt
slurp:
src: "{{ tempdir.path }}/source/README.txt"
register: readme
- debug:
msg: "{{ readme['content'] | b64decode }}"
- name: create symlink to checkout dir with version
file:
src: "{{ tempdir.path }}/source"
dest: "{{ tempdir.path }}/{{ packageName }}-{{ version }}"
state: link
- name: create the new source archive
archive:
dest: "{{ ansible_env.HOME }}/rpmbuild/SOURCES/{{ packageName }}-{{ version }}.tar"
path: "{{ tempdir.path }}/{{ packageName }}-{{ version }}"
format: tar
- name: template the man page to the sources directory
template:
src: "clksignal.1.j2"
dest: "{{ ansible_env.HOME }}/rpmbuild/SOURCES/clksignal.1"
- name: compress the man page
archive:
path: "{{ ansible_env.HOME }}/rpmbuild/SOURCES/clksignal.1"
dest: "{{ ansible_env.HOME }}/rpmbuild/SOURCES/clksignal.1.gz"
format: gz
remove: Yes
- name: remove existing spec files
file:
path: "{{ ansible_env.HOME }}/rpmbuild/SPECS/{{ packageName }}-{{ version }}.spec"
state: absent
- name: create spec file from template
template:
src: package.spec.j2
dest: "{{ ansible_env.HOME }}/rpmbuild/SPECS/{{ packageName }}-{{ version }}.spec"
- name: build rpm
command: "rpmbuild -bb {{ ansible_env.HOME }}/rpmbuild/SPECS/{{ packageName }}-{{ version }}.spec"
register: rpmbuild
- debug:
var: rpmbuild
- name: register rpmbuild output file variable
set_fact:
rpmBuildOut: "{{ tempdir.path }}/rpmbuild.out"
- name: write output to file
copy:
content: "{{ rpmbuild.stdout }}"
dest: "{{ rpmBuildOut }}"
- name: set the rpm file variable
set_fact:
rpmFile: "{{ lookup( 'pipe', 'egrep ^Wrote:\ ' + rpmBuildOut ) }}"
- debug:
var: rpmFile
- name: update the rpm file variable
set_fact:
rpmFile: "{{ rpmFile | regex_replace('^Wrote: ', '' ) }}"
- debug:
var: rpmFile
- name: install package
package:
name: "{{ rpmFile }}"
state: latest
become: true
# - name: remove temp directory
# file:
# path: "{{ tempdir.path }}"
# state: absent

View File

@ -0,0 +1,270 @@
.\" Manpage for clksignal
.\" Submit PRs to https://github.com/TomHarte/CLK to correct errors or typos.
.TH man 1 "{{ dateStamp }}" "{{ version }}" "clksignal man page"
.SH NAME
clksignal \- A latency-hating emulator of 8- and 16-bit platforms: the Acorn Electron, Amstrad CPC, Apple II/II+/IIe and early Macintosh, Atari 2600 and ST, ColecoVision, Commodore Vic-20, MSX 1, Oric 1/Atmos, Sega Master System and Sinclair ZX80/81.
.SH SYNOPSIS
clksignal [file or --new={machine}] [OPTIONS] [--rompath={path to ROMs}] [--speed={speed multiplier, e.g. 1.5}] [--logical-keyboard] [--volume={0.0 to 1.0}]
.SH DESCRIPTION
Clock Signal (\fBCLK\fR) is an emulator for tourists that seeks to be invisible. Users directly launch classic software with no emulator or per-emulated-machine learning curve.
Releases are hosted on GitHub.
On the Mac it is a native Cocoa application. Under Linux, BSD and other UNIXes and UNIX-alikes it relies upon SDL 2.
.SH MACHINE TYPES
.TP
Required machine type \fIand all options\fR are determined from the file, if specified.
.TP
Otherwise specify a machine.
.TP
.B --new=\fImachine\fR
Machine types are:
.RS
.nf
- AmstradCPC
- AppleII
- AtariST
- Electron
- Macintosh
- MSX
- Oric
- Vic20
- ZX8081
.RE
.SH UNIVERSAL OPTIONS
.TP
.B --rompath=\fIpath\fR
\fIpath\fR is the path to the machine's ROM file
.TP
.B --speed=\fImultiplier\fR
\fImultiplier\fR is the amount to accelerate the execution of the emulated machine. For example, 1.5 is 150% speed.
.TP
.B --logical-keyboard
Enables the logical keyboard
.TP
.B --volume=\fIlevel\fR
\fIlevel\fR is the volume multiplier, from 0.0 through 1.0, with 0 being mute, and 1.0 being full volume.
.SH COLECOVISION OPTIONS
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, either \fISVideo\fR or \fICompositeColour\fR.
.SH SEGA MASTER SYSTEMS OPTIONS
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- RGB
- SVideo
- CompositeColour
- CompositeMonochrome
.RE
.TP
.B --region=\fIregion\fR
\fIregion\fR is the region of the system, any one of:
.RS
.nf
- Japan
- USA
- Europe
- Brazil
.RE
.SH AMSTRAD CPC OPTIONS
.TP
.B --model=\fImodel\fR
\fImodel\fR is the model of CPC being emulated, any one of:
.RS
.nf
- CPC464
- CPC664
- CPC6128
.RE
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- RGB
- CompositeColour
.RE
.SH APPLE II OPTIONS
.TP
.B --disk-controller=\fIcontroller\fR
\fIcontroller\fR is the version of disk controller being emulated, any one of:
.RS
.nf
- None
- SixteenSector
- ThirteenSector
.RE
.TP
.B --model=\fImodel\fR
\fImodel\fR is the model of Apple II being emulated, any one of:
.RS
.nf
- II
- IIplus
- IIe
- EnhancedIIe
.RE
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- CompositeColour
- CompositeMonochrome
.RE
.SH ATARI ST OPTIONS
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- RGB
- CompositeColour
.RE
.SH ACORN ELECTRON OPTIONS
.TP
.B --has-adfs
.TP
.B --has-dfs
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- RGB
- CompositeColour
- CompositeMonochrome
.RE
.TP
.B --quickload
.SH APPLE MACINTOSH OPTIONS
.TP
.B --model=\fImodel\fR
\fImodel\fR is the model of Macintosh being emulated, any one of:
.RS
.nf
- Mac128k
- Mac512k
- Mac512ke
- MacPlus
.TP
.B --quickboot
.RE
.SH MSX OPTIONS
.TP
.B --has-disk-drive
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- RGB
- SVideo
- CompositeColour
- CompositeMonochrome
.RE
.TP
.B --quickload
.TP
.B --region=\fIregion\fR
\fIregion\fR is the region of the system, any one of:
.RS
.nf
- Japan
- USA
- Europe
.RE
.SH ORIC OPTIONS
.TP
.B --disk-interface=\fItype\fR
\fItype\fR is the type of disk interface, any one of:
.RS
.nf
- None
- Microdisk
- Pravetz
- Jasmin
- BD500
.RE
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- RGB
- SVideo
- CompositeColour
- CompositeMonochrome
.RE
.TP
.B --quickload
.TP
.B --rom=\fIrom\fR
\fIrom\fR is the ROM version of the system, any one of:
.RS
.nf
- BASIC10
- BASIC11
- Pravetz
.RE
.SH VIC 20 OPTIONS
.TP
.B --enabled-ram.bank0
.TP
.B --enabled-ram.bank1
.TP
.B --enabled-ram.bank2
.TP
.B --enabled-ram.bank3
.TP
.B --enabled-ram.bank5
.TP
.B --has-c1540
Indicates the presence of a Commodore 1540 disk drive
.TP
.B --output=\fItype\fR
\fItype\fR is the video output format, any one of:
.RS
.nf
- SVideo
- CompositeColour
.RE
.TP
.B --quickload
.TP
.B --region=\fIregion\fR
\fIregion\fR is the region of the system, any one of:
.RS
.nf
- American
- Danish
- Japanese
- European
- Swedish
.RE
.SH ZX80/81 OPTIONS
.TP
.B --ZX80-uses-ZX81-RPM
.TP
.B --automatic-tape-motor-control
.TP
.B --is-ZX81
.TP
.B --memory-model=\fImodel\fR
\fImodel\fR is the memory model of the system, any one of:
.RS
.nf
- Unexpanded
- SixteenKB
- SixtyFourKB
.RE
.TP
.B --quickload
.RE
.SH BUGS
No known bugs.
.SH AUTHOR
Thomas Harte (http://stackoverflow.com/users/427332/tommy)

View File

@ -0,0 +1,51 @@
%global debug_package %{nil}
Name: {{ packageName }}
Version: {{ version }}
Release: 1%{?dist}
Summary: {{ rpmSummary }}
License: {{ rpmLicense }}
URL: https://github.com/{{ github_user }}/{{ github_repo }}
Source0: {{ packageName }}-{{ version }}.tar
Source1: clksignal.1.gz
{% for dep in deps %}
Requires: {{ dep }}
{% endfor %}
%description
{{ readme['content'] | b64decode }}
%prep
%autosetup
%build
cd OSBindings/SDL
scons
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_docdir}
install -p -m 755 OSBindings/SDL/clksignal %{buildroot}/%{_bindir}
install -d -p -m 755 %{buildroot}/%{_docdir}/CLK
install -p -m 644 LICENSE %{buildroot}/%{_docdir}/CLK
install -p -m 644 BUILD.txt %{buildroot}/%{_docdir}/CLK
install -p -m 644 README.md %{buildroot}/%{_docdir}/CLK
install -p -m 644 README.txt %{buildroot}/%{_docdir}/CLK
install -d -p -m 755 %{buildroot}/%{_mandir}/man1
install -p -m 644 %{_sourcedir}/clksignal.1.gz %{buildroot}/%{_mandir}/man1
install -d -p -m 755 %{buildroot}/%{_datadir}/CLK
%files
%{_bindir}/clksignal
%license %{_docdir}/CLK/LICENSE
%doc %{_docdir}/CLK/BUILD.txt
%doc %{_docdir}/CLK/README.md
%doc %{_docdir}/CLK/README.txt
%doc %{_mandir}/man1/clksignal.1.gz
%dir %{_datadir}/CLK
%changelog
* Sun May 11 2020 <{{ ansible_env.USER }}@{{ ansible_env.HOSTNAME }}>
- Initial revision of package