Commit Graph

468 Commits

Author SHA1 Message Date
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
irengrig 0b8356f199
Fix replace_in_files function in windows_commands.bzl (#280)
* Fix replace_in_files function in windows_commands.bzl

Filter files by types, where the absolute paths need to be replaced.

* Add one more hello world example

* Include test into windows list, remove from Mac OS list
2019-06-25 18:31:21 +02:00
Justin Buchanan d084070466 fix(cmake): Use "Debug" and "Release" instead of "DEBUG" and "RELEASE" (#277)
* fix(cmake): Use "Debug" and "Release" instead of "DEBUG" and "RELEASE"

These values are case-sensitive in cmake and give this error currently:

```
CMake Error at CMakeLists.txt:23 (message):
  CMAKE_BUILD_TYPE must be one of: Debug, Release (current value: 'RELEASE')
```

* update test data
2019-06-21 10:40:01 +02:00
irengrig dea1437d92
Fix #123 Improve code readability for collecting input dependencies (#257)
* Fix #123 Improve code readability for collecting input dependencies

* Fix line endings
2019-06-19 15:50:58 +02:00
Yun Peng 0f0c0da3a1 Fix patch file for nghttp2 (#275)
The line number doesn't match the exact location of the position of the content. This is tolerable with patch command line tool, but it won't work with a more strict patch implementation.
Context: https://github.com/bazelbuild/bazel/pulls
2019-06-06 13:25:46 +02:00
irengrig a0dc109915
Fix the code to work with Bazel HEAD: (#274)
Fix the code to work with Bazel HEAD:

- convert depset to list for iteration (libraries to link)
- _build_tools() are just creating the file, not contributing anything to the text of constructed BUILD file, so make a call to this method separately.
2019-06-04 11:11:46 +02:00
Marcel Hlopko 6b2f454a41 Use forward compatible version of _configure_features (#271)
This PR fixes the bug introduced in https://github.com/bazelbuild/rules_foreign_cc/pull/270.

hlopko@ should not be allowed to code undercaffeinated.
2019-05-28 10:55:13 +02:00
Laurent Le Brun 3990f265ee Migrate for --incompatible_depset_is_not_iterable (#267) 2019-05-28 10:47:28 +02:00
Marcel Hlopko 604f1e1c9f Guard cc_common.configure_features with a version check (#270)
This PR adds @bazel_version repository which contains single def.bzl
file which contains a BAZEL_VERSION constant that can be used to perform
conditional logic bazed on the Bazel version.

As a result, rules_foreing_cc are now compatible with Bazel 0.24 - 0.27
(at least regarding configure_features :)
2019-05-28 10:31:58 +02:00
László Csomor 9cfeff53b5 Windows: tests now work with native test wrapper (#263)
Windows: tests now work with native test wrapper

See https://github.com/bazelbuild/bazel/issues/6622
2019-05-17 11:52:28 +02:00
Marcel Hlopko 50e2679dee Migrate for --incompatible_enable_cc_toolchain_resolution (#262)
https://github.com/bazelbuild/bazel/issues/7260
2019-05-15 14:43:13 +02:00
Marcel Hlopko 9c6480858a Migrate for incompatible_require_ctx_in_configure_features (#260)
This PR migrates rules_foreign_cc for bazelbuild/bazel#7793
2019-05-10 15:51:44 +02:00
irengrig bf99a0bf00
Fix #254 (Linker flags passed to ar). (#256)
Fix #254 (Linker flags passed to ar).
2019-05-10 15:49:21 +02:00
irengrig 3831409fd5
For cmake_external and configure_make, do not prepend relative instal… (#258)
For cmake_external and configure_make, do not prepend relative install prefix path with "./", as it is recognized as relative and gets appended to the current build directory anyway, forming the path /tmp/something/./install_prefix - which does not make much sense.
2019-05-09 14:11:03 +02:00
Keith Smiley 2b40a0098d Allow ranlib to be overridden (#253)
This allows users to set this to an empty string if they want to disable
it. Related https://github.com/bazelbuild/rules_foreign_cc/issues/252
2019-05-09 10:56:11 +02:00
irengrig e36f3cee8c
Fix using Bazel-built libraries by cmake_external and configure_make (#249)
Fix #232 - enable usage of Bazel-built libraries as dependencies of cmake_external and configure_make.

- fix logic of reading library data described by C/C++ Bazel interface (as CcInfo.linking_context appeared)
- symlink transitive include directories under $EXT_BUILD_DEPS
- gather all possible transitive include directories to pass to CMake, pass transitive include directories to CMAKE_PREFIX_PATH so that the transitive include directories were scanned by CMake
- fix logic of passing transitive libraries into CPPFLAGS (configure_make)
- add test with the chain: Bazel lib -> CMake lib -> Bazel cc_test
- add synthetic configure-make test with the chain: Bazel lib -> configure_make lib -> Bazel cc_test
- also notice, that passed include directories from Bazel C/C++ Sandwich interface are not always existing; for now, make symlinking code resistant to that

see https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Preset-Output-Variables.html
2019-05-09 10:35:00 +02:00
irengrig 6b04da2262
Example with malloc attribute, currently not working (#250) 2019-05-07 18:19:16 +02:00
irengrig 4c59d4d0c5
Correct environment variable references to the platform-independent style (#248)
* working example for #241

* correct variables references
2019-05-06 16:30:21 +02:00
irengrig 15aec187ff
working example for #241 (#247) 2019-05-06 16:04:47 +02:00
Dig-Doug e43f5f275a - Fixes a bug where bootstrap options weren't being passed (#245) 2019-05-06 10:30:14 +02:00
László Csomor 5f9879c7ec Windows, tests: fix for native test wrapper (#246)
* Windows, tests: fix for native test wrapper

In this PR:

- Update `@bazel_skylib` to 0.8.0, which has a
  Windows-compatible unittest.bzl

- Fix unittest-using tests. Correct usage of
  `unittest.end(env)` is to return its value.

Result: //test:all now passes with Bazel 0.25.0rc3
and --incompatible_windows_native_test_wrapper

* Register Skylib toolchains

* rules_foreign_cc_dep registers unittest toolchains

* Address review comments

* Add bazel_skylib_workspace to WORKSPACE files

* Remove stale toolchain init code
2019-04-30 16:50:26 +03:00
irengrig e3f4b5e0bc
remove unneeded -print option from find command (#242) 2019-04-04 13:39:40 +02:00
Keith Smiley 59a618db5f Remove rules_apple dependency (#233)
This appears to be unused
2019-03-19 18:35:05 +01:00
Jingwen d18d7bd35d Fix Buildkite breakage caused by gmaven_rules rename (#236)
* Fix buildkite breakage

* update examples WORKSPACE
2019-03-12 15:41:04 +01:00
irengrig f00cd27f06
Pass --copt, --cxxopt, --conlyopt, --linkopt to cmake_external/configure_make rules (#235)
- explicitly pass the values of these options to corresponding compilation/link flags lists; add them to the end of the lists of they are not already there
- please see the test in test/standard_cxx_flags_test
2019-03-11 16:50:39 +01:00
irengrig bcb7a345f7
Remove support for the versions of Bazel before 0.22 (#234)
- as 0.23 is already released
- to have only one variant of framework code
2019-03-11 16:34:56 +01:00
irengrig a3593905f7
Explicitly name the nested workspace for tests on Bazel CI (#230)
Explicitly name the nested workspace for tests on Bazel CI
2019-03-07 14:25:20 +01:00