-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rui Chen <[email protected]>
- Loading branch information
1 parent
4acc8ba
commit f476ac3
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1698,6 +1698,7 @@ libtrace | |
libtrng | ||
libucl | ||
libunibreak | ||
libunicode | ||
libuninameslist | ||
libunistring | ||
libunwind | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
class Libunicode < Formula | ||
desc "Modern C++20 Unicode library" | ||
homepage "https://github.com/contour-terminal/libunicode" | ||
url "https://github.com/contour-terminal/libunicode/archive/refs/tags/v0.6.0.tar.gz" | ||
sha256 "0c217f8264000f1b8c36e78969cb9cf91ac97de937cc141ab78e6b1ad7f404ef" | ||
license "Apache-2.0" | ||
|
||
depends_on "cmake" => :build | ||
uses_from_macos "python" => :build | ||
|
||
def install | ||
Check failure on line 11 in Formula/lib/libunicode.rb GitHub Actions / Linux`brew install --verbose --formula --build-bottle libunicode` failed on Linux!
Check failure on line 11 in Formula/lib/libunicode.rb GitHub Actions / macOS 13-arm64`brew install --verbose --formula --build-bottle libunicode` failed on macOS Ventura (13) on Apple Silicon!
|
||
args = %W[ | ||
-DLIBUNICODE_EXAMPLES=OFF | ||
-DLIBUNICODE_TESTING=OFF | ||
-DLIBUNICODE_BENCHMARK=OFF | ||
-DCMAKE_INSTALL_RPATH=#{rpath} | ||
] | ||
|
||
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args | ||
system "cmake", "--build", "build" | ||
system "cmake", "--install", "build" | ||
end | ||
|
||
test do | ||
(testpath/"test.cpp").write <<~CPP | ||
#include <iostream> | ||
#include <libunicode/capi.h> | ||
int main() { | ||
u32_char_t u32_codepoints[] = { 'h', 'e', 'l', 'l', 'o', ' ', 0x1F30D }; | ||
int gc_count = u32_gc_count(u32_codepoints, 7); | ||
std::cout << "Grapheme cluster count: " << gc_count << "\\n"; | ||
return 0; | ||
} | ||
CPP | ||
|
||
system ENV.cxx, "-std=c++17", "-o", "test", "test.cpp", "-I#{include}", "-L#{lib}", "-lunicode" | ||
assert_match "Grapheme cluster count: 7", shell_output("./test") | ||
|
||
assert_match "HYPHEN", shell_output("#{bin}/unicode-query U+2D") | ||
end | ||
end |