Skip to content

Commit

Permalink
Merge pull request #196044 from Homebrew/ampl-mp-rpath
Browse files Browse the repository at this point in the history
ampl-mp: remove change_install_name, update cmake build
  • Loading branch information
BrewTestBot authored Oct 31, 2024
2 parents a4f780a + 5ec3b4b commit 95e11f6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 42 deletions.
63 changes: 31 additions & 32 deletions Formula/a/ampl-mp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ class AmplMp < Formula
end

bottle do
sha256 cellar: :any, arm64_sequoia: "a54c96171166e097c5ca01df439f990b477c55ed19d197a1f112f1373e0d6465"
sha256 cellar: :any, arm64_sonoma: "d73bc6d66f6b77daf6ba643fade064b9bf281196d136a5d36832a4dc74ad95d1"
sha256 cellar: :any, arm64_ventura: "0a6ec6b35631a0156e62ed56554b734b7d621ce0933784cf154d09c9d6419a30"
sha256 cellar: :any, arm64_monterey: "27fdafce7e558441048fe2107a783304a5ebb275fdb1c435f0f30a6135d3bbf5"
sha256 cellar: :any, arm64_big_sur: "5a666c8f40e7d66e6c065e21abada4c2fbfc5917fed422beb6c14b357e0e41b2"
sha256 cellar: :any, sonoma: "72186beab07bf364fce83862f7e0e131b14b27db29d934a50c311d7c13d9821e"
sha256 cellar: :any, ventura: "7f1af712490a2a051c72196a15a17061184b1f0c0c2f29852455fb68c5895a6c"
sha256 cellar: :any, monterey: "c2323285b97b8a697e564fc444fd3dd4424cb3d6a1ea6e8e336735eee5e3ac5f"
sha256 cellar: :any, big_sur: "512e10d2061408b42b14b9834bdb4f4ad85f859c578ebab99efda98d3f6f4957"
sha256 cellar: :any, catalina: "c111c501330b3ff8e3bde1a7e679f162bea1038df07de96810ea5cbe34775740"
sha256 cellar: :any, mojave: "bf329d7a40c3a21cb745d9d86bc0cf4add18397aedd6b36eb8e27feab822f1e3"
sha256 cellar: :any, high_sierra: "835aea5e86e3780681cb38ebe0f0dcd522ed21f80ed4711ad10e66b6c0814d03"
sha256 cellar: :any_skip_relocation, x86_64_linux: "4efb0ad66f2cd0930a0f5f50edf249ac4c8f436f34b5b8cf95b90199d1d5d3e9"
rebuild 1
sha256 cellar: :any, arm64_sequoia: "d02c9a51954b17ab0a6caa31093daa7be212239b957d2224b773aaaa19b89c59"
sha256 cellar: :any, arm64_sonoma: "02f9efaecf470dffc6bff5b71530d0245b342f0e3805f73a5741b15a175e348a"
sha256 cellar: :any, arm64_ventura: "cf8589ed55bdfa5612fe9f4efc698eed1000e332446900798b1d4ebcd9f4e77e"
sha256 cellar: :any, sonoma: "fdf52601bd4c9990a80d1a14600d7c8649f2597bf4af38c966f9f806835eff44"
sha256 cellar: :any, ventura: "48756d110b0bac36eec0f33e181ad12f68632cb3087ccebb8451ef1d31798294"
sha256 cellar: :any_skip_relocation, x86_64_linux: "14117080e712ec6bcfd79084440b9264783a4567b9f31368bf8fa7109d718f58"
end

depends_on "cmake" => :build
Expand All @@ -41,31 +35,36 @@ class AmplMp < Formula
sha256 "1a4ef4cd1f4e8b959c20518f8f00994ef577e74e05824b2d1b241b1c3c1f84eb"
end

def install
system "cmake", ".", *std_cmake_args, "-DBUILD_SHARED_LIBS=True"
system "make", "all"
if OS.mac?
MachO::Tools.change_install_name("bin/libasl.dylib", "@rpath/libmp.3.dylib",
"#{opt_lib}/libmp.dylib")
end
system "make", "install"
# Install missing header files, remove in > 3.1.0
# https://github.com/ampl/mp/issues/110
patch do
url "https://github.com/ampl/mp/commit/8183be3e486d38d281e0c5a02a1ea4239695035e.patch?full_index=1"
sha256 "6b37201f1d0d6dba591e7e1b81fb16d2694d118605c92c422dcdaaedb463c367"
end

# Shared modules are installed in bin
mkdir_p libexec/"bin"
mv Dir[bin/"*.dll"], libexec/"bin"
# Backport fmt header update. Remove in the next release
# https://github.com/ampl/mp/issues/108
patch do
url "https://github.com/ampl/mp/commit/1f39801af085656e4bf72250356a3a70d5d98e73.patch?full_index=1"
sha256 "b0e0185f24caba54cb38b65a638ebda6eb4db3e8c74d71ca79f072b8337e8e2c"
end

# Install missing header files, remove in > 3.1.0
# https://github.com/ampl/mp/issues/110
%w[errchk.h jac2dim.h obj_adj.h].each { |h| cp "src/asl/solvers/#{h}", include/"asl" }
def install
system "cmake", "-S", ".", "-B", "build",
"-DAMPL_LIBRARY_DIR=#{libexec}/bin",
"-DBUILD_SHARED_LIBS=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath};#{rpath(source: libexec/"bin")}",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
resource("miniampl").stage do
(pkgshare/"example").install "src/miniampl.c", Dir["examples/wb.*"]
testpath.install "src/miniampl.c", Dir["examples/wb.*"]
end
end

test do
system ENV.cc, pkgshare/"example/miniampl.c", "-std=c99", "-I#{include}/asl", "-L#{lib}", "-lasl", "-lmp"
cp Dir[pkgshare/"example/wb.*"], testpath
system ENV.cc, "miniampl.c", "-std=c99", "-I#{include}/asl", "-L#{lib}", "-lasl", "-lmp"
output = shell_output("./a.out wb showname=1 showgrad=1")
assert_match "Objective name: objective", output
end
Expand Down
27 changes: 17 additions & 10 deletions Formula/i/ipopt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ class Ipopt < Formula
head "https://github.com/coin-or/Ipopt.git", branch: "stable/3.14"

bottle do
sha256 cellar: :any, arm64_sequoia: "009c5caaad3fe3b204c0428bbb99037ee7c814ea2c908566721215099983420c"
sha256 cellar: :any, arm64_sonoma: "7ab15709c6d8d0911bac33f38b65f047766108a3b291b8f00a6ce765e9db0fc3"
sha256 cellar: :any, arm64_ventura: "f7ee0132a291e546eb7e0cf1be44b4a453896a96af88ce091e9e622b9def7914"
sha256 cellar: :any, arm64_monterey: "2b8567b6ed6a773a7c5e1506d6dd0c7928d985a1f105907eceabe00dc43f4fe1"
sha256 cellar: :any, sonoma: "16cd7b2d2c01d59f4882ba61649da6c9c1f90ce08e3fae3cc3b26eae9016afc6"
sha256 cellar: :any, ventura: "9d25a0a32684759aed13bb1dd854437d9f4a21b02531652aa7af202bc2eec8c7"
sha256 cellar: :any, monterey: "a6523b45e35985d5e080eed53398ad47ef7c7a3d4bb0b0cc78c2c5620fdade11"
sha256 cellar: :any_skip_relocation, x86_64_linux: "6b3807673210056f3d94d69ca81ec6321b80376c48de6015b93b29692ab5d409"
rebuild 1
sha256 cellar: :any, arm64_sequoia: "f27c151e814d4c9a0caeb33bb0a584c5d885121ec6a70a0586b330b8485779fa"
sha256 cellar: :any, arm64_sonoma: "9a7c783b3ccd11860b615afc874ead0f60700a7f97dde4d5752a4444778aa86d"
sha256 cellar: :any, arm64_ventura: "5e623167a75d4f3516f6e2b50c61578bd3222f18c63abb7d5483c95dd2a0c53b"
sha256 cellar: :any, sonoma: "fb86b1e3c17ed6cfb6b44bf1fcaca4a989a62335b364baa36490b4f0003675b8"
sha256 cellar: :any, ventura: "467af1d0edd4ee1beb1ef2496bf277992988c8599b3082467f5be3d6891cd85b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "6e2c7ebb501bd2b73e5c847f1f5e82dcedfd3a9528de22c6848e9393cedaede6"
end

depends_on "openjdk" => :build
Expand Down Expand Up @@ -48,6 +47,11 @@ class Ipopt < Formula
sha256 "cc8c217991240db7eb14189eee0dff88f20a89bac11958b48625fa512fe8d104"
end

resource "miniampl" do
url "https://github.com/dpo/miniampl/archive/refs/tags/v1.0.tar.gz"
sha256 "b836dbf1208426f4bd93d6d79d632c6f5619054279ac33453825e036a915c675"
end

def install
ENV.delete("MPICC")
ENV.delete("MPICXX")
Expand Down Expand Up @@ -93,9 +97,12 @@ def install

test do
testpath.install resource("test")
pkg_config_flags = `pkg-config --cflags --libs ipopt`.chomp.split
pkg_config_flags = shell_output("pkg-config --cflags --libs ipopt").chomp.split
system ENV.cxx, "examples/hs071_cpp/hs071_main.cpp", "examples/hs071_cpp/hs071_nlp.cpp", *pkg_config_flags
system "./a.out"
system bin/"ipopt", "#{Formula["ampl-mp"].opt_pkgshare}/example/wb"

resource("miniampl").stage do
system bin/"ipopt", "examples/wb"
end
end
end

0 comments on commit 95e11f6

Please sign in to comment.