Commit Graph

203 Commits

Author SHA1 Message Date
jheaff1 3cbd0a9938
Add meson support (#986)
* Add meson support

* Modify zlib to be detected via pkgconfig in dependent rules

* Modify zlib and expat to be linked to shared libs in dependent rules

* Add example usage of Meson rule

This commit adds the glib library to the "examples" build. glib requires
pcre2, so pcre and libgit2 (a dependent of pcre) have been
updated/modified

* Add example usage of meson_with_requirements macro

This commit adds mesa to the "examples" build.

This commit also changes the "examples" build to use the hermetic python
toolchain provided by rules_foreign_cc. As such, the python toolchain
built by rules_foreign_cc is no longer used, as it cannot be used in
workspace rules, .e.g pip_parse(). As such, the python2 build has been
removed from the examples as python2 is end-of-life.

Until Bazel 4.2.0, the built-in android toolchain required Python 2. As
such the minimum supported version has been upversioned to 4.2.0.

Note that the BAZEL_VC env var was removed from CI as mesa requires MSVC
2019.

* Set visibility for each target in foreign_cc_rule_variant

* Apply formatting changes

* Get meson examples working with bzlmod

Note that a newer version of pkgconfig than that installed in ubuntu 20
must be used to build libxau, therefore the built_pkgconfig_toolchain is
now registered
2023-06-09 11:29:12 +01:00
Gary Miguel 12ecb0419a
Specify path to sed on MacOS and FreeBSD (#961)
Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2023-05-10 19:37:44 +00:00
James Sharpe 7fa1a1259b
Add bzlmod support files. (#999)
* Bzlmod files

* Turn off android example with bzlmod

* Update .bcr/metadata.template.json
2023-05-06 08:56:00 +01:00
Jeremy Volkman 020854719e
Pass must_keep_debug = False to cc_common.create_link_variables (#1046) 2023-04-26 09:27:11 +01:00
lifengxiang1025 c327fbfdab
installdir_copy seems meaningless as output (#1038)
Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2023-04-23 19:19:20 +00:00
Wangchong Zhou 1023d7ed6b
Use python3 instead of python2 in macos commands (#1037) 2023-04-11 14:14:24 +01:00
Zhongpeng Lin 798242e04d
Disable coverage when a C library is not instrumented (#1021) 2023-02-28 23:26:33 +00:00
Keith Smiley b7074f111e
Fix cross compiling for android on macOS (#997) 2023-02-22 22:01:22 +00:00
James Sharpe 7914d08e12
Add dependency shared libs to sandbox (#990)
Co-authored-by: jheaff1 <jheaff1@outlook.com>
2023-02-21 14:23:17 +00:00
James Sharpe 4d4a678974
Fix pkgconfig built by MSVC on Windows (#992)
Co-authored-by: jheaff1 <jheaff1@outlook.com>
2023-02-21 11:43:07 +00:00
James Sharpe e3699b940f
Update cmake and ninja versions (#996) 2023-02-05 20:07:54 +00:00
Richard O'Grady 1e66c02ea8
Disable fdo features. (#1002) 2023-01-25 21:40:30 +00:00
Keith Smiley 9acbb35691
Update buildifier (#998) 2023-01-06 19:56:01 +00:00
James Sharpe 15ef44c443
Add runfiles of dependency tools to the build (#994)
Co-authored-by: jheaff1 <jheaff1@outlook.com>
2023-01-03 16:07:20 +00:00
James Sharpe 2094b4ab82
Rename make_variant to foreign_cc_rule_variant (#993)
Co-authored-by: jheaff1 <jheaff1@outlook.com>
2023-01-03 11:50:47 +00:00
James Sharpe 41c937a7a9
Fix runnable_binary_wrapper when used as a tool in a dependant rule (#991)
Co-authored-by: jheaff1 <jheaff1@outlook.com>
2023-01-03 11:26:05 +00:00
jheaff1 0ed27c13b1
Add toolchain executables to the PATH (#987) 2022-12-10 20:16:40 +00:00
jheaff1 2c6262f8f4
Hermetic pkg config (#979) 2022-11-09 11:54:39 +00:00
jheaff1 6425a21252
Reduce build times (especially on windows) by symlinking directories (#983) 2022-11-09 00:14:43 +00:00
James Sharpe 78acc733fb
Add make 4.4 (#980) 2022-11-04 17:29:42 +00:00
jheaff1 dd1e2850bd
Add macro that faciliates "bazel run" of binary generated by rules_foreign_cc (#971)
Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2022-11-03 21:24:31 +00:00
cmburn eb83556a59
Add prefix flag config option to make_configure (#973) 2022-11-03 21:17:01 +00:00
Peter Majchrak e5c7d6df61
Expand variables in `user_options` for boost_build (#957) 2022-09-13 09:00:27 +00:00
jheaff1 cfe19aae68
Add ability to specify DLL dir (#939) 2022-07-27 16:46:15 +00:00
jheaff1 21b0c40493
Add tool runfiles to action (#942) 2022-07-26 09:47:53 +01:00
jheaff1 0dafcb29a8
Hermetic ninja build (#935) 2022-06-23 18:38:19 +01:00
Randolf J 5a0f5739f7
Fix `RANLIB` for `configure_make` (#928) 2022-06-23 04:15:53 +00:00
jheaff1 3b0cf7dacb
Faciliate usage of jom (#932) 2022-06-22 19:35:28 +00:00
george-enf b1e65fec98
fix replace_in_files for file names with spaces (#923) 2022-06-19 13:59:50 +00:00
James Sharpe c4d307b707
Use bazel_skylib 1.2.1 (#920) 2022-05-27 19:17:30 +00:00
James Sharpe 0cdd7132b5
Update cmake versions (#918) 2022-05-27 18:16:41 +00:00
James Sharpe f53188cb8d
Ninja 1.11.0 (#919) 2022-05-27 16:55:59 +00:00
graywolf-at-work 5d391cfe9d
Make tests pass on busybox (#912)
-t option to ln is not defined under POSIX and (at least) busybox does
not implement it. Rewrite the code to use only POSIX options to ln.
2022-05-26 22:24:17 +00:00
Keith Smiley f9458a5e9a
Fix ninja bootstrap on macOS 12.3+ (#900) 2022-04-20 23:24:05 +01:00
Thomas cac46994c9
Pass '-undefined error' non sysroot ldflag on macOS (#894) 2022-04-19 16:54:23 +01:00
Keith Smiley e0590b50e4
Set CMAKE_OSX_ARCHITECTURES to target architecture (#891) 2022-04-16 17:19:01 +01:00
James Sharpe 4aa243d4db
Fixups to use of Labels to support bzlmod (#872) 2022-04-07 16:44:38 +01:00
James Sharpe 9fc3411bb5
Add current_*_toolchain rules to allow passing current toolchain inst… (#843)
Co-authored-by: UebelAndre <github@uebelandre.com>
2022-03-14 14:06:22 +00:00
James Sharpe f54068e889
Add 3.22.2 and 3.21.5 (#875) 2022-02-20 17:06:56 -08:00
jheaff1 33bce66655
Absolutise path to cmake crosstool file (#870) 2022-02-09 23:15:54 +00:00
Fabian Meumertzheim 26eadbcd0d
Replace `escape_locations` with `escape_locations_and_make_variables` everywhere (#861)
Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2022-02-09 22:34:12 +00:00
Fabian Meumertzheim f0047ba2f5
Do not set user defined env variables twice for (c)make (#860) 2022-02-08 23:05:33 +00:00
Fabian Meumertzheim 50ee9979e6
Remove arbitrary limits in Starlark "while" loops (#862) 2022-01-21 21:05:18 +00:00
James Sharpe e24d9cecfe
Allow all source files to be modified in configure_make when using configure_in_place = True (#856) 2022-01-10 09:48:37 +00:00
James Sharpe 2f9965077f
bzlmod fix (#855) 2022-01-07 09:35:19 +00:00
James Sharpe ae4ff42901
More quoting fixes for handling paths with spaces (#850) 2022-01-02 16:42:56 +00:00
James Sharpe 5f37b4245b
CMake 3.22.1 (#841) 2022-01-01 21:46:02 +00:00
James Sharpe 3c14ef4a73
Initial bzlmod support (#839) 2022-01-01 21:07:29 +00:00
James Sharpe 818cdb197e
Fix quoting to support spaces in paths with files that need replacements (#842) 2022-01-01 20:48:37 +00:00
James Sharpe e3a12c7d0f
Add runfiles to build_tools (#844) 2021-12-19 21:23:30 +00:00
James Sharpe 029314b890
Fix typo in comment (#840) 2021-12-18 19:43:32 +00:00
James Sharpe 26ccca83b8
Add toolchain types for autotools tools (#816) 2021-12-17 23:27:10 +00:00
Eric Astor ebfeaa08f8
Support propagation of `includes` (#826) 2021-12-04 21:29:47 +00:00
Fabian Meumertzheim 0cf751c053
Bootstrap make reproducibly (#817)
* Make cc_toolchain_utils.bzl more reusable

By using getattr, the helper functions in this file can be reused in
rules that do not define all of the framework attributes, e.g. bootstrap
rules.

* Bootstrap make reproducibly on Linux and macOS

Uses the Bazel C/C++ toolchain to bootstrap make and ensure that the
resulting binary contains no absolute and thus non-hermetic paths.

Building make reproducibly helps with remote caching and removes the
dependency on a C compiler installed on the host.
2021-11-30 15:58:53 +00:00
Yesudeep Mangalapilly a2f1e5d8c3
Adds toolchain for freebsd. (#794)
* Adds toolchain for freebsd.

* Address buildifier lint warnings.

* Use /usr/bin/env bash

* Leave the Linux-specific shebang alone.

* Adds note about Bazel CI issue requesting for FreeBSD support and experimental status.

* Fix typo.

* Clean up trailing whitespace.

* Updates bazel-skylib version for tests to pass on FreeBSD.

* Update foreign_cc/repositories.bzl

Co-authored-by: UebelAndre <github@uebelandre.com>
2021-11-29 10:54:06 +00:00
Fabian Meumertzheim f61ce5d10b
Pass toolchain and user env variables to make invocation (#777)
* Pass toolchain and user env variables to make invocation

* Rename configure --> make

* Add integration test coverage for make flag passing

This requires making the make_simple Makefile more realistic by

* using CXX and forwarding it to the wrapper;
* using CXXFLAGS instead of CXX_FLAGS and not overwriting its contents.
2021-11-27 07:52:54 -08:00
Fabian Meumertzheim 1a262c9411
Let make build in BUILD_TMPDIR (#818)
configure_make already used BUILD_TMPDIR whereas make did not.
2021-11-24 23:24:29 +00:00
jheaff1 7205619704
Ensure Windows paths used by CMake contain forward slashes only (#807) 2021-11-22 19:53:28 +00:00
James Sharpe 7baefc1a8c
Autotools examples (#754)
* Build files for autotools tools
* m4 1.4.19
2021-11-19 00:56:08 +00:00
James Sharpe 1327fa3d4c
CMake 3.21.3, 3.21.4 and 3.22.0 support (#815) 2021-11-19 00:27:40 +00:00
James Sharpe eaf1092368
Explicitly turn off guile support in built version of GNU make (#814) 2021-11-18 23:30:30 +00:00
Daniel Wagner-Hall ec9c9a4612
Expand make variables in env (#788) 2021-10-19 07:51:53 -07:00
Fabian Meumertzheim d93bd96dc7
Add flags from copts and linkopts attributes (#796) 2021-10-05 07:07:10 -07:00
UebelAndre a7105dafb0
Updated `rules_cc` and `bazel_skylib` versions (#795) 2021-09-30 23:34:16 +00:00
Keith Smiley 6c0c2af3d5
Improve failed exports logic (#789) 2021-09-22 00:35:40 +00:00
Fabian Meumertzheim fde2581fab
Resolve symlinks among output binaries (#781)
Certain (C)Make projects (such as [AFL++](https://github.com/AFLplusplus/AFLplusplus)) emit binaries that are symlinks to other emitted binaries. When built with `rules_foreign_cc`, this can lead to non-deterministic dangling symlink errors since Bazel visits the outputs in an unspecified order. This is fixed by resolving symlinks among the emitted binaries, just like it is already done for libraries.
2021-09-06 15:01:16 +01:00
James Sharpe 8f6fc67384
Add cmake version 3.21.2 (#778) 2021-08-28 21:16:01 +01:00
Keith Smiley da8952e27c
Fix building for iOS (#767) 2021-08-21 08:55:10 +01:00
Keith Smiley 4ee863c1fc
Fix building without sandboxing (#769)
Since 466c32c70f any changes you made
while testing rules_foreign_cc, or changes to those rules, would not
invalidate the CMakeCache.txt and lead to build issues. It wasn't the
case before that because new temp dirs were used each time.
2021-08-20 09:33:10 +01:00
UebelAndre be72696944
Added support for Visual Studio 2022 (#758) 2021-08-18 13:07:49 +00:00
David Marcin 3f61e246a3
Pass all tags to execution_requirements (#765) 2021-08-18 10:21:17 +01:00
UebelAndre 9bfb4d7da6
Added CMake 3.21.1 (#757) 2021-08-17 13:49:18 +00:00
jheaff1 f01fd353ee
Build apr for MSVC on Windows (#743) 2021-08-05 19:40:20 +01:00
jheaff1 3b72ab3468
Re-add setting of PREFIX variable in make invocation (#751) 2021-08-03 06:11:07 -07:00
UebelAndre 86979c9ece
Fix missing parameter (#746) 2021-07-30 09:09:06 +01:00
jheaff1 1cc0f074f4
Remove "GNU" prefix to Make (#744) 2021-07-29 06:13:26 -07:00
James Sharpe bad4ab0c3d
Fix quoting for cmake (#703) 2021-07-28 18:12:53 +01:00
jheaff1 5163c3cec8
Build OpenSSL using MSVC toolchain on Windows (#729)
* build OpenSSL using MSVC toolchain on Windows

* Display lib name in progress message

Before this commit, when building OpenSSL using MSVC, the progress
message would display "Building openssl_msvc_".

After this commit, the progess message would display
"Building openssl".

* Add test to verify linkage with OpenSSL libs

* Add test to verify linkage with Curl libs

Note that linker errors occur in applications that link with libssl
and libcrypto if libcrypto comes before libssl on the linker
command-line. Swapping the order of libcrypto and libssl in
BUILD.openssl.bazel resolved the issue.
2021-07-28 08:13:03 -07:00
jheaff1 2e61d9588a
Add <rule>_variant macros (#734)
The macros utilise bazel "transitions" to set the `make` toolchain used
in the configure_make(), cmake() or make() rules to
a given make variant toolchain, e.g. preinstalled_nmake.

Note that the msvc constraint was removed from the
`exec_compatible_with` attribute of `preinstalled_nmake_toolchain` as
the condition is not actually met even when building with msvc. See
https://github.com/bazelbuild/bazel/issues/7730.

This will be tested in PR#729
2021-07-28 15:30:04 +01:00
jheaff1 b51f25ee62
Prepend user-specified PATH to existing PATH (#733)
If a user specifies a PATH value as part of an `env` attribute, the
value will be prepended to the existing PATH.

An example requirement for this change is that the MSVC build of
OpenSSL requires that the Netwide Assembler (NASM) must be on the
PATH.
2021-07-22 20:30:25 +01:00
jheaff1 c7330faee5
Wrap tool paths that contain whitespaces in quotes (#732)
This change is required when using the MSVC toolchain on Windows,
as paths for tools such as the compiler contain whitespaces (e.g.
C:\Program Files\...)

Co-authored-by: UebelAndre <github@uebelandre.com>
2021-07-20 16:44:33 +00:00
jheaff1 919d65bb06
Convert MSVC flags by replacing slashes with dashes (#731)
* Convert MSVC flags by replacing slashes with dashes

This overcomes bugs in MSYS2 where leading slashes are converted to
paths, e.g. "/nologo" is converted to "C:\msys64\nologo".

This commit would modify the flag to become "-nologo". MSVC supports
both slashes and dashes for flags.

* Update foreign_cc/private/cc_toolchain_util.bzl

Co-authored-by: UebelAndre <github@uebelandre.com>
2021-07-20 16:42:29 +00:00
UebelAndre 41f24f3a2f
Added consistent use of `expand_locations` to all rules. (#722)
* Added consistent use of `expand_locations` to all rules.

* Use variable expansion syntax from the framework.
2021-07-19 19:44:21 +00:00
UebelAndre f9885a8066
Updated common `deps` attribute to require `CcInfo` in targets (#723) 2021-07-19 10:59:01 -07:00
Alexander Turkin 721fd85881
added cmake 3.21.0 (#726) 2021-07-19 10:04:44 +01:00
UebelAndre c95d769e30
Added a `make_toolchain`, `nmake` for `msvc` windows platforms (#724) 2021-07-18 20:46:46 +01:00
UebelAndre 32e222aeff
Enable more examples tests on windows (#718)
* Enable examples tests on windows

* Fixed windows absolute paths being treated as relative.

* Escape windows backslashes for sed replacement

* Improve `//cmake_hello_world_lib/static:libhello` example
2021-07-14 09:37:35 -07:00
jheaff1 93d7c272cc
Build make windows (#716)
* Refactor _env_prelude method to be public (589)

In an upcoming commit, the method will be used to set the PATH,
INCLUDE and LIB environment variables in Windows when building GNU
Make from source

* Build make from source on Windows (#589)

The built_tools_framework.bzl file was modified so that the PATH,
INCLUDE and LIB environment variables are set from the C++ toolchain,
e.g. MSVC.

The PATH environment variable is prepended with the path to the
toolchain's linker, otherwise the MSYS2 linker would be used instead
of MSVC (as they are both named link.exe).
2021-07-12 07:17:18 -07:00
James Sharpe bb2f0ab0aa
Use configure_make to build cmake. (#588)
* Add copts to framework

* Use configure_make to build cmake. Closes #584
2021-07-06 22:58:00 +01:00
James Sharpe c41020e465
Always set use_default_shell_env=True so that action_env is propagated. (#701) 2021-06-28 20:13:17 +00:00
UebelAndre 6f03311e89
Added cmake 3.20.5 and all other final releases of 3.X (#698)
* Added cmake 3.20.5 and all other final releases of 3.X

* Updated built-toolchains
2021-06-28 15:22:06 +00:00
jheaff1 99ea7e75c2
Set progress message when building targets (#697) (#697) 2021-06-23 08:32:21 -07:00
UebelAndre a7f1c9e604
Docs are now auto-generated using mdbook (#692) 2021-06-22 13:10:31 -07:00
jheaff1 5663d884a2
Provide out_data_dirs attribute (#419) (#622)
This change facilitates hermetic python toolchains, as demonstrated by
the test added in this commit.
2021-06-22 08:51:29 -07:00
UebelAndre 96dc580194
Updated macos `copy_dir_contents_to_dir` to behave more like other platforms (#687) 2021-06-22 16:14:38 +01:00
UebelAndre 3dbe409720
Removed legacy `*env_vars` attributes from `cmake` and `configure_make` rule (#675)
* Removed legacy `*env_vars` attributes from `cmake` and `configure_make` rule. Use `env` instead.

* Updated examples

* Improved variable expansion

* Fixed missing `build_data` attribute for `configure_make`

* Fix environment variable quotes

* Attempt to address quoted environment variables.

* Updated documentation
2021-06-21 08:24:34 -07:00
Attila Oláh fccd4ddaeb
Fix tool_prefix for CMake (#686)
* Fix tool_prefix for CMake.

Set the prefix before the first CMake invocation (where all the extra
flags are passed), and don't set the prefix for the `--build` and
`--install` invocations of CMake.

Fixes #685.

* Update test/cmake_text_tests.bzl

Co-authored-by: UebelAndre <github@uebelandre.com>
2021-06-16 21:55:02 +00:00
UebelAndre f11977b484
Added documentation for providers (#681) 2021-06-16 13:58:55 +00:00
UebelAndre 9932c7dbc2
Removed `make_commands` attribute and fixed `configure_make` (#671) 2021-06-16 13:09:15 +00:00
Alexander Turkin 23907e5972
update cmake to 3.20.4 (#680)
* update cmake to 3.20.4

* update cmake to 3.20.4

* update cmake to 3.20.4
2021-06-16 12:46:23 +01:00