Commit Graph

277 Commits

Author SHA1 Message Date
James Sharpe 3be0d3b94e
Move location of generated logs and scripts (#503)
* Don't include log files in default outputs

* Remove logs from install directory

* Rename directory for build script output
2021-02-16 07:58:16 -08:00
UebelAndre 689c96aaa7
Fetch prebuilt cmake and ninja binaries as registered default toolchains (#508)
* Added tooling for generating repositories for pre-built cmake and ninja binaries

* Generated toolchains

* Picked up fix

* Removed toolchains from http_archives and updated generator script

* Regenerated toolchains

* Updated cmake version

* Added additional constraints

* Added option for registering preinstalled toolchains

* MacOS uses universal binaries

* Fixed typo

* More constraints
2021-02-16 15:41:58 +00:00
UebelAndre 80143e7c5a
Updated `master` -> `main` (#504) 2021-02-12 15:05:18 -08:00
UebelAndre da99da47a0
Remove a print from the cleanup function (#501) 2021-02-10 18:33:41 +00:00
Ciarán Connor c6c2e4719f
Fix bash local variable syntax on mac (#424)
Co-authored-by: UebelAndre <andre.brisco@gmail.com>
2021-02-09 18:58:43 -08:00
James Sharpe cf2a0456b8
Remove version from generated script (#499)
* Remove version from generated script

* Rename variable
2021-02-09 13:04:09 -08:00
James Sharpe f77a9e12a3
Propagate defines into CFLAGS and CXXFLAGS passed to the framework (#498)
* Propagate defines into CFLAGS and CXXFLAGS passed to the framework

* Fix flags test

* Add example to test propagation of defines
2021-02-09 12:56:20 -08:00
Attila Oláh 466c32c70f
Build under Bazel sandbox instead of /tmp (#479)
* Build under bazel sandbox instead of /tmp, and remove redundant printf

Build artifacts under /tmp are not cleaned up after a failed build, for
the ease of debugging.  However, this can quickly fill up the /tmp partition
if the build is large.  Build under the sandbox directory instead, and
rely on standard bazel cleanup scheme.

Also remove a print from the cleanup function, which somehow causes empty
newlines to be printed in bazel build output.

* Avoid infinite recursion in symlink_to_dir.

This is a somewhat hackish approach to exclude *.ext_build_deps from
symlinks when creating the symlink forest. This is necessary in cases
where an entire directory is added to the includes, e.g. when setting
includes = ["."] where the directory itself contains a cmake_external()
rule that depends on the very rule containing the includes = ["."].

* Also avoid using a temp directory when bootstrapping make or cmake itself.

* Remove the ##tmpdir## shell toolchain command.

It is no longer necessary now that all its uses are gone.

Co-authored-by: Lauri Peltonen <lape@iki.fi>
2021-02-05 13:29:07 +00:00
UebelAndre 603f3d83d8
Added deprecation notice to `install_ws_dependency` (#496) 2021-02-04 23:12:29 +00:00
UebelAndre 0da08c9714
Added some helpful issue links (#494) 2021-02-04 10:42:02 -08:00
Daniel Wagner-Hall ece188f9ab
Allow setting env vars (#489)
* Allow setting env vars

Also, bring all runfiles of data deps along for execution - currently
data deps which consist of more than one file aren't copied into the
action, which means that they will fail at runtime when they try to use
their runfiles.

* Update docs
2021-02-04 11:59:01 +00:00
James Sharpe 7c4490a2ee
Fix typo in macro arguments (#492) 2021-02-03 12:54:23 -08:00
UebelAndre 743975a998
Fixed incorrect detection of lib_source root (#488)
* Cleanup

* Fixed incorrect detection of lib_source root

* Updated tests
2021-02-03 20:18:43 +00:00
Attila Oláh ce3f53d1b6
Ignore Vim swap files. (#480)
Co-authored-by: UebelAndre <andre.brisco@gmail.com>
2021-02-03 08:47:25 -08:00
UebelAndre 14520d220f
Made buildifier checks more aggressive (#485)
* Made buildifier checks more aggressive

* Ran buildifier to fix all warnings

* Added sorting to cmake script generation and updated tests
2021-02-02 20:09:33 +00:00
Fumitoshi Ukai 78dd474994
support filename containing space (#416)
handle filename containg space.
cmake prebuilt archive contains such filename in docs etc.

also fix symlink to a directory. [ -L "$1" ] returns success
for it, but it would fail "cp $1 $2" as
 cp: -r not specified; omitting directory ...

Fixes: #405, #406

Co-authored-by: UebelAndre <andre.brisco@gmail.com>
2021-01-31 07:43:03 -08:00
Yun Peng 8ae4651929
Fix test target on macOS with Bazel@HEAD (#475)
* Fix test target on macOS with Bazel@HEAD

supports_dynamic_linker feature was removed from cc toolchain for macOS,
cc_binary should be used to build shared library.

Context: bazelbuild/bazel#4341 (comment)

* Fix test on Windows
2021-01-26 17:03:09 +00:00
Wong Heung Sang 4d4acaa112
Fix pkgconfig for configure_make and make (#447)
* Fix pkgconfig for configure_make

* Extract pkgconfig script

* Fix pkgconfig for make

Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2021-01-25 23:02:05 +00:00
UebelAndre 898bed4efb
Enable Buildifier in CI (#458)
* Added Buildifier check to CI

* Addressed Buildifier lint defects
2021-01-25 22:01:43 +00:00
UebelAndre b72b799413
Updated docs (#473) 2021-01-25 21:59:29 +00:00
UebelAndre d85b575a40
Remove deprecated rules_foreign_cc_utils repo (#470)
* Removed foreign_cc_platform_utils

* Removed rules_foreign_cc_bazel_version

* Update workspace_definitions.bzl

Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2021-01-25 13:42:14 -08:00
UebelAndre 62672f382a
Updated CI build tag to only user the main branch (#471) 2021-01-25 13:18:52 -08:00
Oliver Tan a70322b054
configure: add autoconf to configure (#432)
We have run into a library that works with autoconf but not autoreconf.
As such, I've introduced a new rule to use autoconf as the build script.
2021-01-25 12:12:52 -08:00
rqssouza 00c274b757
Makes additional_inputs accept targets (#450)
* Makes additional_inputs accept targets

Makes additional_inputs attribute also accept bazel Targets
as inputs, just like lib_source attribute already does.

* Stop checking for input is of type 'Target'

Update the patch so it follows the current code style.
Stop checking if the input is of type 'Target' as additional_inputs
attribute shall accept just 'Target' type.
Fix the same issue in additional_tools attribute.
2021-01-25 19:14:15 +00:00
UebelAndre 9b6a8f675c
Add tests for checking the minimum supported version to CI (#469) 2021-01-25 19:07:05 +00:00
UebelAndre 08e8c6c93d
Moved example dependencies into loadable bzl files (#467)
* Sorted dependencies

* Added rules_android repository to satisfy buildifier defects

* Added rules_cc repository to satisfy buildifier defects

* Ran Buildifier
2021-01-25 08:04:52 -08:00
UebelAndre 76870e532d
Updated uses of `@bazel_tools//src/conditions` to `@platforms//` (#465)
Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2021-01-25 08:01:46 -08:00
UebelAndre c18be7037a
Added `data` attr to common framework (#461)
* Added `data` attribute for files needed by the rule at runtime.

* Updated documentation

* Added examples

* Enable runfiles on windows

* Also gather transitive runfiles
2021-01-25 07:44:44 -08:00
UebelAndre 344bbc7d6c
Wrap dependencies in a `maybe` macro (#468)
* Wrapped rule dependencies in `maybe`

* Added Manual tag to some targets that take a very long time to build
2021-01-25 10:31:30 +00:00
UebelAndre 8b8f31dd1b
Created a `./docs` directory to house documentation (#466)
* Added links to docs to top level README

* Updated more docs

* Added generated header
2021-01-24 15:23:19 -08:00
Daniel Wagner-Hall 1b48e17f96
Expand depset to list (#423)
Otherwise if I put anything in additional_tools I get an error about
depset not being iterable.

This matches the for loop just above, which does the to_list conversion.

Co-authored-by: UebelAndre <andre.brisco@gmail.com>
2021-01-24 12:00:31 -08:00
UebelAndre 7eb316ab78
Added deprecation notice to `//cc_configure_make:def.bzl` (#464) 2021-01-24 19:21:16 +00:00
Attila Oláh ec690c5075
Replace references to @bazel_tools//platforms with @platforms//. (#427)
The former has been deprecated and will break by
--incompatible_use_platforms_repo_for_constraints, as announced in
https://github.com/bazelbuild/bazel/issues/8622.

Fixes #354.

Co-authored-by: UebelAndre <andre.brisco@gmail.com>
2021-01-23 12:28:38 -08:00
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