repo/proj/guru:dev commit in: dev-util/flips/

"Esteve Varela Colominas" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786657934.c0185e71046ee20a98b77131abcfa37ae343d4cc.esteve.varela@gentoo>
commit:     c0185e71046ee20a98b77131abcfa37ae343d4cc
Author:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
AuthorDate: Thu Aug 13 21:50:32 2026 +0000
Commit:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
CommitDate: Thu Aug 13 21:52:14 2026 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c0185e71

dev-util/flips: New package

There's a distinct lack of IPS and BPS patching tools in the repository,
this is the only linux-native tool of the sort I've used for years. I
think it's time to add it.

Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>

 dev-util/flips/Manifest               |  2 +
 dev-util/flips/flips-1.31.ebuild      | 79 ++++++++++++++++++++++++++++++++++
 dev-util/flips/flips-1.31_p202.ebuild | 81 +++++++++++++++++++++++++++++++++++
 dev-util/flips/metadata.xml           | 12 ++++++
 4 files changed, 174 insertions(+)

diff --git a/dev-util/flips/Manifest b/dev-util/flips/Manifest
new file mode 100644
index 0000000000..825ee6d9d2
--- /dev/null
+++ b/dev-util/flips/Manifest
@@ -0,0 +1,2 @@
+DIST flips-1.31.zip 158223 BLAKE2B e553a92e3bd8f5c1cfc768b023211733a48e1394eed1f0a991563eccd304ce7607b8dac3ad618bf768e1e52c591a5f2cde9e29b0f9cfbf0ab09f8449c4aba274 SHA512 40c1e9e2c78ef8f30e1a146dd1b1bd1c49addb97c1bc55bd1b1c964f0ee78d2626704ff706c1eb60fc5cd20ffdb70b5188ff8ac6cf34193ef73f2ba48241deb2
+DIST flips-1.31_p202.tar.gz 44534139 BLAKE2B 9d9a3358432696cad19c976126ce51c3e4c0bcb0439779b5639caafd85974481a0d0f8b31039489d25c20c170f87e018cc5f30ceb81d05303053849a4d5bd429 SHA512 3468b477b075cd55189e3f993930cc4c6857227dd9a63e9f8a5ba51fb63d561df3d7914f2f7dd7093cf0ecf33204be571f127f340c0be8a1d03a07f844e570e5

diff --git a/dev-util/flips/flips-1.31.ebuild b/dev-util/flips/flips-1.31.ebuild
new file mode 100644
index 0000000000..18967495e8
--- /dev/null
+++ b/dev-util/flips/flips-1.31.ebuild
@@ -0,0 +1,79 @@
+# Copyright 2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs desktop xdg
+
+DESCRIPTION="Patcher for IPS and BPS files"
+HOMEPAGE="https://www.smwcentral.net/?p=section&a=details&id=11474"
+
+SRC_URI="https://dl.smwcentral.net/11474/floating.zip -> ${P}.zip"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="+divsuf +gtk +pgo"
+RDEPEND="
+	divsuf? ( dev-libs/libdivsufsort )
+	gtk? (
+		x11-libs/gtk+:3
+	)
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	app-arch/unzip
+	virtual/imagemagick-tools[png]
+	virtual/pkgconfig
+"
+
+src_unpack() {
+	__vecho ">>> Unpacking ${P}.zip to ${PWD}"
+	unzip -q "${DISTDIR}/${P}.zip" src.zip || die
+	mkdir "${P}" || die
+	unzip -q -d "${P}" src.zip || die
+}
+
+src_configure() { :; }
+
+src_compile() {
+	local pkg_config="$(tc-getPKG_CONFIG)"
+	local myemakeargs=(
+		CXX="$(tc-getCXX)"
+		CFLAGS="${CPPFLAGS} ${CXXFLAGS}"
+		LFLAGS="${LDFLAGS}"
+		GTKFLAGS="$("${pkg_config}" --cflags --libs gtk+-3.0)"
+
+		TARGET=$(usex gtk gtk cli)
+		DIVSUF=$(usex divsuf)
+	)
+	if use divsuf; then
+		myemakeargs+=(
+			DIVSUF_CFLAGS="-DUSE_DIVSUFSORT $("${pkg_config}" --cflags libdivsufsort)"
+			DIVSUF_LFLAGS="$("${pkg_config}" --libs libdivsufsort)"
+		)
+	fi
+	if ! use pgo; then
+		emake "${myemakeargs[@]}"
+	else
+		# From make.sh
+		emake "${myemakeargs[@]}" CFLAGS="${CXXFLAGS} -fprofile-generate"
+		# Upstream is missing profiling data, use whatever's available
+		einfo "Running tests ..."
+		./profile/profile1.sh ./flips bps.ico ips.ico || die
+		./profile/profile1.sh ./flips libbps.cpp libips.cpp || die
+		rm flips || die
+		emake "${myemakeargs[@]}" CFLAGS="${CXXFLAGS} -fprofile-use"
+	fi
+
+	magick flips.ico flips.png || die
+}
+
+src_install() {
+	einstalldocs
+	dobin flips
+
+	# Using the category field from newer upstream
+	make_desktop_entry flips flips flips 'GNOME;GTK;Utility;RevisionControl'
+	newicon flips-2.png flips.png
+}

diff --git a/dev-util/flips/flips-1.31_p202.ebuild b/dev-util/flips/flips-1.31_p202.ebuild
new file mode 100644
index 0000000000..0052e94995
--- /dev/null
+++ b/dev-util/flips/flips-1.31_p202.ebuild
@@ -0,0 +1,81 @@
+# Copyright 2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs xdg
+
+DESCRIPTION="Patcher for IPS and BPS files"
+HOMEPAGE="https://www.smwcentral.net/?p=section&a=details&id=11474"
+
+MY_PV="${PV##*_p}"
+SRC_URI="https://git.disroot.org/Sir_Walrus/Flips/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/flips"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="+gtk +pgo"
+RDEPEND="
+	dev-libs/libdivsufsort
+	gtk? (
+		x11-libs/gtk+:3
+	)
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	virtual/pkgconfig
+"
+
+src_prepare() {
+	# Unbundle divsuf
+	sed -e '/^DIVSUF :=/{N;N;d}' \
+		-i Makefile || die
+
+	# Avoid traversing the filesystem to find a git repository
+	sed -e '/^COMMIT_COUNT :=/s/:=.*$/:=/' \
+		-i Makefile || die
+
+	default
+}
+
+src_configure() { :; }
+
+src_compile() {
+	local pkg_config="$(tc-getPKG_CONFIG)"
+	local DIVSUF_CFLAGS="$("${pkg_config}" --cflags libdivsufsort)"
+	local DIVSUF_LIBS="$("${pkg_config}" --libs libdivsufsort)"
+	local myemakeargs=(
+		CXX="$(tc-getCXX)"
+		PKG_CONFIG="$pkg_config"
+		CFLAGS="${CPPFLAGS} ${DIVSUF_CFLAGS} ${CXXFLAGS}"
+		LFLAGS="${LDFLAGS} ${DIVSUF_LIBS}"
+
+		TARGET=$(usex gtk gtk cli)
+	)
+	if ! use pgo; then
+		emake "${myemakeargs[@]}"
+	else
+		# From make-linux.sh
+		emake "${myemakeargs[@]}" CFLAGS="${CXXFLAGS} -fprofile-generate"
+		einfo "Running tests ..."
+		./flips --create --bps-delta \
+			profile/firefox-10.0esr.tar \
+			profile/firefox-17.0esr.tar /dev/null || die
+		./flips --create --bps-delta-moremem \
+			profile/firefox-10.0esr.tar \
+			profile/firefox-17.0esr.tar /dev/null || die
+		rm flips || die
+		emake "${myemakeargs[@]}" CFLAGS="${CXXFLAGS} -fprofile-use"
+	fi
+}
+
+src_install() {
+	einstalldocs
+
+	if ! use gtk; then
+		dobin flips
+	else
+		emake TARGET=gtk DESTDIR="${ED}" install
+	fi
+}

diff --git a/dev-util/flips/metadata.xml b/dev-util/flips/metadata.xml
new file mode 100644
index 0000000000..5644df6dc1
--- /dev/null
+++ b/dev-util/flips/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="person">
+    <email>[email protected]</email>
+    <name>Esteve Varela Colominas</name>
+  </maintainer>
+  <use>
+    <flag name="divsuf">Uses the more performant <pkg>dev-libs/libdivsufsort</pkg> instead of a bundled modified copy of yuta256's sais algorithm.</flag>
+    <flag name="pgo">Optimize the build using Profile Guided Optimization (PGO)</flag>
+  </use>
+</pkgmetadata>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.