Skip to content

Commit

Permalink
add RPM packaging spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelpr authored and munjeni committed Aug 19, 2022
1 parent 99179a8 commit 7302a3e
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions newflasher.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# spec file for newflasher
#
# Copyright (c) 2022 Mikel Pérez ([email protected])
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.


%define pkg_version 52
Name: newflasher
Version: %{pkg_version}
Release: 1
Summary: Flash Sony Xperia firmwares for XZ Premium phones and later.
License: MIT
URL: https://github.com/munjeni/newflasher
Source0: https://github.com/munjeni/newflasher/archive/refs/tags/%{pkg_version}.tar.gz
BuildRequires: gcc
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(zlib)
Requires: (libexpat.so.1()(64bit) or libexpat.so.1)
Requires: zlib

%description
This _experimental_ software allows you to flash firmwares acquired
through XperiFirm to Sony phones from the XZ Premium and newer.

%prep
%setup -q

%build
make CFLAGS="%{optflags}" %{?_smp_mflags}
make newflasher.1.gz

%install
# the make install target wants to use real root privileges
# so can't use the %%make_install macro
mkdir -p %{buildroot}/usr/bin/
install -m 755 newflasher %{buildroot}/usr/bin/newflasher
mkdir -p %{buildroot}/usr/share/man/man1
install -m 644 newflasher.1.gz %{buildroot}/usr/share/man/man1

%files
%defattr(-,root,root)
%doc readme.md
%{_bindir}/%{name}
%{_mandir}/*/*

%changelog

8 comments on commit 7302a3e

@munjeni
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace pkg_version on the fly by reading version.h header?

@mikelpr
Copy link
Contributor Author

@mikelpr mikelpr commented on 7302a3e Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooof idk lemme check

@mikelpr
Copy link
Contributor Author

@mikelpr mikelpr commented on 7302a3e Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the expr or lua macros could help here https://rpm-software-management.github.io/rpm/manual/macros.html

@mikelpr
Copy link
Contributor Author

@mikelpr mikelpr commented on 7302a3e Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or turning this into a newflasher.spec.in and adding a makefile rule that makes a newflasher.spec from it and appropriately replaces with the value from version.h.

@munjeni
Copy link
Owner

@munjeni munjeni commented on 7302a3e Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less complication better! Maybe pickup directly trough "latest" somehow? Or maybe trought .in from makefile is better idea

@mikelpr
Copy link
Contributor Author

@mikelpr mikelpr commented on 7302a3e Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't be able to set the version for pushing upgrades (and showing the user in the package manager and UI).
.in is probably the right solution here

@mikelpr
Copy link
Contributor Author

@mikelpr mikelpr commented on 7302a3e Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened a pull request that does so over at #56

@munjeni
Copy link
Owner

@munjeni munjeni commented on 7302a3e Sep 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I'm merged it!

Please sign in to comment.