Skip to content

Commit 1a56cf1

Browse files
committed
use config.path.build_install
1 parent c4f5608 commit 1a56cf1

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

.github/workflows/ci.cli.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,13 @@ jobs:
7878
set +e
7979
bin/bk build unavailable.com
8080
test $? -eq 2
81+
82+
fix-up:
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v4
86+
- uses: pkgxdev/setup@v2
87+
- run: pkgx --sync
88+
- run: bin/bk build pc-cmake.com
89+
- run: bin/bk test pc-cmake.com
90+
- run: bin/bk audit pc-cmake.com

lib/porcelain/fix-up.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const { host } = utils
66
export default async function finish(config: Config) {
77
const prefix = config.path.install
88
await fix_rpaths(prefix, config.pkg, config.path.cache, config.deps.gas)
9-
await fix_pc_files(prefix)
10-
await fix_cmake_files(prefix)
9+
await fix_pc_files(prefix, config.path.build_install)
10+
await fix_cmake_files(prefix, config.path.build_install)
1111
}
1212

1313
//////////////////////////////////////////////////////////////////////////////////////
@@ -52,7 +52,7 @@ async function fix_rpaths(pkg_prefix: Path, pkg: Package, cache: Path, deps: Ins
5252
}}
5353
}
5454

55-
async function fix_pc_files(pkg_prefix: Path) {
55+
async function fix_pc_files(pkg_prefix: Path, build_prefix: Path) {
5656
//NOTE currently we only support pc files in lib/pkgconfig
5757
// we aim to standardize on this but will relent if a package is found
5858
// that uses share and other tools that build against it only accept that
@@ -66,7 +66,7 @@ async function fix_pc_files(pkg_prefix: Path) {
6666
// newer versions of brewkit append +brewing to the path; this will get both
6767
// variants
6868
const text = orig
69-
.replaceAll(pkg_prefix.join("+brewing").string, `\${pcfiledir}/${relative_path}`)
69+
.replaceAll(build_prefix.string, `\${pcfiledir}/${relative_path}`)
7070
.replaceAll(pkg_prefix.string, `\${pcfiledir}/${relative_path}`)
7171
if (orig !== text) {
7272
console.log({ fixing: path })
@@ -77,7 +77,7 @@ async function fix_pc_files(pkg_prefix: Path) {
7777
}
7878
}
7979

80-
async function fix_cmake_files(pkg_prefix: Path) {
80+
async function fix_cmake_files(pkg_prefix: Path, build_prefix: Path) {
8181
// Facebook and others who use CMake sometimes rely on a libary's .cmake files
8282
// being shipped with it. This would be fine, except they have hardcoded paths.
8383
// But a simple solution has been found.
@@ -90,7 +90,7 @@ async function fix_cmake_files(pkg_prefix: Path) {
9090
// newer versions of brewkit append +brewing to the path; this will get both
9191
// variants
9292
const text = orig
93-
.replaceAll(pkg_prefix.join("+brewing").string, `\${CMAKE_CURRENT_LIST_DIR}/${relative_path}`)
93+
.replaceAll(build_prefix.string, `\${CMAKE_CURRENT_LIST_DIR}/${relative_path}`)
9494
.replaceAll(pkg_prefix.string, `\${CMAKE_CURRENT_LIST_DIR}/${relative_path}`)
9595
if (orig !== text) {
9696
console.log({ fixing: path })

projects/pc-cmake.com/package.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
versions:
2+
- 1.0.0
3+
4+
build:
5+
- run: echo "{{prefix}}" >pc-cmake.pc
6+
working-directory: '{{prefix}}/lib/pkgconfig'
7+
- run: echo "{{prefix}}" >pc-cmake-targets.cmake
8+
working-directory: '{{prefix}}/lib/cmake/pc-cmake'
9+
10+
test:
11+
- test "$(cat {{prefix}}/lib/pkgconfig/pc-cmake.pc)" = '${pcfiledir}/../..'
12+
- test "$(cat {{prefix}}/lib/cmake/pc-cmake/pc-cmake-targets.cmake)" = '${CMAKE_CURRENT_LIST_DIR}/../../..'

0 commit comments

Comments
 (0)