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

Prefer cc and c++ when using CMake on FreeBSD #139

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ jobs:
- run: bundle exec rake test:examples

fedora: # see https://github.com/flavorjones/mini_portile/issues/118
strategy:
fail-fast: false
matrix:
task: ["test:unit", "test:examples"]
runs-on: ubuntu-latest
container:
image: fedora:35
Expand All @@ -84,5 +88,30 @@ jobs:
path: examples/ports/archives
key: examples-${{ hashFiles('examples/Rakefile') }}
- run: bundle install
- run: bundle exec rake test:unit
- run: bundle exec rake test:examples
- run: bundle exec rake ${{ matrix.task }}

freebsd:
strategy:
fail-fast: false
matrix:
task: ["test:unit", "test:examples"]
runs-on: ubuntu-latest
env:
MAKE: gmake
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: examples/ports/archives
key: examples-${{ hashFiles('examples/Rakefile') }}
- uses: vmactions/freebsd-vm@v1
with:
envs: MAKE
usesh: true
copyback: false
prepare: pkg install -y ruby devel/ruby-gems pkgconf git cmake devel/gmake textproc/libyaml security/gnupg
run: |
git config --global --add safe.directory /home/runner/work/mini_portile/mini_portile
gem install bundler
bundle install
bundle exec rake ${{ matrix.task }}
3 changes: 3 additions & 0 deletions lib/mini_portile2/mini_portile_cmake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def find_c_and_cxx_compilers(host)
if MiniPortile.darwin?
c_compiler ||= 'clang'
cxx_compiler ||='clang++'
elsif MiniPortile.freebsd?
c_compiler ||= 'cc'
cxx_compiler ||= 'c++'
flavorjones marked this conversation as resolved.
Show resolved Hide resolved
else
c_compiler ||= 'gcc'
cxx_compiler ||= 'g++'
Expand Down
23 changes: 23 additions & 0 deletions test/test_cmake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,29 @@ def test_configure_defaults_with_macos
end
end

def test_configure_defaults_with_freebsd
recipe = init_recipe
recipe.host = 'some-host'

with_env({ "CC" => nil, "CXX" => nil }) do
with_stubbed_target(os: 'freebsd14') do
with_compilers(recipe, c_compiler: 'cc', cxx_compiler: 'c++') do
Open3.stub(:capture2, cmake_help_mock('Unix')) do
assert_equal(
[
"-DCMAKE_SYSTEM_NAME=FreeBSD",
"-DCMAKE_SYSTEM_PROCESSOR=x86_64",
"-DCMAKE_C_COMPILER=cc",
"-DCMAKE_CXX_COMPILER=c++",
"-DCMAKE_BUILD_TYPE=Release"
],
recipe.configure_defaults)
end
end
end
end
end

def test_configure_defaults_with_manual_system_name
recipe = init_recipe
recipe.system_name = 'Custom'
Expand Down
Loading