From 97c367ea2f21558057a8cec069021d4b905cc94e Mon Sep 17 00:00:00 2001 From: Chris Rhodes Date: Thu, 21 Dec 2017 00:25:39 -0600 Subject: [PATCH 1/5] add rpm spec file for centos7 (and possibly other rpm based distros) --- dist/rpm/libxjwt.spec | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 dist/rpm/libxjwt.spec diff --git a/dist/rpm/libxjwt.spec b/dist/rpm/libxjwt.spec new file mode 100644 index 0000000..bef88e6 --- /dev/null +++ b/dist/rpm/libxjwt.spec @@ -0,0 +1,52 @@ +Name: libxjwt +Version: 1.0.1 +Release: 1%{?dist} + +Summary: Minimal C library for validation of real-world JWTs +License: Apache 2.0 +Group: System/Libraries +Source0: https://github.com/ScaleFT/libxjwt/archive/v1.0.1.tar.gz + +URL: https://github.com/ScaleFT/libxjwt +Vendor: ScaleFT http://scaleft.com + +BuildRequires: scons +BuildRequires: openssl-devel +BuildRequires: jansson-devel + +%description +libxjwt seeks to provide a minimal c89-style library and API surface for validating a compact-form JWT against a set of JWKs. This is not meant to be a general purpose JOSE library. If you are looking for a more general purpose C library, consider cjose. + +%files +/usr/local/lib/%{name}.so +/etc/ld.so.conf.d/local.conf +%license $RPM_BUILD_DIR/libxjwt-%{version}/LICENSE +%doc $RPM_BUILD_DIR/libxjwt-%{version}/README.md + +%package -n libxjwt-devel +Summary: libxjwt dev files +Group: Development/Other +Requires: %{name} = %{version}-%{release} +Provides: libxjwt-devel = %{version}-%{release} + +%description -n libxjwt-devel +libxjwt development files. + +%files -n libxjwt-devel +/usr/local/include/xjwt/*.h + +%prep +rm -Rf $RPM_BUILD_DIR/libxjwt-%{version} +tar xvfz $RPM_SOURCE_DIR/v%{version}.tar.gz -C $RPM_BUILD_DIR/ + +%build +cd libxjwt-%{version} +scons build + +%install +cd libxjwt-%{version} +scons install --install-sandbox="$RPM_BUILD_ROOT" +echo /usr/local/lib > $RPM_BUILD_DIR/libxjwt-%{version}/local.conf +install -p -D -m 0644 $RPM_BUILD_DIR/libxjwt-%{version}/local.conf %{buildroot}/etc/ld.so.conf.d/local.conf + +%post -p /sbin/ldconfig From 7041eb3a143aa8f44a20bd60832815c0dbf0d0a8 Mon Sep 17 00:00:00 2001 From: Chris Rhodes Date: Thu, 21 Dec 2017 00:31:57 -0600 Subject: [PATCH 2/5] add info on rpm build --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index fe75eea..40052ec 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,11 @@ An example of using these APIs is in [test_verify.c](./tests/test_verify.c) - Parsing the JWT Signature. This is done by `xjwt__parse_ec_signature` function in [parse.c](./src/parse.c). - Validation of the EC Signature for the Header+Payload is done using OpenSSL's EVP API. +## Building Centos7 rpm + +Assuming a proper rpmbuild environment exists on the build host, a pair of rpms (bin and devel) for Centos7 can be built using the included spec file like so: +```rpmbuild --undefine=_disable_source_fetch -bb dist/rpm/libxjwt.spec``` + # License `libxjwt` is licensed under the Apache License Version 2.0. See the [LICENSE file](./LICENSE) for details. From cdad08f317b95b230359f6560a75499c58d67290 Mon Sep 17 00:00:00 2001 From: Chris Rhodes Date: Thu, 21 Dec 2017 01:25:00 -0600 Subject: [PATCH 3/5] prefix to /usr, drop ld path include and variablize name use --- dist/rpm/libxjwt.spec | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/dist/rpm/libxjwt.spec b/dist/rpm/libxjwt.spec index bef88e6..6ba1ee1 100644 --- a/dist/rpm/libxjwt.spec +++ b/dist/rpm/libxjwt.spec @@ -5,7 +5,7 @@ Release: 1%{?dist} Summary: Minimal C library for validation of real-world JWTs License: Apache 2.0 Group: System/Libraries -Source0: https://github.com/ScaleFT/libxjwt/archive/v1.0.1.tar.gz +Source0: https://github.com/ScaleFT/libxjwt/archive/v%{version}.tar.gz URL: https://github.com/ScaleFT/libxjwt Vendor: ScaleFT http://scaleft.com @@ -18,35 +18,32 @@ BuildRequires: jansson-devel libxjwt seeks to provide a minimal c89-style library and API surface for validating a compact-form JWT against a set of JWKs. This is not meant to be a general purpose JOSE library. If you are looking for a more general purpose C library, consider cjose. %files -/usr/local/lib/%{name}.so -/etc/ld.so.conf.d/local.conf -%license $RPM_BUILD_DIR/libxjwt-%{version}/LICENSE -%doc $RPM_BUILD_DIR/libxjwt-%{version}/README.md +/usr/lib/%{name}.so +%license $RPM_BUILD_DIR/%{name}-%{version}/LICENSE +%doc $RPM_BUILD_DIR/%{name}-%{version}/README.md -%package -n libxjwt-devel -Summary: libxjwt dev files +%package -n %{name}-devel +Summary: %{name} dev files Group: Development/Other Requires: %{name} = %{version}-%{release} -Provides: libxjwt-devel = %{version}-%{release} +Provides: %{name}-devel = %{version}-%{release} -%description -n libxjwt-devel -libxjwt development files. +%description -n %{name}-devel +%{name} development files. -%files -n libxjwt-devel -/usr/local/include/xjwt/*.h +%files -n %{name}-devel +/usr/include/xjwt/*.h %prep -rm -Rf $RPM_BUILD_DIR/libxjwt-%{version} +rm -Rf $RPM_BUILD_DIR/%{name}-%{version} tar xvfz $RPM_SOURCE_DIR/v%{version}.tar.gz -C $RPM_BUILD_DIR/ %build -cd libxjwt-%{version} +cd %{name}-%{version} scons build %install -cd libxjwt-%{version} -scons install --install-sandbox="$RPM_BUILD_ROOT" -echo /usr/local/lib > $RPM_BUILD_DIR/libxjwt-%{version}/local.conf -install -p -D -m 0644 $RPM_BUILD_DIR/libxjwt-%{version}/local.conf %{buildroot}/etc/ld.so.conf.d/local.conf +cd %{name}-%{version} +scons install --install-sandbox="$RPM_BUILD_ROOT" prefix=/usr %post -p /sbin/ldconfig From 9707d5d9eb335e4ac8ad7fd957dbf7ca9adfc0cd Mon Sep 17 00:00:00 2001 From: Chris Rhodes Date: Thu, 21 Dec 2017 13:46:19 -0600 Subject: [PATCH 4/5] update spec for autotools changes --- dist/rpm/libxjwt.spec | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/rpm/libxjwt.spec b/dist/rpm/libxjwt.spec index 6ba1ee1..5989e20 100644 --- a/dist/rpm/libxjwt.spec +++ b/dist/rpm/libxjwt.spec @@ -1,5 +1,5 @@ Name: libxjwt -Version: 1.0.1 +Version: 1.0.2 Release: 1%{?dist} Summary: Minimal C library for validation of real-world JWTs @@ -14,11 +14,13 @@ BuildRequires: scons BuildRequires: openssl-devel BuildRequires: jansson-devel +Prefix: %{_prefix} + %description libxjwt seeks to provide a minimal c89-style library and API surface for validating a compact-form JWT against a set of JWKs. This is not meant to be a general purpose JOSE library. If you are looking for a more general purpose C library, consider cjose. %files -/usr/lib/%{name}.so +%{_prefix}/lib/%{name}.* %license $RPM_BUILD_DIR/%{name}-%{version}/LICENSE %doc $RPM_BUILD_DIR/%{name}-%{version}/README.md @@ -32,7 +34,7 @@ Provides: %{name}-devel = %{version}-%{release} %{name} development files. %files -n %{name}-devel -/usr/include/xjwt/*.h +%{_prefix}/include/xjwt/*.h %prep rm -Rf $RPM_BUILD_DIR/%{name}-%{version} @@ -40,10 +42,10 @@ tar xvfz $RPM_SOURCE_DIR/v%{version}.tar.gz -C $RPM_BUILD_DIR/ %build cd %{name}-%{version} -scons build +./configure --prefix=%{_prefix} +make %install +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT cd %{name}-%{version} -scons install --install-sandbox="$RPM_BUILD_ROOT" prefix=/usr - -%post -p /sbin/ldconfig +make DESTDIR=$RPM_BUILD_ROOT install From c019802cefcff48ba140b4529c8c6dcff8b011d4 Mon Sep 17 00:00:00 2001 From: Chris Rhodes Date: Thu, 21 Dec 2017 13:51:09 -0600 Subject: [PATCH 5/5] no longer need sconds as a build dep --- dist/rpm/libxjwt.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/dist/rpm/libxjwt.spec b/dist/rpm/libxjwt.spec index 5989e20..cd89524 100644 --- a/dist/rpm/libxjwt.spec +++ b/dist/rpm/libxjwt.spec @@ -10,7 +10,6 @@ Source0: https://github.com/ScaleFT/libxjwt/archive/v%{version}.tar.gz URL: https://github.com/ScaleFT/libxjwt Vendor: ScaleFT http://scaleft.com -BuildRequires: scons BuildRequires: openssl-devel BuildRequires: jansson-devel