mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-16 00:30:06 +02:00
80 lines
2.3 KiB
Plaintext
80 lines
2.3 KiB
Plaintext
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
|
|
|