fnc: new recipe. (#12093)

This commit is contained in:
OscarL
2025-04-03 06:24:17 +00:00
committed by GitHub
parent 5b1db33b69
commit 26d2794732
3 changed files with 137 additions and 0 deletions

View File

@@ -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
}

13
dev-vcs/fnc/licenses/ISC Normal file
View File

@@ -0,0 +1,13 @@
Copyright (c) 2021, 2022 Mark Jamsek <mark@jamsek.com>
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.

View File

@@ -0,0 +1,79 @@
From b111a86e65d630a6d5263bfe865f0aabb349ef87 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
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