Commit Graph

73 Commits

Author SHA1 Message Date
Mike Lundy 10d47d4421
configure_make: support autotools cross-compilation (#1247) 2024-08-12 22:07:54 +01:00
Gowroji Sunil 9949fce954
Add j2objc fragment to rules (#1175) 2024-02-20 09:25:40 +00:00
James Sharpe 18dcce582f
Use gazelle to generate bzl_library targets (#1127) 2023-12-21 10:42:09 +00:00
tanx 51152aac9d
set CC and CXX and their flags in meson (#1098) 2023-12-11 09:35:14 +00:00
Isaac Torres ea7ed42949
fix linux cross compiling on macos (#1062)
Fixes cross-compiling from macos to linux.

see #997 for background.

I had to make a couple of extra changes to support this:

Setting CMAKE_SYSTEM_NAME manually causes CMAKE_SYSTEM_PROCESSOR to not be set. This breaks some builds that expect this variable to be set like libjpeg-turbo.
I made it so that the above variables are only set when cross-compilation is detected so that rules_foreign_cc only takes on responsibility of setting them when necessary.
2023-06-27 23:16:22 +01:00
Keith Smiley b7074f111e
Fix cross compiling for android on macOS (#997) 2023-02-22 22:01:22 +00:00
Keith Smiley 9acbb35691
Update buildifier (#998) 2023-01-06 19:56:01 +00:00
jheaff1 6425a21252
Reduce build times (especially on windows) by symlinking directories (#983) 2022-11-09 00:14:43 +00:00
Ara Nguyen c65e8cfbaa
migrating to rbe_preconfig (#952) 2022-08-18 18:18:24 +01: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
jheaff1 33bce66655
Absolutise path to cmake crosstool file (#870) 2022-02-09 23:15:54 +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
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
jheaff1 7205619704
Ensure Windows paths used by CMake contain forward slashes only (#807) 2021-11-22 19:53:28 +00:00
Fabian Meumertzheim d93bd96dc7
Add flags from copts and linkopts attributes (#796) 2021-10-05 07:07:10 -07:00
James Sharpe bad4ab0c3d
Fix quoting for cmake (#703) 2021-07-28 18:12:53 +01: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 76198edc79
Fixed dangling symlinks in builds (#656) 2021-06-01 13:59:16 -07:00
UebelAndre 4010620160
Fix RBE by using updated bazel-toolchains version (#654) 2021-05-21 19:40:34 +01:00
UebelAndre 66cd7dc9d4
Revert "Include `libtool` and `.nice` files when replacing sandbox paths (#644)" (#648)
This reverts commit 0859891060.
2021-05-16 22:53:04 +01:00
UebelAndre 0859891060
Include `libtool` and `.nice` files when replacing sandbox paths (#644) 2021-05-12 14:00:42 -07:00
UebelAndre 62fcc5f143
Fixed silent failures replacing sandbox paths in outputs (#635) 2021-05-09 06:18:25 +01:00
James Sharpe b136e6c52d
Add config for building with spawn_strategy=standalone (#603)
* Add config for building with spawn_strategy=standalone

* Always build RELEASE configuration to avoid having to select for the output due to change in artifact names for debug builds

* Fix for copy_contents_to_dir and symlink_contents_to_dir on macOS as per #512

* Update name of test files
2021-05-05 17:47:25 -07:00
UebelAndre 4eb5c5c0c2
Added a new `platform_info` target to the foreign_cc framework (#629)
* Added a new `platform_info` target to the foreign_cc framework

* Update foreign_cc/private/framework/platform.bzl

Co-authored-by: James Sharpe <james.sharpe@zenotech.com>

Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2021-05-05 21:35:54 +01:00
UebelAndre 923cd88ed4
Added new foreign_cc framework commands: (#628)
- enable_tracing
- disable_tracing
- script_extension
- shebang
2021-04-30 13:26:23 -07:00
UebelAndre 1bd2a8c547
Refactored framework to avoid polymorphism complexity (#612)
* Refactored framework to be less complex

* Deleted default commands (aka 'stale linux commands')

* Restored toolchain name
2021-04-30 17:03:32 +01:00
UebelAndre a2ec6c0d26
Fixed provider name which was violating naming conventions (#620) 2021-04-23 17:11:13 +00:00
UebelAndre c734ca8446
Replaced uses of `export ` with `##export_var##` (#614) 2021-04-19 15:37:56 +01:00
Danny Wolf b6135adb24
Fix string escaping for cmake and configure/make (#567)
* Fix string escaping for cmake and configure/make

Use raw strings where possible to make readability slightly less maddening.

* Example usage of __TIME__

* Allow expansion of environment variables in HEREDOC for cmake crosstool

* Add compile check that __TIME__ is correctly redacted

* Ran buildifier

* Remove comment that is now invalid

Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
2021-04-15 16:44:41 -07:00
James Sharpe ede2c80a51
Keep lines of scripts as a list of commands until script creation (#572)
This reduced the large amount of `"\n".join()` calls
2021-03-17 14:50:25 -07:00
UebelAndre e4399415b8
Added "targets" API (#556)
* Added `targets` API to all existing build rules

* Updated examples

* Restore making the make toolchain always available.

* Add support for generator cmake parsing and setting CMAKE_MAKE_PROGRAM

* Cleaned up duplicate generator arguments

* Fixed cmake tests

* Updated docs

* Addressed PR feedback

* Fixed missing and incorrect generators

* Fixed `generate_args` name
2021-03-17 13:42:44 +00:00
UebelAndre 83e6cf48cf
Moved `workspace_definitions.bzl` to `foreign_cc/repositories.bzl` to solve for bzl-visibility issues. (#557) 2021-03-12 09:08:13 -08:00
UebelAndre edbfa3bfa9
Restructured rules to match architecture (#555)
* Restructured rules to match architecture

* Added exports of all symbols in the deprecated location for legacy support

* Updated examples
2021-03-12 16:54:14 +00:00
James Sharpe c309ec1319
Enable testing on RBE (#525)
* Enable testing on RBE

* Attempting to fix ninja example on RBE

* Disable targets that aren't currently working on RBE
2021-03-09 13:28:28 -08:00
UebelAndre 175b29c6f7
Renamed BUILD files to BUILD.bazel (#540)
* Renamed BUILD files to BUILD.bazel

* Ran Buildifier
2021-03-03 10:08:03 -08:00
UebelAndre e285764b78
Restructed examples and enabled more testing (#515)
* Reorganized examples

* Documentation

* Third party
2021-02-26 20:21:13 +00:00
James Sharpe 4520018bc2
Make generate_crosstool=True the default for cmake. (#523)
This was previously setting `CMAKE_SYSTEM_NAME` in the generated
toolchain file but setting this explicitly enables `CMAKE_CROSSCOMPILING`
(see https://cmake.org/cmake/help/v3.19/variable/CMAKE_CROSSCOMPILING.html#variable:CMAKE_CROSSCOMPILING)
which breaks projects that use `TRY_RUN`
2021-02-24 14:45:36 -08:00
UebelAndre 87df6b25f6
Fixed unbound variable in commands and recursive symlinks (#514)
* Fixed unbound variables

* Fixed MacOS recursive symlinks
2021-02-22 20:28:41 +00:00
James Sharpe 9a4435ecab
Attempt to catch shell script errors proactively with 'set -euo pipef… (#500)
* Attempt to catch shell script errors proactively with 'set -euo pipefail'

* Fix up uninitialised variable use

* Fix osx shell function

* Fix to unbound variable in windows commands
2021-02-16 11:55:48 -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 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
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
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 9b6a8f675c
Add tests for checking the minimum supported version to CI (#469) 2021-01-25 19:07:05 +00: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
James Sharpe 30912b9982
Buildifier formatting (#459) 2021-01-22 06:17:24 -08: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
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