Skip to content
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

Merged
merged 14 commits into from
Aug 21, 2020

Conversation

SeekingMeaning
Copy link
Contributor

@SeekingMeaning SeekingMeaning commented Aug 11, 2020

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

Requires Homebrew/brew#8183
Now waiting for new brew version > 2.4.11
Can be merged as of version 2.4.12

Related:

cc @gromgit

@SeekingMeaning SeekingMeaning added do not merge CI-syntax-only Change only affects brew syntax, not the install. Only run syntax CI. labels Aug 11, 2020
@gromgit
Copy link
Contributor

gromgit commented Aug 13, 2020

LGTM. Thanks much, @SeekingMeaning!

@SeekingMeaning SeekingMeaning marked this pull request as ready for review August 17, 2020 17:06
@SeekingMeaning SeekingMeaning marked this pull request as draft August 17, 2020 17:54
@SeekingMeaning SeekingMeaning marked this pull request as ready for review August 17, 2020 18:21
@SeekingMeaning SeekingMeaning added do not merge and removed CI-syntax-only Change only affects brew syntax, not the install. Only run syntax CI. labels Aug 20, 2020
Copy link
Contributor Author

@SeekingMeaning SeekingMeaning left a 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
Copy link
Contributor Author

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}
Copy link
Contributor Author

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
Copy link
Contributor Author

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}"
Copy link
Contributor Author

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}"
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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>

@SeekingMeaning SeekingMeaning merged commit 3217bca into Homebrew:master Aug 21, 2020
@SeekingMeaning SeekingMeaning deleted the gcc/version-suffix branch August 21, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants