haiku-format: upgrade to 22.1.0 (#13778)

This commit is contained in:
owenca
2026-02-28 03:26:37 -08:00
committed by GitHub
parent 9c92a7da98
commit 725f24d209
2 changed files with 94 additions and 85 deletions

View File

@@ -1,85 +0,0 @@
SUMMARY="Code formatter for Haiku coding style"
DESCRIPTION="Format C/C++ code following the Haiku Coding Guidelines.
This is a superset of clang-format with extensions that implement the coding style followed by \
Haiku and several applications running on Haiku.
haiku-format looks for a configuration file '.haiku-format', going up the file hierarchy starting \
with the folder of the file you want to format. This optional configuration file can be used to \
override any default Haiku style options."
HOMEPAGE="https://github.com/owenca/haiku-format"
COPYRIGHT="2003-2019 University of Illinois at Urbana-Champaign
2018-2026 Owen Pan"
LICENSE="Apache v2 with LLVM Exception"
REVISION="1"
baseURI="https://github.com/llvm/llvm-project/releases/download/llvmorg-$portVersion"
SOURCE_DIR="clang-$portVersion.src"
SOURCE_URI="$baseURI/$SOURCE_DIR.tar.xz"
CHECKSUM_SHA256="6090e3f23720d003cdd84483a47d0eec6d01adbb5e0c714ac0c8b58de546aa62"
SOURCE_DIR_2="cmake-$portVersion.src"
SOURCE_URI_2="$baseURI/$SOURCE_DIR_2.tar.xz"
CHECKSUM_SHA256_2="85735f20fd8c81ecb0a09abb0c267018475420e93b65050cc5b7634eab744de9"
SOURCE_DIR_3="llvm-$portVersion.src"
SOURCE_URI_3="$baseURI/$SOURCE_DIR_3.tar.xz"
CHECKSUM_SHA256_3="d9022ddadb40a15015f6b27e6549a7144704ded8828ba036ffe4b8165707de21"
SOURCE_DIR_4="third-party-$portVersion.src"
SOURCE_URI_4="$baseURI/$SOURCE_DIR_4.tar.xz"
CHECKSUM_SHA256_4="7fe99424384aea529ffaeec9cc9dfb8b451fd1852c03fc109e426fe208a1f1a7"
srcGitRev="4458d292953a08b42da15ea558fca748efb9674a"
diffFile="v$portVersion.diff"
SOURCE_URI_5="https://raw.githubusercontent.com/owenca/haiku-format/$srcGitRev/$diffFile#noarchive"
CHECKSUM_SHA256_5="cabb1a3310eff1fae49e5ec8998f3fb7bc265cbd2eb5bb5f9339aa4a295994cb"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
haiku_format$secondaryArchSuffix = $portVersion
cmd:git_haiku_format = $portVersion
cmd:haiku_format = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ninja
cmd:patch
cmd:python3
"
BUILD()
{
patch -p2 -r - < $sourceDir5/$diffFile
cd $sourceDir3/..
ln -fsv $sourceDir clang
ln -fsv $sourceDir2 cmake
ln -fsv $sourceDir3 llvm
ln -fsv $sourceDir4 third-party
cmake -Wno-dev -S llvm -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=On \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_TARGETS_TO_BUILD=X86
ninja -C build clang-format
strip -sv build/bin/clang-format
}
INSTALL()
{
mkdir -pv $binDir
cp -fv $sourceDir3/../build/bin/clang-format $binDir/haiku-format
gitHaikuFormat="$binDir/git-haiku-format"
sed s/clang-format/haiku-format/g tools/clang-format/git-clang-format > $gitHaikuFormat
chmod -v +x $gitHaikuFormat
}

View File

@@ -0,0 +1,94 @@
SUMMARY="Code formatter for Haiku coding style"
DESCRIPTION="Format C/C++ code following the Haiku Coding Guidelines.
This is a superset of clang-format with extensions that implement the coding style followed by \
Haiku and several applications running on Haiku.
haiku-format looks for a configuration file '.haiku-format', going up the file hierarchy starting \
with the folder of the file you want to format. This optional configuration file can be used to \
override any default Haiku style options."
HOMEPAGE="https://github.com/owenca/haiku-format"
COPYRIGHT="2003-2019 University of Illinois at Urbana-Champaign
2018-2026 Owen Pan"
LICENSE="Apache v2 with LLVM Exception"
REVISION="1"
SOURCE_DIR="llvm-project-$portVersion.src"
SOURCE_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-$portVersion/$SOURCE_DIR.tar.xz"
CHECKSUM_SHA256="25d2e2adc4356d758405dd885fcfd6447bce82a90eb78b6b87ce0934bd077173"
diffFile="v$portVersion.diff"
SOURCE_URI_2="https://raw.githubusercontent.com/owenca/haiku-format/6a0d8eeaaf613b78a8a05ccea6b5d147d067eb44/$diffFile#noarchive"
CHECKSUM_SHA256_2="31f56879a14106fb84c1690bc2213fb3d024c46877c51ba3c5ad997491100f10"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
haiku_format$secondaryArchSuffix = $portVersion
cmd:git_haiku_format = $portVersion
cmd:haiku_format = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ninja
cmd:patch
cmd:python3
"
TEST_REQUIRES="
cmd:diff
"
BUILD()
{
patch -p1 -r - < $sourceDir2/$diffFile
cmake -Wno-dev -S llvm -B build -G Ninja \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=On \
-DLLVM_APPEND_VC_REV=OFF \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_TARGETS_TO_BUILD=host
ninja -C build clang-format
}
TEST()
{
cd build
ninja FormatTests
log=ft.err
tools/clang/unittests/Format/FormatTests 2> $log
cat $log
ninja clang-format-check-format
input="a.cc"
echo -e 'Foo::Foo()\n\t:\n\tfoo(0),\n\tbar(1)\n{\n}' > $input
bin/clang-format -style='{}' $input | diff $input -
}
INSTALL()
{
mkdir -p $binDir
haikuFormat="$binDir/haiku-format"
cp -f build/bin/clang-format $haikuFormat
strip -s $haikuFormat
gitHaikuFormat="$binDir/git-haiku-format"
sed s/clang-format/haiku-format/g clang/tools/clang-format/git-clang-format > $gitHaikuFormat
chmod +x $gitHaikuFormat
}