Skip to content

Commit 8501d1e

Browse files
author
Filippo Cremonese
committed
Add pkgconfig component
1 parent 873cb7d commit 8501d1e

File tree

5 files changed

+45
-3
lines changed

5 files changed

+45
-3
lines changed

.orchestra/config/components/toolchain/arch/win32.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extra_gcc_configure_options:
1515
- --disable-libssp
1616
- --disable-shared
1717
dynamic: "0"
18+
custom_pkgconfig: true
1819
#@ end
1920

2021
#@overlay/match by=overlay.all, expects=1

.orchestra/config/components/toolchain/arch/win64.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extra_gcc_configure_options:
1616
- --disable-shared
1717
extra_gcc_stage2_configure_options: " --enable-threads=posix --enable-libstdcxx-threads=yes"
1818
dynamic: "0"
19+
custom_pkgconfig: true
1920
#@ end
2021

2122
#@overlay/match by=overlay.all, expects=1

.orchestra/config/components/toolchain/lib/gcc.lib.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#@yaml/text-templated-strings
1111
---
12-
#@ def gcc_dependencies(stage, toolchain_name, musl_version, uclibc_version, linux_version, mingw64_version):
12+
#@ def gcc_dependencies(stage, toolchain_name, musl_version, uclibc_version, linux_version, mingw64_version, custom_pkgconfig):
1313
#@ if stage == 1:
1414
#@ suffixes = ["-headers"]
1515
#@ mingw_suffixes = ["-headers"]
@@ -45,6 +45,10 @@
4545

4646
#@ if linux_version:
4747
- toolchain/(@= toolchain_name @)/linux-headers
48+
49+
#@ if/end custom_pkgconfig:
50+
- toolchain/(@= toolchain_name @)/pkgconfig
51+
4852
#@ end
4953

5054
#@ end
@@ -80,6 +84,7 @@
8084
#@ gcc_sysroot = None,
8185
#@ extra_gcc_make_variables = "",
8286
#@ binutils_version = None,
87+
#@ custom_pkgconfig = False,
8388
#@ ):
8489

8590
#@ source_url = "https://ftp.gnu.org/gnu/gcc/gcc-" + gcc_version + "/gcc-" + gcc_version + ".tar.gz"
@@ -94,7 +99,7 @@
9499
#@ else:
95100
#@ fail("GCC stage must be 1 or 2")
96101
#@ end
97-
#@ dependencies = gcc_dependencies(stage, toolchain_name, musl_version, uclibc_version, linux_version, mingw64_version) or []
102+
#@ dependencies = gcc_dependencies(stage, toolchain_name, musl_version, uclibc_version, linux_version, mingw64_version, custom_pkgconfig) or []
98103
#@ build_dependencies = gcc_build_dependencies(stage, toolchain_name) or []
99104

100105
#@ if "win" in toolchain_name:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#@yaml/text-templated-strings
2+
3+
#@ load("/lib/fn_args.lib.yml", "mandatory")
4+
#@ load("/lib/create_component.lib.yml", "single_build_component")
5+
6+
#@yaml/text-templated-strings
7+
---
8+
#@ def pkgconfig_args(
9+
#@ triple=mandatory,
10+
#@ ):
11+
configure: |
12+
mkdir -p "$BUILD_DIR"
13+
# Nothing else to do
14+
install: |
15+
mkdir -p "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/bin"
16+
cat >> "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/bin/(@= triple @)-pkg-config" << EOF
17+
#!/bin/bash
18+
DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
19+
export PKG_CONFIG_PATH="\$DIR/../lib/pkgconfig"
20+
exec pkg-config "\$@"
21+
EOF
22+
chmod +x "${TMP_ROOT}${ORCHESTRA_ROOT}/(@= triple @)/bin/(@= triple @)-pkg-config"
23+
add_to_path:
24+
- $ORCHESTRA_ROOT/(@= triple @)/bin
25+
#@ end
26+
27+
---
28+
#@ def create_pkgconfig_component(toolchain_name=mandatory, triple=mandatory):
29+
#@ return single_build_component(**pkgconfig_args(triple=triple))
30+
#@ end

.orchestra/config/components/toolchain/lib/toolchain.lib.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#@ load("/components/toolchain/lib/coreutils.lib.yml", "create_coreutils_component")
1212
#@ load("/components/toolchain/lib/mingw64.lib.yml", "create_mingw64_components")
1313
#@ load("/components/toolchain/lib/spec.lib.yml", "create_spec_components")
14+
#@ load("/components/toolchain/lib/pkgconfig.lib.yml", "create_pkgconfig_component")
1415

1516
#@yaml/text-templated-strings
1617
---
@@ -35,6 +36,7 @@
3536
#@ extra_gcc_make_variables="",
3637
#@ dynamic=None,
3738
#@ spec=False,
39+
#@ custom_pkgconfig=False,
3840
#@ ):
3941

4042
#@ if/end binutils_version:
@@ -47,7 +49,7 @@
4749
(@= "toolchain/" + toolchain_name + "/linux-headers" @): #@ create_linux_headers_component(triple=triple, linux_version=linux_version, arch_name=linux_arch_name)
4850

4951
#@ if/end gcc_version:
50-
(@= "toolchain/" + toolchain_name + "/gcc" @): #@ create_gcc_component(toolchain_name=toolchain_name, triple=triple, gcc_sysroot=gcc_sysroot, gcc_version=gcc_version, extra_gcc_configure_options=extra_gcc_configure_options, extra_gcc_stage2_configure_options=extra_gcc_stage2_configure_options, extra_gcc_make_variables=extra_gcc_make_variables, musl_version=musl_version, uclibc_version=uclibc_version, linux_version=linux_version, mingw64_version=mingw64_version, binutils_version=binutils_version)
52+
(@= "toolchain/" + toolchain_name + "/gcc" @): #@ create_gcc_component(toolchain_name=toolchain_name, triple=triple, gcc_sysroot=gcc_sysroot, gcc_version=gcc_version, extra_gcc_configure_options=extra_gcc_configure_options, extra_gcc_stage2_configure_options=extra_gcc_stage2_configure_options, extra_gcc_make_variables=extra_gcc_make_variables, musl_version=musl_version, uclibc_version=uclibc_version, linux_version=linux_version, mingw64_version=mingw64_version, binutils_version=binutils_version, custom_pkgconfig=custom_pkgconfig)
5153

5254
#@ if/end mingw64_version:
5355
_: #@ template.replace(create_mingw64_components(toolchain_name=toolchain_name, triple=triple, mingw64_version=mingw64_version, gcc_version=gcc_version))
@@ -64,4 +66,7 @@ _: #@ template.replace(create_uclibc_components(triple=triple, toolchain_name=to
6466
#@ if/end spec:
6567
_: #@ template.replace(create_spec_components(triple=triple, toolchain_name=toolchain_name))
6668

69+
#@ if/end custom_pkgconfig:
70+
toolchain/(@= toolchain_name @)/pkgconfig: #@ create_pkgconfig_component(triple=triple, toolchain_name=toolchain_name)
71+
6772
#@ end

0 commit comments

Comments
 (0)