2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-28 08:43:26 +00:00
Commit graph

544 commits

Author SHA1 Message Date
Attila Oláh b1600aa05a
Update GMP to 6.2.1. Fixes #462. (#463)
Version 6.2.0 is gone from gmplib.org.

Also update extension to `.xz`, apparently `.gz` files are no longer
being distributed.
2021-01-23 15:08:17 +00:00
Jesse Chan 75e74567c7
toolchain_mappings: remove unnecessary arch constraints (#456)
This change allows rules_foreign_cc to work on architectures other
than x86_64.

Bug: bazelbuild/bazel#11628
Test: manual. no longer fails with "ln: illegal option -- t" on darwin_arm64
2021-01-22 19:24:31 +00:00
Lauri Peltonen 57500442a6
Support --incompatible_enable_cc_toolchain_resolution (#336)
Resolve CcToolchainInfo as instructed at
https://docs.bazel.build/versions/master/integrating-with-rules-cc.html#accessing-the-c-toolchain

This allows rules_foreign_cc to be used with --incompatible_enable_cc_toolchain_resolution.
2021-01-22 16:55:05 +00:00
UebelAndre 2dbd5fc2c2
Moved documenting comments into doc fields (#460)
* Moved documentation comments to `doc` fields

* Updated docs example
2021-01-22 14:32:28 +00:00
UebelAndre fafbef3eca
Added bzl_libraries for stardoc support (#453)
There's now a top level bzl_library @rules_foreign_cc//:bzl_srcs that contain the .bzl sources for the build rules defined in this repo.

Stardoc support was also added to ensure the bzl_library structure is correct and usable outside of the repo. In addition to this, new documentation can be generated by running bazel run //docs:generate_docs from the root of rules_foreign_cc/examples to output @rules_foreign_cc_tests//docs:README.md.
2021-01-22 14:25:49 +00:00
James Sharpe 30912b9982
Buildifier formatting (#459) 2021-01-22 06:17:24 -08:00
Benjamin Peterson d54c78ab86
Migrate to modern linking input API. (#434)
* Migrate to modern linking input API.

See https://github.com/bazelbuild/bazel/issues/10860.

* Bump required Bazel version.
2020-10-26 15:26:01 +01:00
Attila Oláh ed95b95aff
Update CMake, Ninja and bazel_skylib to the latest stable versions. (#425) 2020-09-11 09:07:39 +02:00
Attila Oláh ea571fcdd1
Add a GNU Make toolchain (#379)
* Use `.format()` instead of `%` for constructing `make_commands`.

I'm about to add a third substitution parameter to these lines, and it's
already getting a bit crowded. This is a no-op change, but should make
the follow-up commits more readable.

* Add `make_toolchain` toolchain type.

Add a toolchain that implements it using the pre-installed system
`make`. Make use of this toolchain in the `make()` rule.

* Use the `make` toolchain in configure and cmake scripts as well.

This allows the registered `make` toolchain to be used not just in make,
but also in cmake and configure_make targets. As a result, one can
either ship their own `make`, built for the execution environment, or
use a custom `make`, e.g. one that calls `emmake make`.

To make this backwards compatible with `make_commands`, the substitution
will only replace the leading word `make` from any line in
`make_commands`. Thus, existing rules that specify a `make_commands`
attribute that refers to the binary simply as `make` should still work
with any toolchain implementation that provides the binary.

* Update `README.md`.

Describe the new toolchain type.

* Add `BootstrapMake` to bootstrap a `make` toolchain.

This allows the `make` toolchain to be used even without GNU Make being
pre-installed on the system.

* Add example Gnu Make boostrap target.

Test manually using:

```
$ cd examples
$ bazel build //build_make_itself:maketool
```
2020-09-07 10:48:26 +02:00
Filippo Brizzi 594bf4d773
Cmake enable network (#385)
If the tag requires-network is present, it allows the run_shell command to access the network.

Fixes #346.
2020-08-21 14:41:30 +02:00
Emanuel Taube d2698df7df Configure tools_deps for host 2020-08-21 13:53:16 +02:00
Philip Shao b3caa87950 Fix extension-stripping logic.
Trivial manual test case:
   libpython3.8.a <-> libpython3.8m.a

Existing logic erroneously reports collision on "libpython3" token.
2020-08-21 13:52:49 +02:00
Andy Yankovsky 3cfd45d5d4 Fix typo 2020-08-21 13:51:58 +02:00
c-parsons 9eb30f8c5a
Update mpfr to 4.1.0 (#420)
mpfr no longer supports 4.0.2 on the official site, so BazelCI was failing.
2020-07-13 16:41:03 +02:00
irengrig f54b7ae56d
Add "#!/usr/bin/env bash" prefix to the scripts (#410) 2020-06-09 17:39:51 +02:00
Attila Oláh d838bc5506
Update ninja to 1.10.0. (#382)
Co-authored-by: irengrig <ichern@google.com>
2020-06-08 22:13:18 +02:00
Attila Oláh 04c04fe7d2
Update CMake version (#381)
* Add SHA256 sum for CMake to make the build reproducible.

* Update `cmake` to 3.17.2.

Co-authored-by: irengrig <ichern@google.com>
2020-06-08 21:48:25 +02:00
Ilya Dmitrichenko d02a56d0c3
Handle case where LDFLAGS is undefined (#407)
Co-authored-by: irengrig <ichern@google.com>
2020-06-08 19:05:29 +02:00
Justin King aeb5a4e35d
Support running autogen.sh and autoreconf (#403)
Co-authored-by: Justin King <jcking@google.com>
2020-06-08 19:01:21 +02:00
irengrig 74b146dc87
Fix shell function symlink_contents_to_dir, add test (#377)
Fix shell function symlink_contents_to_dir, add test

- test for the case when we symlink the contents of two directories with the same inner directories (include)
- the test data of the test for shell script helper also changes, as it uses the real shell toolchain implementation text
- Fixes the issue from #330
2020-05-08 11:43:40 +02:00
irengrig c86401f4ea
Use preinstalled CMake in tests on Mac OS (#399)
(merging without review because it only changes how the tests are run)
2020-05-07 20:38:21 +02:00
Laurent Le Brun c292369597
Fix Buildifier warnings (#395)
* Run buildifier formatter

* Fix buildifier warnings

Ran: `buildifier --lint=fix -r .`
2020-05-04 19:50:45 +02:00
irengrig 3515b20a24
Fix shell_script_helper.bzl to replace function calls inside function… (#375)
Fix shell_script_helper.bzl to replace function calls inside function texts.

Add test for shell_script_helper.bzl.
In particular, this fixes the case when some of the shell toolchain functions calls other shell toolchain functions (symlink_contents_to_dir and symlink_to_dir).
2020-04-30 11:24:25 +02:00
irengrig 2ca2de6752
Test for detect_root function and example of usage (#373) 2020-04-30 11:17:48 +02:00
oquenchil c1196c29ad
Update codeowners (#394)
Adding @oquenchil
2020-04-30 09:58:00 +02:00
irengrig 8372f383cf
Allow to specify working directory for cmake_external (#390)
Allow to specify working directory for cmake_external
For LLVM case, when main CMakeLists.txt is in the /llvm subdirectory in the source tree

Co-authored-by: Andy Yankovsky <weratt@gmail.com>
2020-04-24 09:16:21 +02:00
irengrig 4564255219
Update skylib to 1.2 (#374) 2020-03-05 16:07:19 +01:00
irengrig 8b477ca9cb
Fix Visual Studio version used in examples for #368 (#370) 2020-02-13 10:26:42 +01:00
bcsgh bafdc9d274
Add some newlines to make the logging print correctly (#364) 2020-02-12 21:56:00 +01:00
Simon Newton ed3db61a55 Fix the simple_make example so that it works on Mac & Linux (#339)
Fix the simple_make example so that it works on Mac and Debian and add it to Mac tests.
2019-11-26 19:13:54 +01:00
Philipp Wollermann 14b79e5a04 Mirror all http_archives. (#341)
Context: https://github.com/bazelbuild/bazel/issues/10270
2019-11-19 14:50:33 +01:00
irengrig 6bb0536452
Remove experimental disclaimer. Fixes #307. (#316) 2019-10-23 16:06:34 +02:00
irengrig 10daf29cae
For consuming Bazel-built targets as dependencies, do not use quote_includes from CcInfo, as they are not used for anything related to the particular library, but contain references to the gendir and bin directories, which seems hardly useful. (We expect Bazel targets to describe their include directories and headers explicitly). (#322)
Rules_foreign_cc also currently is not using CcInfo.quote_includes.
Having them leads to symlinking directory trees without any reason.
Tests: we already have tests for transitive Bazel dependencies (//cmake_synthetic:test_bazel_transitive_deps, //cmake_with_bazel_transitive:test, //configure_with_bazel_transitive:test)
2019-10-23 16:00:39 +02:00
irengrig c7fe8ce542
Lua example (#291)
Add an example for building https://github.com/LuaJIT/LuaJIT
2019-10-23 12:17:16 +02:00
Dig-Doug 83e79ef83b Prefixes bazel_version so that it doesn't conflict with other libraries. (#328) 2019-10-23 11:40:33 +02:00
irengrig e6ca4d2cd1
Fix permission problem with replacing absolute path with sed, #306 (#324)
* Fix permission problem with replacing absolute path with sed, #306

- we can not modify files under Bazel's output directory
- so we can not modify pkg_config files, written there, for instance
- solution: only replace absolute paths in the files being created by the current target,
using the environment variable as the replacement value ($EXT_BUILD_DEPS)

* Wrap environment variable in ${} in replace string
2019-10-02 10:49:37 +01:00
Niklas Salmoukas 14a9f35611 Improve cygwin compatibility (#323) 2019-09-27 06:39:11 -04:00
irengrig 7bc4be735b
When executed without sandbox, target- and host- configured targets are created in the same execution root with the same names. (#321)
Apparently, it is not the problem for build outputs, but deps directory that is created by script.
What is even more problematic is that this directory can be accessed while building this target in parallel for different configurations. So even if we clean it before using, we might break the build of the parallel target.

Solution: create temp directory to be used as deps directory.
(Additionally, this demonstrates the benefits of sandboxed execution.)
2019-09-26 13:28:21 -04:00
irengrig 16ddc00bd4
Be resilient with Bazel-built transitive dependencies duplicates (#318)
Be resilient with Bazel-built transitive dependencies duplicates

- it is possible that some duplicate libraries, built with Bazel, will be passed as inputs to cmake_external or configure_make. rules_foreign_cc should filter duplicates out rather then fail.
- add a test (which just builds the target) //cmake_synthetic:lib_with_duplicate_transitive_bazel_deps
2019-09-17 14:34:20 -04:00
irengrig 2565832da9
Fix make() rule to run make commands sequentially and not in parallel. (#317)
Fixes #313.
2019-09-16 13:43:41 -04:00
irengrig 6ad84f7739
Adapt rules_foreign_cc for working with libtool instead of ar. (#315)
Adapt rules_foreign_cc for working with libtool instead of ar.

- for CMake, pass "<TARGET>" as the output file when forming linker flags with cc_common. CMake will later replace <TARGET> with the actual output file. Fill CMAKE_C_CREATE_ARCHIVE and CMAKE_CXX_CREATE_ARCHIVE CMake variables with 'CMAKE_AR %Bazel-link-flags% <OBJECTS>' call, where CMAKE_AR will take the path to libtool.
Related documentation: https://cmake.org/cmake/help/v3.15/variable/CMAKE_LANG_ARCHIVE_CREATE.html?highlight=cmake_%20lang%20_archive_create

- for configure_make, for the libevent example, we need to skip specifying the libtool from Bazel's toolchain as a linker, because libevent script uses it's own libtool and manages to pass the output file to it, but not to the libtool we are passing. Let it do so as it is a customized script.
Do it with specifying empty string for the $AR environment variable.
Other examples with configure_make work fine.

This fixes https://github.com/bazelbuild/bazel/issues/9258
2019-09-09 18:20:42 +02:00
Sahn Lam c3d5405cbc Add -H to find in symlink_contents_to_dir (#303)
This fixes #302
2019-08-07 10:55:52 +02:00
Keith Smiley adb04eed2c Build Android example on CI (#286)
* Build Android example on CI

Currently there aren't any actual test targets for the NDK example, but
building it is still useful to verify.

* Remove from windows
2019-08-06 14:35:02 +02:00
irengrig a209b642c7
Remove unnecessary restrictions on the library filename - fixes #276 (#294)
* Remove unnecessary restrictions on the library filename - fixes #276

* Fix review comments, remove unnecessary parameter
2019-07-17 14:05:03 +02:00
irengrig 30f398dc40
Fix a way of wiping CMake cache entry values defined by toolchain fro… (#293)
* Fix a way of wiping CMake cache entry values defined by toolchain from a command line, in case user specified empty values for these cache entries explicitly in cmake_external target

- it was a problem that we did not check that there was some value in the "toolchain" dict before we pop() - reported in comment in #292
- make code which does wiping empty values more explicit

* Additionally, if non-empty value for CMAKE_RANLIB was not specified by user or Bazel toolchain, put empty value for it to forbid CMake to auto detect it

context: https://github.com/bazelbuild/rules_foreign_cc/issues/252

* Add test for user's redefined value for CMAKE_BUILD_TYPE
2019-07-17 13:51:21 +02:00
Sahn Lam 64e2cda959 Add -L to cp (#266)
This fixes #265. See the issue for details.
2019-07-10 18:54:49 +02:00
Keith Smiley ec8400cbd0 Switch to rules_jvm_external (#287)
The previous gmaven_rules usage was broken, this is the new supported
way to download these dependencies.
2019-07-10 18:44:57 +02:00
irengrig 540253c265
Implement support for "pure" GNU Make in make.bzl (#285)
* Implement support for "pure" GNU Make in make.bzl

Usage: load("@rules_foreign_cc//tools/build_defs:make.bzl", "make")
make(name = <name>, lib_source = <source>), please see more arguments
in make.bzl

Add test in examples/simple_make (runs only on Linux because of Makefile contents)
2019-07-10 18:05:24 +02:00
Keith Smiley e8dece6e76 Add examples' bazel symlinks to gitignore (#288) 2019-07-10 17:55:36 +02:00
Michal Rostecki 8ccd83504b Minor fixes in example files (#264)
* examples: cmake_crosstool: Remove executable bit from BUILD

There is no reason for BUILD file to be an executable.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>

* examples: Add shebang to the bash script

print_bazel_version.sh is a bash script, but it did not contain a
shebang.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
2019-06-25 18:38:25 +02:00