-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use version.major
for GCC version suffix
#59485
Changes from all commits
d1dff79
037e0c2
cf177eb
ff4e8ee
6e36a02
e08b29b
a270d8e
6e67f45
d36b3c1
f8a4b6a
10af96d
b20710d
76872eb
39e4789
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ def install | |
"--disable-doc" | ||
# Octave hardcodes its paths which causes problems on GCC minor version bumps | ||
gcc = Formula["gcc"] | ||
flibs = "-L#{gcc.lib/"gcc"/gcc.version_suffix} -lgfortran -lquadmath -lm" | ||
flibs = "-L#{gcc.lib/"gcc"/gcc.installed_version.major} -lgfortran -lquadmath -lm" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
system "make", "install", "FLIBS=#{flibs}" | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ def version_suffix | |
if build.head? | ||
"HEAD" | ||
else | ||
version.to_s.slice(/\d+/) | ||
version.major.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
end | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ def install | |
# Build dependencies in-tree, to avoid having versioned formulas | ||
resources.each { |r| r.stage(buildpath/r.name) } | ||
|
||
version_suffix = version.to_s.slice(/\d\.\d/) | ||
version_suffix = version.major_minor.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
args = [ | ||
"--build=x86_64-apple-darwin#{osmajor}", | ||
|
@@ -162,7 +162,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system bin/"gcc-4.9", "-o", "hello-c", "hello-c.c" | ||
system bin/"gcc-#{version.major_minor}", "-o", "hello-c", "hello-c.c" | ||
assert_equal "Hello, world!\n", `./hello-c` | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,7 @@ def install | |
# C, C++, ObjC and Fortran compilers are always built | ||
languages = %w[c c++ fortran objc obj-c++] | ||
|
||
version_suffix = version.to_s.slice(/\d/) | ||
version_suffix = version.major.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
# Even when suffixes are appended, the info pages conflict when | ||
# install-info is run so pretend we have an outdated makeinfo | ||
|
@@ -153,7 +153,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system bin/"gcc-5", "-o", "hello-c", "hello-c.c" | ||
system bin/"gcc-#{version.major}", "-o", "hello-c", "hello-c.c" | ||
assert_equal "Hello, world!\n", `./hello-c` | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ def install | |
# C, C++, ObjC, Fortran compilers are always built | ||
languages = %w[c c++ objc obj-c++ fortran] | ||
|
||
version_suffix = version.to_s.slice(/\d/) | ||
version_suffix = version.major.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
# Even when suffixes are appended, the info pages conflict when | ||
# install-info is run so pretend we have an outdated makeinfo | ||
|
@@ -124,7 +124,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/gcc-6", "-o", "hello-c", "hello-c.c" | ||
system "#{bin}/gcc-#{version.major}", "-o", "hello-c", "hello-c.c" | ||
assert_equal "Hello, world!\n", `./hello-c` | ||
|
||
(testpath/"hello-cc.cc").write <<~EOS | ||
|
@@ -135,7 +135,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/g++-6", "-o", "hello-cc", "hello-cc.cc" | ||
system "#{bin}/g++-#{version.major}", "-o", "hello-cc", "hello-cc.cc" | ||
assert_equal "Hello, world!\n", `./hello-cc` | ||
|
||
fixture = <<~EOS | ||
|
@@ -150,7 +150,7 @@ def add_suffix(file, suffix) | |
end | ||
EOS | ||
(testpath/"in.f90").write(fixture) | ||
system "#{bin}/gfortran-6", "-o", "test", "in.f90" | ||
system "#{bin}/gfortran-#{version.major}", "-o", "test", "in.f90" | ||
assert_equal "done", `./test`.strip | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ def install | |
# GCC will suffer build errors if forced to use a particular linker. | ||
ENV.delete "LD" | ||
|
||
version_suffix = version.to_s.slice(/\d/) | ||
version_suffix = version.major.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
# Even when suffixes are appended, the info pages conflict when | ||
# install-info is run so pretend we have an outdated makeinfo | ||
|
@@ -112,7 +112,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/gcc-7", "-o", "hello-c", "hello-c.c" | ||
system "#{bin}/gcc-#{version.major}", "-o", "hello-c", "hello-c.c" | ||
assert_equal "Hello, world!\n", `./hello-c` | ||
|
||
(testpath/"hello-cc.cc").write <<~EOS | ||
|
@@ -123,7 +123,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/g++-7", "-o", "hello-cc", "hello-cc.cc" | ||
system "#{bin}/g++-#{version.major}", "-o", "hello-cc", "hello-cc.cc" | ||
assert_equal "Hello, world!\n", `./hello-cc` | ||
|
||
(testpath/"test.f90").write <<~EOS | ||
|
@@ -137,7 +137,7 @@ def add_suffix(file, suffix) | |
write(*,"(A)") "Done" | ||
end | ||
EOS | ||
system "#{bin}/gfortran-7", "-o", "test", "test.f90" | ||
system "#{bin}/gfortran-#{version.major}", "-o", "test", "test.f90" | ||
assert_equal "Done\n", `./test` | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ def install | |
# GCC will suffer build errors if forced to use a particular linker. | ||
ENV.delete "LD" | ||
|
||
version_suffix = version.to_s.slice(/\d/) | ||
version_suffix = version.major.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
# Even when suffixes are appended, the info pages conflict when | ||
# install-info is run so pretend we have an outdated makeinfo | ||
|
@@ -115,7 +115,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/gcc-8", "-o", "hello-c", "hello-c.c" | ||
system "#{bin}/gcc-#{version.major}", "-o", "hello-c", "hello-c.c" | ||
assert_equal "Hello, world!\n", `./hello-c` | ||
|
||
(testpath/"hello-cc.cc").write <<~EOS | ||
|
@@ -126,7 +126,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/g++-8", "-o", "hello-cc", "hello-cc.cc" | ||
system "#{bin}/g++-#{version.major}", "-o", "hello-cc", "hello-cc.cc" | ||
assert_equal "Hello, world!\n", `./hello-cc` | ||
|
||
(testpath/"test.f90").write <<~EOS | ||
|
@@ -140,7 +140,7 @@ def add_suffix(file, suffix) | |
write(*,"(A)") "Done" | ||
end | ||
EOS | ||
system "#{bin}/gfortran-8", "-o", "test", "test.f90" | ||
system "#{bin}/gfortran-#{version.major}", "-o", "test", "test.f90" | ||
assert_equal "Done\n", `./test` | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ def install | |
# GCC will suffer build errors if forced to use a particular linker. | ||
ENV.delete "LD" | ||
|
||
version_suffix = version.major.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
# Even when suffixes are appended, the info pages conflict when | ||
# install-info is run so pretend we have an outdated makeinfo | ||
# to prevent their build. | ||
|
@@ -49,11 +51,11 @@ def install | |
args = %W[ | ||
--build=x86_64-apple-darwin#{osmajor} | ||
--prefix=#{prefix} | ||
--libdir=#{lib}/gcc/9 | ||
--libdir=#{lib}/gcc/#{version_suffix} | ||
--disable-nls | ||
--enable-checking=release | ||
--enable-languages=#{languages.join(",")} | ||
--program-suffix=-9 | ||
--program-suffix=-#{version_suffix} | ||
--with-gmp=#{Formula["gmp"].opt_prefix} | ||
--with-mpfr=#{Formula["mpfr"].opt_prefix} | ||
--with-mpc=#{Formula["libmpc"].opt_prefix} | ||
|
@@ -78,7 +80,7 @@ def install | |
|
||
# Ensure correct install names when linking against libgcc_s; | ||
# see discussion in https://github.com/Homebrew/legacy-homebrew/pull/34303 | ||
inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/9" | ||
inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/#{version_suffix}" | ||
|
||
mkdir "build" do | ||
system "../configure", *args | ||
|
@@ -93,7 +95,7 @@ def install | |
# Handle conflicts between GCC formulae and avoid interfering | ||
# with system compilers. | ||
# Rename man7. | ||
Dir.glob(man7/"*.7") { |file| add_suffix file, "9" } | ||
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix } | ||
# Even when we disable building info pages some are still installed. | ||
info.rmtree | ||
end | ||
|
@@ -114,7 +116,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/gcc-9", "-o", "hello-c", "hello-c.c" | ||
system "#{bin}/gcc-#{version.major}", "-o", "hello-c", "hello-c.c" | ||
assert_equal "Hello, world!\n", `./hello-c` | ||
|
||
(testpath/"hello-cc.cc").write <<~EOS | ||
|
@@ -125,7 +127,7 @@ def add_suffix(file, suffix) | |
return 0; | ||
} | ||
EOS | ||
system "#{bin}/g++-9", "-o", "hello-cc", "hello-cc.cc" | ||
system "#{bin}/g++-#{version.major}", "-o", "hello-cc", "hello-cc.cc" | ||
assert_equal "Hello, world!\n", `./hello-cc` | ||
|
||
(testpath/"test.f90").write <<~EOS | ||
|
@@ -139,7 +141,7 @@ def add_suffix(file, suffix) | |
write(*,"(A)") "Done" | ||
end | ||
EOS | ||
system "#{bin}/gfortran-9", "-o", "test", "test.f90" | ||
system "#{bin}/gfortran-#{version.major}", "-o", "test", "test.f90" | ||
assert_equal "Done\n", `./test` | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ def install | |
"/usr/bin/ld" | ||
|
||
args = std_cmake_args + %W[ | ||
-DCMAKE_C_COMPILER=gcc-#{Formula["gcc"].version_suffix} | ||
-DCMAKE_CXX_COMPILER=g++-#{Formula["gcc"].version_suffix} | ||
-DCMAKE_C_COMPILER=gcc-#{Formula["gcc"].installed_version.major} | ||
-DCMAKE_CXX_COMPILER=g++-#{Formula["gcc"].installed_version.major} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
] | ||
|
||
mkdir "build" do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ def install | |
ENV.deparallelize | ||
|
||
# imake runtime is broken when used with clang's cpp | ||
cpp_program = Formula["gcc"].opt_bin/"cpp-#{Formula["gcc"].version_suffix}" | ||
cpp_program = Formula["gcc"].opt_bin/"cpp-#{Formula["gcc"].installed_version.major}" | ||
inreplace "imakemdep.h", /::CPPCMD::/, cpp_program | ||
inreplace "imake.man", /__cpp__/, cpp_program | ||
|
||
|
@@ -52,7 +52,7 @@ def install | |
test do | ||
# Use pipe_output because the return code is unimportant here. | ||
output = pipe_output("#{bin}/imake -v -s/dev/null -f/dev/null -T/dev/null 2>&1") | ||
gcc_major_ver = Formula["gcc"].version_suffix | ||
gcc_major_ver = Formula["gcc"].installed_version.major | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
assert_match "#{Formula["gcc"].opt_bin}/cpp-#{gcc_major_ver}", output | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,8 @@ class Kahip < Formula | |
depends_on "open-mpi" | ||
|
||
def install | ||
ENV["CC"] = Formula["gcc"].opt_bin/"gcc-#{Formula["gcc"].version_suffix}" | ||
ENV["CXX"] = Formula["gcc"].opt_bin/"g++-#{Formula["gcc"].version_suffix}" | ||
ENV["CC"] = Formula["gcc"].opt_bin/"gcc-#{Formula["gcc"].installed_version.major}" | ||
ENV["CXX"] = Formula["gcc"].opt_bin/"g++-#{Formula["gcc"].installed_version.major}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
mkdir "build" do | ||
system "cmake", *std_cmake_args, ".." | ||
system "make", "install" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,8 +55,8 @@ def install | |
end | ||
|
||
test do | ||
gcc = Formula["gcc"].opt_bin/"gcc-#{Formula["gcc"].version_suffix}" | ||
gcov = Formula["gcc"].opt_bin/"gcov-#{Formula["gcc"].version_suffix}" | ||
gcc = Formula["gcc"].opt_bin/"gcc-#{Formula["gcc"].installed_version.major}" | ||
gcov = Formula["gcc"].opt_bin/"gcov-#{Formula["gcc"].installed_version.major}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
(testpath/"hello.c").write <<~EOS | ||
#include <stdio.h> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ def install | |
venv.pip_install buildpath | ||
|
||
gcc_path = Formula["gcc"].opt_bin | ||
gcc_version = Formula["gcc"].version.to_s.split(".").first | ||
gcc_version = Formula["gcc"].installed_version.major | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
(bin/"pipgrip").write_env_script(libexec/"bin/pipgrip", | ||
{ CC: gcc_path/"gcc-#{gcc_version}", CXX: gcc_path/"g++-#{gcc_version}" }) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.