From 3d3fe70732bf3d0796a6e0caf3f0f83830d9c26e Mon Sep 17 00:00:00 2001 From: davidkaroly <92124087+davidkaroly@users.noreply.github.com> Date: Fri, 16 Dec 2022 09:43:06 +0100 Subject: [PATCH] putty: clean up recipe (#7570) --- net-misc/putty/additional-files/putty.rdef.in | 16 ++++++ net-misc/putty/patches/putty-0.78.patchset | 56 +++++++++++++++++++ net-misc/putty/putty-0.78.recipe | 35 ++++++++++-- 3 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 net-misc/putty/additional-files/putty.rdef.in create mode 100644 net-misc/putty/patches/putty-0.78.patchset diff --git a/net-misc/putty/additional-files/putty.rdef.in b/net-misc/putty/additional-files/putty.rdef.in new file mode 100644 index 000000000..27eed9c86 --- /dev/null +++ b/net-misc/putty/additional-files/putty.rdef.in @@ -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@"; diff --git a/net-misc/putty/patches/putty-0.78.patchset b/net-misc/putty/patches/putty-0.78.patchset new file mode 100644 index 000000000..42dac5a10 --- /dev/null +++ b/net-misc/putty/patches/putty-0.78.patchset @@ -0,0 +1,56 @@ +From 738b3b33c59f39f506793d1a2bca0eaae4e8ae7d Mon Sep 17 00:00:00 2001 +From: David Karoly +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 ++#include ++#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 + diff --git a/net-misc/putty/putty-0.78.recipe b/net-misc/putty/putty-0.78.recipe index fd71c25fe..0680c2ebe 100644 --- a/net-misc/putty/putty-0.78.recipe +++ b/net-misc/putty/putty-0.78.recipe @@ -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 }