-
-
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
Use version.major
for GCC version suffix
#59485
Conversation
LGTM. Thanks much, @SeekingMeaning! |
7ad2b75
to
39e4789
Compare
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.
irb(main):001:0> gcc = Formula["gcc"]
@@ -40,7 +40,7 @@ def install | |||
# to upstream in 2016 (see https://github.com/nextgenusfs/funannotate/issues/3). | |||
# See also https://github.com/Gaius-Augustus/Augustus/issues/64 | |||
cd "src" do | |||
with_env("HOMEBREW_CC" => Formula["gcc"].opt_bin/"gcc-#{Formula["gcc"].linked_version.to_s.slice(/\d+/)}") do | |||
with_env("HOMEBREW_CC" => Formula["gcc"].opt_bin/"gcc-#{Formula["gcc"].installed_version.major}") do |
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.
irb(main):003:0> gcc.linked_version.to_s.slice(/\d+/)
=> "10"
irb(main):004:0> gcc.installed_version.major
=> #<Version::NumericToken 10>
-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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):006:0> gcc.version_suffix
=> "10"
irb(main):007:0> gcc.installed_version.major
=> #<Version::NumericToken 10>
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):006:0> gcc.version_suffix
=> "10"
irb(main):007:0> gcc.installed_version.major
=> #<Version::NumericToken 10>
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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):006:0> gcc.version_suffix
=> "10"
irb(main):007:0> gcc.installed_version.major
=> #<Version::NumericToken 10>
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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):006:0> gcc.version_suffix
=> "10"
irb(main):007:0> gcc.installed_version.major
=> #<Version::NumericToken 10>
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):016:0> Formula["gcc@5"].version.to_s.slice(/\d/)
=> "5"
irb(main):017:0> Formula["gcc@5"].version.major.to_s
=> "5"
irb(main):018:0> Formula["gcc@5"].version.major
=> #<Version::NumericToken 5>
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):020:0> Formula["gcc@6"].version.to_s.slice(/\d/)
=> "6"
irb(main):021:0> Formula["gcc@6"].version.major.to_s
=> "6"
irb(main):022:0> Formula["gcc@6"].version.major
=> #<Version::NumericToken 6>
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):024:0> Formula["gcc@7"].version.to_s.slice(/\d/)
=> "7"
irb(main):025:0> Formula["gcc@7"].version.major.to_s
=> "7"
irb(main):026:0> Formula["gcc@7"].version.major
=> #<Version::NumericToken 7>
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):028:0> Formula["gcc@8"].version.to_s.slice(/\d/)
=> "8"
irb(main):029:0> Formula["gcc@8"].version.major.to_s
=> "8"
irb(main):030:0> Formula["gcc@8"].version.major
=> #<Version::NumericToken 8>
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
irb(main):032:0> Formula["gcc@9"].version.major.to_s
=> "9"
irb(main):033:0> Formula["gcc@9"].version.major
=> #<Version::NumericToken 9>
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?Requires Homebrew/brew#8183Now waiting for newbrew
version > 2.4.11Can be merged as of version 2.4.12
Related:
version_suffix
#58558 - Fixversion_suffix
cc @gromgit