Skip to content

Commit 33b21e3

Browse files
committed
Initial trick formula
0 parents  commit 33b21e3

4 files changed

Lines changed: 231 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: brew pr-pull
2+
3+
on:
4+
pull_request_target:
5+
branches:
6+
- brew
7+
types:
8+
- labeled
9+
10+
jobs:
11+
pr-pull:
12+
if: contains(github.event.pull_request.labels.*.name, 'pr-pull')
13+
runs-on: ubuntu-22.04
14+
permissions:
15+
actions: read
16+
checks: read
17+
contents: write
18+
issues: read
19+
pull-requests: write
20+
steps:
21+
- name: Set up Homebrew
22+
uses: Homebrew/actions/setup-homebrew@main
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Set up git
27+
uses: Homebrew/actions/git-user-config@main
28+
29+
- name: Pull bottles
30+
env:
31+
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
PULL_REQUEST: ${{ github.event.pull_request.number }}
33+
run: brew pr-pull --debug --tap="$GITHUB_REPOSITORY" "$PULL_REQUEST"
34+
35+
- name: Push commits
36+
uses: Homebrew/actions/git-try-push@main
37+
with:
38+
branch: brew
39+
40+
- name: Delete branch
41+
if: github.event.pull_request.head.repo.fork == false
42+
env:
43+
BRANCH: ${{ github.event.pull_request.head.ref }}
44+
run: git push --delete origin "$BRANCH"

.github/workflows/tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: brew test-bot
2+
3+
on:
4+
push:
5+
branches:
6+
- brew
7+
pull_request:
8+
branches:
9+
- brew
10+
11+
jobs:
12+
test-bot:
13+
strategy:
14+
matrix:
15+
os: [ubuntu-22.04, macos-15, macos-26]
16+
runs-on: ${{ matrix.os }}
17+
permissions:
18+
actions: read
19+
checks: read
20+
contents: read
21+
pull-requests: read
22+
steps:
23+
- name: Set up Homebrew
24+
id: set-up-homebrew
25+
uses: Homebrew/actions/setup-homebrew@main
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Cache Homebrew Bundler RubyGems
30+
uses: actions/cache@v4
31+
with:
32+
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
33+
key: ${{ matrix.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
34+
restore-keys: ${{ matrix.os }}-rubygems-
35+
36+
- run: brew test-bot --only-cleanup-before
37+
38+
- run: brew test-bot --only-setup
39+
40+
- run: brew test-bot --only-tap-syntax
41+
- run: brew test-bot --only-formulae
42+
if: github.event_name == 'pull_request'
43+
44+
- name: Upload bottles as artifact
45+
if: always() && github.event_name == 'pull_request'
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: bottles_${{ matrix.os }}
49+
path: "*.bottle.*"

Formula/trick.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
class Trick < Formula
2+
desc "Simulation development framework"
3+
homepage "https://github.com/nasa/trick"
4+
url "https://github.com/nasa/trick/archive/refs/tags/25.0.2.tar.gz"
5+
sha256 "0e51ee68d7239423a18b144dea9e0560125c523a0e2d8a914933ace1bba39dd3"
6+
license "NASA-1.3"
7+
head "https://github.com/nasa/trick.git", branch: "master"
8+
9+
depends_on "pkgconf" => :build
10+
depends_on "bison"
11+
depends_on "gsl"
12+
depends_on "hdf5"
13+
depends_on "libaec"
14+
depends_on "libx11"
15+
depends_on "libxt"
16+
depends_on "llvm"
17+
depends_on :macos
18+
depends_on "maven"
19+
depends_on "openjdk"
20+
depends_on "openmotif"
21+
depends_on "perl"
22+
depends_on "python"
23+
depends_on "swig"
24+
depends_on "udunits"
25+
depends_on "zlib"
26+
27+
uses_from_macos "flex"
28+
uses_from_macos "libxml2"
29+
30+
def install
31+
system "./configure",
32+
"--with-gsl=#{Formula["gsl"].opt_prefix}",
33+
"--with-hdf5=#{Formula["hdf5"].opt_prefix}",
34+
"--with-udunits=#{Formula["udunits"].opt_prefix}"
35+
system "make", "-j#{ENV.make_jobs}"
36+
37+
bin.install Dir["bin/*"] if File.directory?("bin")
38+
lib.install Dir["lib/*"] if File.directory?("lib")
39+
include.install Dir["include/*"] if File.directory?("include")
40+
share.install Dir["share/*"] if File.directory?("share")
41+
libexec.install Dir["libexec/*"] if File.directory?("libexec")
42+
43+
# Install trick_source/er7_utils
44+
(prefix/"trick_source").install "trick_source/er7_utils"
45+
46+
# Clean up build artifacts
47+
rm_r(Dir[prefix/"trick_source/**/object_*"])
48+
rm_r(Dir[prefix/"trick_source/**/io_src"])
49+
50+
inreplace pkgshare/"makefiles/config_user.mk" do |s|
51+
# Fix hardcoded shim compiler paths in installed config file
52+
s.gsub! "super/clang++", "clang++"
53+
s.gsub! "super/clang", "clang"
54+
s.gsub! "super/ld", "ld"
55+
s.gsub! %r{#{HOMEBREW_SHIMS_PATH}/[^/]+/}o, ""
56+
# Replace javac with homebrew openjdk javac path
57+
s.gsub! "javac", "#{Formula["openjdk"].opt_bin}/javac"
58+
end
59+
60+
# Fix HDF5 library paths to include libaec for libsz
61+
inreplace pkgshare/"makefiles/Makefile.common",
62+
"HDF5_LIB := -L$(HDF5)/lib -lhdf5_hl -lhdf5 -lsz",
63+
"HDF5_LIB := -L$(HDF5)/lib -L#{Formula["libaec"].opt_lib} -lhdf5_hl -lhdf5 -lsz"
64+
end
65+
66+
test do
67+
output = shell_output("#{bin}/trick-CP --help", 1)
68+
assert_match "Trick Configuration Processor", output
69+
end
70+
end

Formula/trick@19.rb

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
class Trick < Formula
2+
desc "Simulation development framework"
3+
homepage "https://github.com/nasa/trick"
4+
url "https://github.com/nasa/trick/archive/refs/tags/19.7.3.tar.gz"
5+
sha256 "69a0bfc4f25b7b6df7c5d2aa1a5472c35d23d8530b34eca74162f415edcae184"
6+
license "NASA-1.3"
7+
8+
depends_on "bison"
9+
depends_on "gsl"
10+
depends_on "hdf5"
11+
depends_on "libaec"
12+
depends_on "libx11"
13+
depends_on "libxt"
14+
depends_on "llvm@20"
15+
depends_on :macos
16+
depends_on "maven"
17+
depends_on "openjdk"
18+
depends_on "openmotif"
19+
depends_on "perl"
20+
depends_on "python"
21+
depends_on "swig"
22+
depends_on "udunits"
23+
depends_on "zlib"
24+
25+
uses_from_macos "flex"
26+
uses_from_macos "libxml2"
27+
28+
def install
29+
system "./configure",
30+
"--with-gsl=#{Formula["gsl"].opt_prefix}",
31+
"--with-hdf5=#{Formula["hdf5"].opt_prefix}",
32+
"--with-udunits=#{Formula["udunits"].opt_prefix}"
33+
system "make", "-j#{ENV.make_jobs}"
34+
35+
bin.install Dir["bin/*"] if File.directory?("bin")
36+
lib.install Dir["lib/*"] if File.directory?("lib")
37+
include.install Dir["include/*"] if File.directory?("include")
38+
share.install Dir["share/*"] if File.directory?("share")
39+
libexec.install Dir["libexec/*"] if File.directory?("libexec")
40+
41+
# Install trick_source/er7_utils
42+
(prefix/"trick_source").install "trick_source/er7_utils"
43+
44+
# Clean up build artifacts
45+
rm_r(Dir[prefix/"trick_source/**/object_*"])
46+
rm_r(Dir[prefix/"trick_source/**/io_src"])
47+
48+
inreplace pkgshare/"makefiles/config_user.mk" do |s|
49+
# Fix hardcoded shim compiler paths in installed config file
50+
s.gsub! "super/clang++", "clang++"
51+
s.gsub! "super/clang", "clang"
52+
s.gsub! "super/ld", "ld"
53+
s.gsub! %r{#{HOMEBREW_SHIMS_PATH}/[^/]+/}o, ""
54+
# Replace javac with homebrew openjdk javac path
55+
s.gsub! "javac", "#{Formula["openjdk"].opt_bin}/javac"
56+
end
57+
58+
# Fix HDF5 library paths to include libaec for libsz
59+
inreplace pkgshare/"makefiles/Makefile.common",
60+
"HDF5_LIB := -L$(HDF5)/lib -lhdf5_hl -lhdf5 -lsz",
61+
"HDF5_LIB := -L$(HDF5)/lib -L#{Formula["libaec"].opt_lib} -lhdf5_hl -lhdf5 -lsz"
62+
end
63+
64+
test do
65+
output = shell_output("#{bin}/trick-CP --help", 1)
66+
assert_match "Trick Configuration Processor", output
67+
end
68+
end

0 commit comments

Comments
 (0)