From cc33cbb333a984dcfb7e22a261e63e66bb04e1cc Mon Sep 17 00:00:00 2001 From: humdinger Date: Wed, 19 Oct 2022 18:16:39 +0200 Subject: [PATCH] haiku-format: update to latest commit (#7273) Added post-install script to move the config file to ~/config/settings --- .../haiku-format_install_config.sh | 16 ++++++++++++ .../haiku-format/haiku_format-10.0.1.recipe | 26 ++++++++++++++----- 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100755 sys-devel/haiku-format/additional-files/haiku-format_install_config.sh diff --git a/sys-devel/haiku-format/additional-files/haiku-format_install_config.sh b/sys-devel/haiku-format/additional-files/haiku-format_install_config.sh new file mode 100755 index 000000000..cf21c8c71 --- /dev/null +++ b/sys-devel/haiku-format/additional-files/haiku-format_install_config.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +settingsDir="$(finddir B_USER_SETTINGS_DIRECTORY)" + +configSysDataDir="$(finddir B_SYSTEM_DATA_DIRECTORY)/haiku-format" +configUserDataDir="$(finddir B_USER_DATA_DIRECTORY)/haiku-format" + +if [ -e "$configSysDataDir/.haiku-format" ]; then + cp -a "$configSysDataDir/.haiku-format" "$settingsDir" +elif [ -e "$configUserDataDir/.haiku-format" ]; then + cp -a "$configUserDataDir/.haiku-format" "$settingsDir" +else + exit 1 # couldn't find .haiku-format +fi + +chmod +w "$settingsDir/.haiku-format" diff --git a/sys-devel/haiku-format/haiku_format-10.0.1.recipe b/sys-devel/haiku-format/haiku_format-10.0.1.recipe index 37b3cf891..be688a1b0 100644 --- a/sys-devel/haiku-format/haiku_format-10.0.1.recipe +++ b/sys-devel/haiku-format/haiku_format-10.0.1.recipe @@ -2,20 +2,28 @@ SUMMARY="Code formatter for Haiku coding style" DESCRIPTION="Format C++ code following the Haiku Coding Guidelines. This is a fork of clang-format with customizations to implement the coding style followed by Haiku \ -and several applications running on Haiku." +and several applications running on Haiku. + +haiku-format looks for a configuration file '.haiku-format' or '_haiku-format', going up the file \ +hierarchy starting with the folder of the file you want to format. It defaults to ~/config/settings/.haiku-format." HOMEPAGE="https://github.com/owenca/haiku-format" COPYRIGHT="2003-2019 University of Illinois at Urbana-Champaign - 2019-2021 Owen Pan, Saloni Goyal, Adrien Destugues" + 2019-2022 Owen Pan" LICENSE="Apache v2 with LLVM Exception" -REVISION="1" -srcGitRev="bcc5a44f23e6663ade208840fe5509c6da5f2459" +REVISION="2" +srcGitRev="859d67b9d2f6395f20d424b94aa63b75db932c7d" SOURCE_URI="https://github.com/owenca/llvm-project/archive/$srcGitRev.tar.gz" SOURCE_DIR="llvm-project-$srcGitRev" -CHECKSUM_SHA256="b9b923099224a238187560fdf5bd2181d9df73a624040cc83c6db26f6aae3f77" +CHECKSUM_SHA256="a94575766a076d76031a0d2f4294cb254c2fc5af54716b38f7e92f05e0381acc" + +ADDITIONAL_FILES="haiku-format_install_config.sh" ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="x86" +USER_SETTINGS_FILES="settings/.haiku-format template data/haiku-format/.haiku-format" +POST_INSTALL_SCRIPTS="$relativePostInstallDir/haiku-format_install_config.sh" + PROVIDES=" haiku_format$secondaryArchSuffix = $portVersion cmd:haiku_format = $portVersion @@ -44,6 +52,10 @@ BUILD() INSTALL() { - mkdir -p $prefix/bin - cp build/bin/clang-format $prefix/bin/haiku-format + mkdir -p $prefix/bin $dataDir/haiku-format + cp -uv build/bin/clang-format $prefix/bin/haiku-format + cp -pv ./_haiku-format $dataDir/haiku-format/.haiku-format + + mkdir -p $postInstallDir + cp $portDir/additional-files/haiku-format_install_config.sh $postInstallDir }