diff --git a/.gitignore b/.gitignore index 3f106f8..6acefb3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .deps/ Makefile Makefile.in +VERSION aclocal.m4 autom4te.cache/ compile @@ -15,3 +16,4 @@ depcomp ejq install-sh missing +packaging/rpm/ejq.spec diff --git a/COPYING b/COPYING index 2632ca5..9e874df 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2023 Paul Arthur MacIain +Copyright (c) 2023-2024 Paul Arthur MacIain Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile.am b/Makefile.am index 8bd294c..22430af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,8 @@ AM_CFLAGS = -Wall bin_PROGRAMS = ejq ejq_SOURCES = json.c json.h json-selector.c json-selector.h ejq.c + +EXTRA_DIST = VERSION packaging/rpm/ejq.spec + +rpm: dist-xz + rpmbuild -ta $(distdir).tar.xz diff --git a/configure.ac b/configure.ac index e41dc63..9497b92 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ -AC_INIT([easy-json-q], [0.1], [ezekielh@umich.edu]) +AC_INIT([ejq], m4_esyscmd([bash version.sh]), [ezekielh@umich.edu]) AM_INIT_AUTOMAKE([-Wall -Werror foreign no-dist-gzip dist-xz]) AC_PROG_CC AC_PROG_CC_C99 AC_PROG_INSTALL -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile packaging/rpm/ejq.spec]) AC_OUTPUT diff --git a/packaging/rpm/ejq.spec.in b/packaging/rpm/ejq.spec.in new file mode 100644 index 0000000..f94fe06 --- /dev/null +++ b/packaging/rpm/ejq.spec.in @@ -0,0 +1,31 @@ +Summary: A more performant jq alternative for simple cases +Name: @PACKAGE_NAME@ +Version: @PACKAGE_VERSION@ +Release: 1%{?dist} +License: MIT AND BSD-2-Clause +URL: https://flowerysong.com/ +Source0: %{name}-%{version}.tar.xz +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: gcc +BuildRequires: make + +%description +A simple CLI wrapper around James Barford's easy-json library. + +%prep +%autosetup -n %{name}-%{version} -p1 + +%build +%configure +%make_build + +%install +%make_install + +%files +%{_bindir}/ejq + +%changelog +* %(date "+%a %b %d %Y") (Automated RPM build) - %{version}-%{release} +- See git log for actual changes. diff --git a/version.sh b/version.sh new file mode 100755 index 0000000..4703a91 --- /dev/null +++ b/version.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -d .git ]; then + git describe --tags | perl -pe 'chomp; s/-/./; s/-.*//' | tee VERSION +elif [ -s VERSION ]; then + cat VERSION +else + echo -n UNKNOWN +fi