Skip to content

Commit 5e08001

Browse files
committed
Merge branch 'trentpi/spec-file'
2 parents 5252757 + 22e2c68 commit 5e08001

File tree

5 files changed

+105
-1
lines changed

5 files changed

+105
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Makefile.in
4545
*.log
4646
*.trs
4747
*.tar.gz
48+
/packaging/tg-timer.spec
4849

4950
# build directories
5051
/deb

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ You can now launch tg by typing
4444

4545
Binary .deb packages can be downloaded from https://tg.ciovil.li
4646

47+
### Fedora, CentOS or other Redhat-based
48+
49+
Binary RPM packages are available from https://copr.fedorainfracloud.org/coprs/tpiepho/tg-timer/
50+
51+
This COPR repository can be added to dnf's list with:
52+
```sh
53+
dnf copr enable tpiepho/tg-timer
54+
```
55+
Then tg-timer can be installed with `dnf install tg-timer`, or with any dnf
56+
based GUI package installer.
57+
4758
## Compiling from sources
4859

4960
The source code of tg can probably be built by any C99 compiler, however
@@ -107,3 +118,11 @@ cd tg
107118
./configure
108119
make
109120
```
121+
122+
To build an RPM on Fedora or another RPM based distro, install the build
123+
prerequisites and checkout the source as for compiling (above), then run
124+
`rpmbuild` to create the RPM:
125+
126+
```sh
127+
rpmbuild --build-in-place -bb packaging/tg-timer.spec
128+
```

configure.ac

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ CC_CHECK_LDFLAGS([-Wl,--as-needed], [AC_SUBST([AM_LDFLAGS], [-Wl,--as-needed])],
2222
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-Wall -Wextra])
2323
AC_SUBST([WARNINGFLAGS], $with_cflags)
2424

25-
AC_OUTPUT([Makefile icons/Makefile])
25+
AC_CONFIG_FILES([Makefile icons/Makefile])
26+
AC_CONFIG_FILES([packaging/tg-timer.spec:packaging/tg-timer.inc.in:packaging/tg-timer.in.spec])
27+
AC_OUTPUT
2628

2729
AC_MSG_RESULT([
2830
$PACKAGE_NAME $VERSION

packaging/tg-timer.in.spec

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# If the configure script is run, it will define the package version by
2+
# prepending a definition of AC_VERSION to this spec.
3+
# If rpkg preprocesses this file, as in a COPR build, then it will generate the
4+
# package version from the "version" file and saved in the macro RPKG_VERSION.
5+
# This does not require running the configure script, which does not happen on
6+
# COPR.
7+
8+
# It's also possible to define the macro 'version' on the command line. The
9+
# version used will be the first defined from 'version' macro, AC_VERSION, and
10+
# then RPKG_VERSION.
11+
12+
# rpkg replaces with command output, otherwise rpmbuild replaces 3 {'s with 2 {'s.
13+
%define RPKG_VERSION {{{ sed s/-/_/ version }}}
14+
%define RPKG_SNAPINFO {{{ echo .$(git log -1 --date=format:"%Y%m%d" --format="%ad")git$(git rev-parse --short HEAD) }}}
15+
%define have_rpkg %([ "%{RPKG_VERSION}" = "{{ sed s/-/_/ version }}" ]; echo $?)
16+
%if 0%{!?version:1}
17+
%if %{have_rpkg}
18+
%define version %{RPKG_VERSION}
19+
%define snapinfo %{RPKG_SNAPINFO}
20+
%endif
21+
%{?AC_VERSION: %define version %{AC_VERSION}}
22+
%{!?version: %{error:Need to define version, e.g. --define "version x.y.z", or preprocess this file with configure or rpkg}}
23+
%endif
24+
25+
# Define pkgrel when building to set release. Otherwise git rev is used for snapshot tag.
26+
%if 0%{!?pkgrel:1} && 0%{!?snapinfo:1}
27+
%{warn: pkgrel not defined, attempting to build snapshot from current git checkout}
28+
%{warn: Define pkgrel, e.g. --define "pkgrel 1", if not building git snapshot}
29+
%define snapinfo .%(git log -1 --date=format:"%Y%m%d" --format="%ad")git%(git rev-parse --short HEAD)
30+
%define needgit 1
31+
%endif
32+
33+
Name: tg-timer
34+
Version: %{version}
35+
Release: %{?pkgrel}%{!?pkgrel:1}%{?snapinfo}%{?dist}
36+
Summary: Mechanical watch movement timegrapher
37+
License: GPL2
38+
Group: Misc
39+
URL: https://github.com/vacaboja/tg
40+
Source: %name-%version.tar.gz
41+
Packager: Trent Piepho <[email protected]>
42+
BuildRequires: gcc, gtk3-devel, portaudio-devel, fftw-devel
43+
BuildRequires: desktop-file-utils, autoconf, automake
44+
%{?needgit:BuildRequires: git}
45+
46+
%description
47+
Tg (tg-timer) is a program to evaluate the performance of mechanical watch
48+
movements. Tg works with the noise produced by a watch mechanism, and it
49+
produces real-time readings of the rate (or accuracy) and various other
50+
operational parameters.
51+
52+
%prep
53+
%setup -q
54+
55+
%build
56+
autoreconf -fi
57+
%configure
58+
%make_build
59+
60+
%install
61+
%make_install
62+
63+
%check
64+
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
65+
66+
%files
67+
%license LICENSE
68+
%doc README.md
69+
%_bindir/%{name}
70+
%_mandir/man1/%{name}.1*
71+
%{_datadir}/applications/%{name}.desktop
72+
%{_datadir}/icons/hicolor/*/apps/%{name}.png
73+
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
74+
%{_datadir}/icons/hicolor/*/mimetypes/application-x-%{name}-data.png
75+
%{_datadir}/icons/hicolor/scalable/mimetypes/application-x-%{name}-data.svg
76+
%{_datadir}/mime/packages/%{name}.xml
77+
78+
%changelog
79+
* Sat Apr 03 2021 Trent Piepho <tpiepho at gmail.com> 1:0.5.2
80+
- Initial version

packaging/tg-timer.inc.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Added by configure script to define package version
2+
%define AC_VERSION @PACKAGE_VERSION@

0 commit comments

Comments
 (0)