From 26d2794732d55357b94ad050378df274c02a4ffd Mon Sep 17 00:00:00 2001 From: OscarL Date: Thu, 3 Apr 2025 06:24:17 +0000 Subject: [PATCH] fnc: new recipe. (#12093) --- dev-vcs/fnc/fnc-0.18.recipe | 45 +++++++++++++++ dev-vcs/fnc/licenses/ISC | 13 +++++ dev-vcs/fnc/patches/fnc-0.18.patchset | 79 +++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 dev-vcs/fnc/fnc-0.18.recipe create mode 100644 dev-vcs/fnc/licenses/ISC create mode 100644 dev-vcs/fnc/patches/fnc-0.18.patchset diff --git a/dev-vcs/fnc/fnc-0.18.recipe b/dev-vcs/fnc/fnc-0.18.recipe new file mode 100644 index 000000000..d5d6033f6 --- /dev/null +++ b/dev-vcs/fnc/fnc-0.18.recipe @@ -0,0 +1,45 @@ +SUMMARY="Interactive text-based user interface for Fossil" +DESCRIPTION="fnc uses ncurses and libfossil to create a fossil ui experience in the terminal, \ +and parse local changes at the hunk level to prepare atomic commits." +HOMEPAGE="https://fnc.bsdbox.org/" +COPYRIGHT="2021, 2022 Mark Jamsek" +LICENSE="ISC" +REVISION="1" +SOURCE_URI="https://fnc.bsdbox.org/uv/dl/fnc-$portVersion.tar.gz" +CHECKSUM_SHA256="49f94c67e00213440d84f3b09bcf75850f9b6e8d8721856d68f4596c49cec780" +SOURCE_DIR="fnc-$portVersion" +PATCHES="fnc-$portVersion.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + fnc$secondaryArchSuffix = $portVersion + cmd:fnc = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libncursesw$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libncursesw$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:make + " + +BUILD() +{ + make $jobArgs +} + +INSTALL() +{ + # The makefile uses: ${PREFIX}${MANDIR}/man1 + make PREFIX=$prefix MANDIR="/$relativeManDir" install + install -D -m 644 README.md CHANGES.md -t $docDir +} diff --git a/dev-vcs/fnc/licenses/ISC b/dev-vcs/fnc/licenses/ISC new file mode 100644 index 000000000..c50c95be9 --- /dev/null +++ b/dev-vcs/fnc/licenses/ISC @@ -0,0 +1,13 @@ +Copyright (c) 2021, 2022 Mark Jamsek + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/dev-vcs/fnc/patches/fnc-0.18.patchset b/dev-vcs/fnc/patches/fnc-0.18.patchset new file mode 100644 index 000000000..d21929276 --- /dev/null +++ b/dev-vcs/fnc/patches/fnc-0.18.patchset @@ -0,0 +1,79 @@ +From b111a86e65d630a6d5263bfe865f0aabb349ef87 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Tue, 1 Apr 2025 23:04:04 -0300 +Subject: Fix compilation in Haiku. + + +diff --git a/fnc.bld.mk b/fnc.bld.mk +index b9d5fa4..16a0175 100644 +--- a/fnc.bld.mk ++++ b/fnc.bld.mk +@@ -40,14 +40,26 @@ SQLITE_CFLAGS = ${CFLAGS} \ + # FLAGS NEEDED TO BUILD LIBFOSSIL + FOSSIL_CFLAGS = ${CFLAGS} + ++UNAME_S := $(shell uname -s) ++ + # On SOME Linux (e.g., Ubuntu 18.04.6), we have to include wchar curses from + # I/.../ncursesw, but linking to -lncursesw (w/ no special -L path) works fine. + # FLAGS NEEDED TO BUILD FNC ++ifeq ($(UNAME_S),Haiku) ++FNC_CFLAGS = ${CFLAGS} -Wstrict-prototypes -Wmissing-prototypes -fPIC \ ++ -Wunused-variable -I./lib -I./include -I$(shell finddir B_SYSTEM_HEADERS_DIRECTORY) \ ++ -DFNC_VERSION=${VERSION} -DFNC_HASH=${HASH} -DFNC_DATE="${DATE}" ++else + FNC_CFLAGS = ${CFLAGS} -Wstrict-prototypes -Wmissing-prototypes -fPIC \ + -Wunused-variable -I./lib -I./include -I/usr/include/ncursesw \ + -DFNC_VERSION=${VERSION} -DFNC_HASH=${HASH} -DFNC_DATE="${DATE}" ++endif + ++ifeq ($(UNAME_S),Haiku) ++FNC_LDFLAGS = ${LDFLAGS} -lbsd -lz ++else + FNC_LDFLAGS = ${LDFLAGS} -lm -lutil -lz -lpthread ++endif + + # Compile-time checks and runtime protection mechanisms from the compiler + # hardening document: https://best.openssf.org/Compiler-Hardening-Guides +diff --git a/include/fnc_compat.h b/include/fnc_compat.h +index be51465..03959b0 100644 +--- a/include/fnc_compat.h ++++ b/include/fnc_compat.h +@@ -52,7 +52,7 @@ + #define _OPENBSD_SOURCE /* strtonum(3) */ + #endif + +-#if !defined(__linux__) && !defined(__APPLE__) ++#if !defined(__linux__) && !defined(__APPLE__) && !defined(__HAIKU__) + #define HAVE_REALLOCARRAY + #define HAVE_BSD_STRING + #define HAVE_STRTONUM +@@ -76,6 +76,12 @@ + #endif /* __MAC_OS_X_VERSION_MAX_ALLOWED */ + #endif /* __APPLE__ */ + ++#if defined(__HAIKU__) ++#ifndef _DEFAULT_SOURCE ++#define _DEFAULT_SOURCE ++#endif ++#endif /* ___HAIKU__ */ ++ + #ifndef __predict_true + #ifdef __has_builtin + #if __has_builtin(__builtin_expect) +diff --git a/src/fnc.c b/src/fnc.c +index 5871494..569a71a 100644 +--- a/src/fnc.c ++++ b/src/fnc.c +@@ -1007,7 +1007,7 @@ main(int argc, char **argv) + + argc -= optind; + argv += optind; +-#ifdef __linux__ ++#if defined(__linux__) || defined(__HAIKU__) + optind = 0; + #else + optind = 1; +-- +2.48.1 +