-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
rake gem
download source tarballs automatically
Previously `scripts/test-gem-build` would call `rake compile` just to make mini_portile2 download the source tarballs. However, this needlessly compiles abseil and libre2 before building the gem. To improve this, split the loading of the recipes into a separate file (`ext/re2/recipes.rb`). The `rake prepare` step invokes the `download` method to download the required tarballs in preparation for building the gem. Now we add a `rake prepare` task that will run if `rake gem` is run.
- Loading branch information
Showing
5 changed files
with
88 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
PACKAGE_ROOT_DIR = File.expand_path('../..', __dir__) | ||
REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.4' # keep this version in sync with the one in the gemspec | ||
|
||
def build_recipe(name, version) | ||
require 'rubygems' | ||
gem('mini_portile2', REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time | ||
require 'mini_portile2' | ||
|
||
MiniPortileCMake.new(name, version).tap do |recipe| | ||
recipe.target = File.join(PACKAGE_ROOT_DIR, 'ports') | ||
recipe.configure_options += [ | ||
# abseil needs a C++14 compiler | ||
'-DCMAKE_CXX_STANDARD=17', | ||
# needed for building the C extension shared library with -fPIC | ||
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON', | ||
# ensures pkg-config and installed libraries will be in lib, not lib64 | ||
'-DCMAKE_INSTALL_LIBDIR=lib' | ||
] | ||
|
||
yield recipe | ||
end | ||
end | ||
|
||
def load_recipes | ||
require 'yaml' | ||
dependencies = YAML.load_file(File.join(PACKAGE_ROOT_DIR, 'dependencies.yml')) | ||
|
||
abseil_recipe = build_recipe('abseil', dependencies['abseil']['version']) do |recipe| | ||
recipe.files = [{ | ||
url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/#{recipe.version}.tar.gz", | ||
sha256: dependencies['abseil']['sha256'] | ||
}] | ||
end | ||
|
||
re2_recipe = build_recipe('libre2', dependencies['libre2']['version']) do |recipe| | ||
recipe.files = [{ | ||
url: "https://github.com/google/re2/releases/download/#{recipe.version}/re2-#{recipe.version}.tar.gz", | ||
sha256: dependencies['libre2']['sha256'] | ||
}] | ||
end | ||
|
||
[abseil_recipe, re2_recipe] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters