putty: clean up recipe (#7570)

This commit is contained in:
davidkaroly
2022-12-16 09:43:06 +01:00
committed by GitHub
parent 0d3f177fe2
commit 3d3fe70732
3 changed files with 102 additions and 5 deletions

View File

@@ -0,0 +1,16 @@
resource app_flags B_MULTIPLE_LAUNCH;
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "PuTTY",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";

View File

@@ -0,0 +1,56 @@
From 738b3b33c59f39f506793d1a2bca0eaae4e8ae7d Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Thu, 15 Dec 2022 17:36:32 +0100
Subject: adjust folders for Haiku
diff --git a/unix/storage.c b/unix/storage.c
index ca22573..df40613 100644
--- a/unix/storage.c
+++ b/unix/storage.c
@@ -20,6 +20,11 @@
#include "storage.h"
#include "tree234.h"
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
#ifdef PATH_MAX
#define FNLEN PATH_MAX
#else
@@ -107,6 +112,15 @@ static char *make_filename(int index, const char *subname)
if (env && *env) {
xdg_dir = dupprintf("%s/putty", env);
}
+#ifdef __HAIKU__
+ if (!xdg_dir) {
+ char dir[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
+ dev_t volume = dev_for_path("/boot");
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK) {
+ xdg_dir = dupprintf("%s/putty", dir);
+ }
+ }
+#endif
if (!xdg_dir) {
if (home) {
tmp = home;
diff --git a/unix/utils/make_dir_path.c b/unix/utils/make_dir_path.c
index 4d212fe..87b8ead 100644
--- a/unix/utils/make_dir_path.c
+++ b/unix/utils/make_dir_path.c
@@ -16,6 +16,10 @@ char *make_dir_path(const char *path, mode_t mode)
int pos = 0;
char *prefix;
+ if (mkdir(path, mode) == 0) {
+ return NULL;
+ }
+
while (1) {
pos += strcspn(path + pos, "/");
--
2.37.3

View File

@@ -13,9 +13,11 @@ cryptography laws."
HOMEPAGE="https://www.chiark.greenend.org.uk/~sgtatham/putty/"
COPYRIGHT="1997-2022 Simon Tatham et al."
LICENSE="MIT"
REVISION="3"
REVISION="4"
SOURCE_URI="https://the.earth.li/~sgtatham/putty/$portVersion/putty-$portVersion.tar.gz"
CHECKSUM_SHA256="274e01bcac6bd155dfd647b2f18f791b4b17ff313753aa919fcae2e32d34614f"
PATCHES="putty-$portVersion.patchset"
ADDITIONAL_FILES="putty.rdef.in"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
@@ -41,6 +43,7 @@ REQUIRES="
lib:libharfbuzz$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libpango_1.0$secondaryArchSuffix
lib:libX11$secondaryArchSuffix
"
BUILD_REQUIRES="
@@ -50,7 +53,7 @@ BUILD_REQUIRES="
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:ninja
cmd:pkg_config$secondaryArchSuffix
"
@@ -66,17 +69,39 @@ defineDebugInfoPackage putty$secondaryArchSuffix \
BUILD()
{
cmake . $cmakeDirArgs \
cmake -S . -B build -G Ninja \
$cmakeDirArgs \
-DCMAKE_C_FLAGS="-DXDG_DEFAULT" \
-DCMAKE_EXE_LINKER_FLAGS="-lnetwork" \
-DCMAKE_BUILD_TYPE=Release
make $jobArgs
cmake --build build $jobArgs
}
INSTALL()
{
make install
cmake --install build
if [ $effectiveTargetArchitecture = x86 ]; then
mv $binDir/* $prefix/bin/
fi
mkdir -p $appsDir
ln -s $prefix/bin/putty $appsDir/PuTTY
local APP_SIGNATURE="application/x-vnd.putty"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
#local MINOR="`echo "$portVersion" | cut -d. -f3`"
local MINOR="0"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/putty.rdef.in > $sourceDir/putty.rdef
addResourcesToBinaries $sourceDir/putty.rdef $appsDir/PuTTY
addAppDeskbarSymlink $appsDir/PuTTY
}