Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build qt on linux #1

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
tasks:
ubuntu2004:
name: Ubuntu 20.04
platform: ubuntu2004
working_directory: e2e/workspace
test_targets:
- "//..."

buildifier:
version: "6.1.0"
# keep this argument in sync with .pre-commit-config.yaml
warnings: "all"
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
5.2.0
5.4.0
# The first line of this file is used by Bazelisk and Bazel to be sure
# the right version of Bazel is used to build and test this repo.
# This also defines which version is used on CI.
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ build --repository_cache=~/.cache/bazel-repo
test --test_output=errors
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
test --test_env=XDG_CACHE_HOME

# Prevent cache miss due to different environment variables between runs
build --incompatible_strict_action_env
test --incompatible_strict_action_env
5 changes: 2 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
strategy:
matrix:
folder:
- '.'
- 'e2e/workspace'

# Steps represent a sequence of tasks that will be executed as part of the job
Expand All @@ -42,8 +41,8 @@ jobs:
uses: actions/cache@v3
with:
path: |
"~/.cache/bazel"
"~/.cache/bazel-repo"
~/.cache/bazel
~/.cache/bazel-repo
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }}
restore-keys: bazel-cache-
- name: bazel test //...
Expand Down
13 changes: 13 additions & 0 deletions NOTES
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resolve TODOs

have requirements.txt in rules_qt repo, not e2e, and call the pip repo rules_qt_pip

replacement of "-config" files breaks llvm-config, see https://github.com/bazelbuild/rules_foreign_cc/pull/109. commit bf2cb01
llvm-config --ldflags will refer to an old sandbox. This was solved for libpng and freetype by replacing the -config file, but they were ascii scripts, not executables! could use it if no-sandbox for llvm build, but try mesa without llvm-config

could try to change replace_in_files to only do so if "file <file>" result contains "ascii"

Add the following to Bazel rc and use Bazel 6.0 to see if it prevents llvm being built twice - https://github.com/bazelbuild/bazel/issues/14023#issuecomment-1325718022

See if qt cmake variable can be set to not build the docs and therefore not require llvm

2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rules_qt_internal_deps()
load("//qt:repositories.bzl", "rules_qt_dependencies")

# Fetch dependencies which users need as well
rules_qt_dependencies()
rules_qt_dependencies(qt_version = "6.2.4")

# For running our own unit tests
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
Expand Down
5 changes: 5 additions & 0 deletions e2e/workspace/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#build --noincompatible_enable_cc_toolchain_resolution
#build --override_repository=mesa=/home/jheaffey/git/mesa
#build --override_repository=rules_foreign_cc=/home/jheaffey/git/rules_foreign_cc


1 change: 1 addition & 0 deletions e2e/workspace/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.4.0
13 changes: 2 additions & 11 deletions e2e/workspace/BUILD
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
"""Provides a simple way to test your rules as an external workspace.
Add a basic smoke-test target below.
"""

load("@bazel_skylib//rules:build_test.bzl", "build_test")
# load("rules_qt//qt:defs.bzl", "...")

# Replace with a usage of your rule/macro
filegroup(name = "empty")

build_test(
name = "smoke_test",
name = "qt_build_test",
targets = [
# targets you add above
":empty",
"@qt//:qt",
],
)
21 changes: 20 additions & 1 deletion e2e/workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,24 @@ local_repository(
path = "../..",
)

# (copied from https://github.com/tensorflow/tensorflow/blob/58e320bee974240b4193ffe7da7bc1cc1c43a551/WORKSPACE#L5)
# The cascade of load() statements and rules_qt_dependencies?() calls works around the
# restriction that load() statements need to be at the top of .bzl files.
# E.g. we can not retrieve a new repository with http_archive and then load()
# a macro from that repository in the same file.

load("@rules_qt//qt:repositories.bzl", "rules_qt_dependencies")
rules_qt_dependencies()

rules_qt_dependencies(qt_version = "6.2.4")

load("@rules_qt//qt:repositories2.bzl", "rules_qt_dependencies2")

rules_qt_dependencies2()

load("@rules_qt//qt:repositories3.bzl", "rules_qt_dependencies3")

rules_qt_dependencies3()

load("@rules_qt//qt:repositories4.bzl", "rules_qt_dependencies4")

rules_qt_dependencies4()
1 change: 1 addition & 0 deletions e2e/workspace/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mako==1.2.1
52 changes: 52 additions & 0 deletions e2e/workspace/requirements_lock.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# bazel run //:requirements.update
#
mako==1.2.1 \
--hash=sha256:df3921c3081b013c8a2d5ff03c18375651684921ae83fd12e64800b7da923257 \
--hash=sha256:f054a5ff4743492f1aa9ecc47172cb33b42b9d993cffcc146c9de17e717b0307
# via -r requirements.txt
markupsafe==2.1.1 \
--hash=sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003 \
--hash=sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88 \
--hash=sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5 \
--hash=sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7 \
--hash=sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a \
--hash=sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603 \
--hash=sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1 \
--hash=sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135 \
--hash=sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247 \
--hash=sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6 \
--hash=sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601 \
--hash=sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77 \
--hash=sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02 \
--hash=sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e \
--hash=sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63 \
--hash=sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f \
--hash=sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980 \
--hash=sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b \
--hash=sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812 \
--hash=sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff \
--hash=sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96 \
--hash=sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1 \
--hash=sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925 \
--hash=sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a \
--hash=sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6 \
--hash=sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e \
--hash=sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f \
--hash=sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4 \
--hash=sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f \
--hash=sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3 \
--hash=sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c \
--hash=sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a \
--hash=sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417 \
--hash=sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a \
--hash=sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a \
--hash=sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37 \
--hash=sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452 \
--hash=sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933 \
--hash=sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a \
--hash=sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7
# via mako
66 changes: 66 additions & 0 deletions qt/private/host_python2.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
load(":versions.bzl", "DEPS")

def __host_python2_impl_windows(rctx):
msiexec = rctx.which("msiexec.exe")
if not msiexec:
fail("Unable to find msiexec.exe")

rctx.report_progress("Fetching python2 MSI")

rctx.download(**DEPS["python2-windows"])

msi_name = DEPS["python2-windows"]["output"]
msi_path = str(rctx.path(msi_name)).replace("/", "\\") # why is this necessary? (copied from rules 7zip)

# msiexec seems to not like extracting to the current working directory, so extract to a folder named "python2"
msi_target_dir = "python2"
msi_target_path = str(rctx.path("python2")).replace("/", "\\") # why is this necessary? (copied from rules 7zip)

msi_extract_args = [
msiexec,
"/a",
msi_path,
"TARGETDIR=%s" % msi_target_path,
"/qn",
]

rctx.report_progress("Extracting %s" % msi_path)
msi_extract_result = rctx.execute(msi_extract_args)

if msi_extract_result.return_code != 0:
err_message = msi_extract_result.stdout if msi_extract_result.stdout else msi_extract_result.stderr
fail("Python2 MSI extraction failed: exit_code=%s\n\n%s" % (msi_extract_result.return_code, err_message))

exec_python2_path = rctx.path("python2/python.exe")

if not exec_python2_path.exists:
fail("Missing %s after MSI extraction" % exec_python2_path)

rctx.template(
"BUILD",
Label("//third_party/python2:BUILD.python2_windows.bazel.tpl"),
{"%{target_dir}": msi_target_dir},
)

def __host_python2_impl_linux(rctx):
rctx.download_and_extract(**DEPS["python2-src"])
rctx.file(
"BUILD",
rctx.read(Label("//third_party/python2:BUILD.python2_linux.bazel")),
)

def _host_python2_impl(rctx):
""" Implementation of the host_python2 repository rule."""

if rctx.os.name.startswith("windows"):
__host_python2_impl_windows(rctx)
else:
__host_python2_impl_linux(rctx)

host_python2 = repository_rule(
implementation = _host_python2_impl,
doc =
"""
Download python2 msi file and extract it .TODO - some doc here. say why necessary, namely pip_install python_interpreter_target must be a file, not a build output
""",
)
Loading