-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: added homebrew formula package format to build
- Loading branch information
Richard Pospesel
committed
Mar 14, 2024
1 parent
6f4db2e
commit 1435386
Showing
7 changed files
with
72 additions
and
2 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
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
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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(debian-source) | ||
add_subdirectory(homebrew-formula) |
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,9 @@ | ||
if (BUILD_HOMEBREW_FORMULA) | ||
# generate homebrew formula .rb file | ||
set(LIBCGOSLING_RB_IN ${CMAKE_CURRENT_SOURCE_DIR}/libcgosling.rb.in) | ||
set(LIBCGOSLING_RB_OUT ${CMAKE_CURRENT_BINARY_DIR}/libcgosling.rb) | ||
configure_file(${LIBCGOSLING_RB_IN} ${LIBCGOSLING_RB_OUT} @ONLY) | ||
|
||
install(FILES ${LIBCGOSLING_RB_OUT} | ||
DESTINATION ${CMAKE_INSTALL_DATADIR}/gosling/packages/homebrew-formula) | ||
endif() |
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,9 @@ | ||
# homebrew-formula | ||
|
||
This buillds a homebrew formula for the cgosling crate which can be used to install the libcgosling shared libs, static libs, and development headers. | ||
|
||
## Building flask | ||
|
||
```bash | ||
brew install --build-from-source --formula /path/to/libcgosling.rb | ||
``` |
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,40 @@ | ||
class Libcgosling < Formula | ||
desc "" | ||
homepage "https://gosling.technology" | ||
url "https://github.com/blueprint-freespeech/gosling.git", tag: "cgosling-v@CGOSLING_VERSION@" | ||
license "BSD-3-Clause" | ||
|
||
depends_on "rust" => :build | ||
depends_on "cmake" => :build | ||
depends_on "tor" | ||
|
||
def install | ||
system "cmake", | ||
"-S", ".", | ||
"-B", "build", | ||
"-DCMAKE_BUILD_TYPE=Release", | ||
*std_cmake_args | ||
system "cmake", "--build", "build" | ||
system "cmake", "--install", "build" | ||
end | ||
|
||
test do | ||
(testpath/"test.cpp").write <<~EOS | ||
#include <cgosling.hpp> | ||
|
||
int main() { | ||
gosling_library* library = nullptr; | ||
gosling_error* error = nullptr; | ||
::gosling_library_init(&library, &error); | ||
if (library != nullptr && error == nullptr) { | ||
gosling_library_free(library); | ||
} else { | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
EOS | ||
system ENV.cxx, "-std=c++17", "test.cpp", "-I#{include}", "-L#{lib}", "-lcgosling", "-o", "test" | ||
system "./test" | ||
end | ||
end |