[PATCH] haiku: add Haiku support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Below you can find the current Haiku patches for upstream approval.

Currently Haiku is built with this [1] make configuration. Therefore it’s not possible to build the Haiku version with just ‘make’ yet.
I need help in adapting this configuration to the current Git Makefile, I don’t have much experience in Makefiles.
Or if it’s trivial, any quick-fix help is appreciated :).

In the meantime, please find the patchset below for review.

[1] https://github.com/haikuports/haikuports/blob/02adc9b2c68a0ad51bc4db5699b46adc15c24c5c/dev-vcs/git/git-2.27.0.recipe#L138

>From 2ac0c135d7c12a2581fe70ed1c8ffb4809950b55 Mon Sep 17 00:00:00 2001
From: Emir Sarı <bitigchi@xxxxxx>
Date: Sun, 21 Jun 2020 21:02:23 +0300
Subject: [PATCH] haiku: add Haiku support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit is a collection of minor patches previously applied as a
Haikuports patchset at github.com/haikuports/haikuports repository for
Git Haiku port.

Patchset history:

>From 56acac1a903dcbdd37c3b57fc168ad20179596b1 Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@xxxxxx>
Date: Tue, 13 Aug 2013 08:07:25 +0200
Subject: git-web--browse.sh: use "open" on Haiku

>From 0f557f23acaef82951851dc2165c9a9a4065703e Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@xxxxxx>
Date: Mon, 19 Jan 2015 15:37:16 -0500
Subject: On Haiku use the user settings directory instead of HOME

>From 2df42bd79662a4db16c91348283c22bddd728523 Mon Sep 17 00:00:00 2001
From: Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
Date: Mon, 19 Jan 2015 15:50:09 -0500
Subject: Ensure config-directory exists before using it.

>From e2d721e9456e591cd467759a5b8fa6a9102df0b7 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Sun, 14 Feb 2016 10:32:12 +0100
Subject: Move credential cache to the config directory.

>From 5841649bb9d07c614031f95dc211e066b9f4650a Mon Sep 17 00:00:00 2001
From: sfanxiang <sfanxiang@xxxxxxxxx>
Date: Mon, 1 Jan 2018 13:26:28 +0000
Subject: builtin: config: use xdg_config even if it does not exist

>From 82d3fea48bc155df46881f065349b3408c4ac75b Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Sun, 18 Nov 2018 11:56:26 +0100
Subject: Fix detection of Haiku for git web browse

Plus final code formatting and modifying existing patches to coexist
with the current code: Myself.

Signed-off-by: Emir Sarı <bitigchi@xxxxxx>
---
 builtin/config.c   |  9 +++++++++
 config.c           |  7 +++++++
 credential-cache.c |  4 ++++
 git-web--browse.sh |  5 +++++
 path.c             | 14 ++++++++++++--
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/builtin/config.c b/builtin/config.c
index ee4aef6..f9dfd08 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -645,6 +645,14 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 		char *user_config = expand_user_path("~/.gitconfig", 0);
 		char *xdg_config = xdg_config_home("config");
 
+		#ifdef __HAIKU__
+		if (!xdg_config) {
+			given_config_source.file = user_config;
+		} else {
+			given_config_source.file = xdg_config;
+			if (user_config) free(user_config);
+		}
+		#else
 		if (!user_config)
 			/*
 			 * It is unknown if HOME/.gitconfig exists, so
@@ -664,6 +672,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 			given_config_source.file = user_config;
 			free(xdg_config);
 		}
+		#endif
 	}
 	else if (use_system_config) {
 		given_config_source.file = git_etc_gitconfig();
diff --git a/config.c b/config.c
index 8db9c77..b956ff9 100644
--- a/config.c
+++ b/config.c
@@ -2745,6 +2745,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
 	int ret;
 	struct lock_file lock = LOCK_INIT;
 	char *filename_buf = NULL;
+	char *config_dir = NULL;
 	char *contents = NULL;
 	size_t contents_sz;
 	struct config_store_data store;
@@ -2761,6 +2762,12 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
 	if (!config_filename)
 		config_filename = filename_buf = git_pathdup("config");
 
+	config_dir = xstrdup(config_filename);
+	* find_last_dir_sep(config_dir) = '\0';
+	if (access(config_dir, F_OK) != 0)
+		mkdir(config_dir, 0755);
+	free(config_dir);
+
 	/*
 	 * The lock serves a purpose in addition to locking: the new
 	 * contents of .git/config will be written into it.
diff --git a/credential-cache.c b/credential-cache.c
index 1cccc3a..fe0d94c 100644
--- a/credential-cache.c
+++ b/credential-cache.c
@@ -87,7 +87,11 @@ static char *get_socket_path(void)
 {
 	struct stat sb;
 	char *old_dir, *socket;
+	#ifdef __HAIKU__
+	old_dir = xdg_config_home("credential-cache");
+	#else
 	old_dir = expand_user_path("~/.git-credential-cache", 0);
+	#endif
 	if (old_dir && !stat(old_dir, &sb) && S_ISDIR(sb.st_mode))
 		socket = xstrfmt("%s/socket", old_dir);
 	else
diff --git a/git-web--browse.sh b/git-web--browse.sh
index ae15253..bf9135c 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -133,6 +133,11 @@ if test -z "$browser" ; then
 		browser_candidates="cygstart $browser_candidates"
 	fi
 
+	# BEINCLUDES indicates Haiku
+	if test -f $BEINCLUDES; then
+		browser_candidates="open $browser_candidates"
+	fi
+
 	for i in $browser_candidates; do
 		init_browser_path $i
 		if type "$browser_path" > /dev/null 2>&1; then
diff --git a/path.c b/path.c
index 8b2c753..2fa8c56 100644
--- a/path.c
+++ b/path.c
@@ -12,6 +12,10 @@
 #include "packfile.h"
 #include "object-store.h"
 #include "lockfile.h"
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <StorageDefs.h>
+#endif
 
 static int get_st_mode_bits(const char *path, int *mode)
 {
@@ -1500,16 +1504,22 @@ int looks_like_command_line_option(const char *str)
 
 char *xdg_config_home(const char *filename)
 {
+	#ifdef __HAIKU__
+	char settingsPath[B_PATH_NAME_LENGTH];
+	assert(filename);
+	if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, true, settingsPath,
+		sizeof(settingsPath)) == B_OK)
+		return mkpathdup("%s/git/%s", settingsPath, filename);
+	#else
 	const char *home, *config_home;
-
 	assert(filename);
 	config_home = getenv("XDG_CONFIG_HOME");
 	if (config_home && *config_home)
 		return mkpathdup("%s/git/%s", config_home, filename);
-
 	home = getenv("HOME");
 	if (home)
 		return mkpathdup("%s/.config/git/%s", home, filename);
+	#endif
 	return NULL;
 }
 
-- 
2.27.0






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux