mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 18:25:08 +03:00
fixes building llvm.org^12 (#25)
This commit is contained in:
parent
4300501ada
commit
5fc40d6c4f
6 changed files with 68 additions and 66 deletions
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
|
@ -70,16 +70,24 @@ jobs:
|
|||
|
||||
ln -s $GITHUB_WORKSPACE/cli /opt/tea.xyz/var/cli
|
||||
|
||||
# in case this PR contains updates to the scripts
|
||||
#TODO only do for PRs
|
||||
if test "$GITHUB_REPOSITORY" = "teaxyz/pantry.core"; then
|
||||
cp -rv pantry/scripts/* /opt/tea.xyz/var/pantry/scripts
|
||||
fi
|
||||
|
||||
- run: /opt/tea.xyz/var/pantry/scripts/sort.ts ${{ inputs.projects }}
|
||||
id: sorted
|
||||
|
||||
- run: /opt/tea.xyz/var/pantry/scripts/build-deps.ts ${{ steps.sorted.outputs.pkgs }}
|
||||
id: deps
|
||||
|
||||
- run: cli/scripts/install.ts ${{ steps.deps.outputs.pkgs }}
|
||||
|
||||
# running out of /opt because only pantry.core has these scripts
|
||||
- run: /opt/tea.xyz/var/pantry/scripts/build.ts ${{ steps.sorted.outputs.pkgs }}
|
||||
- run: /opt/tea.xyz/var/pantry/scripts/build.plumbing.ts ${{ steps.sorted.outputs.pkgs }}
|
||||
id: build
|
||||
env:
|
||||
# GITHUB_TOKEN doesn't have private access to teaxyz/cli.
|
||||
# TODO restore to ${{ github.token }} when public
|
||||
GITHUB_TOKEN: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
|
||||
FORCE_UNSAFE_CONFIGURE: 1 # some configure scripts refuse to run as root
|
||||
|
||||
# tarring ourselves ∵ GHA-artifacts (ludicrously) lose permissions
|
||||
|
|
|
@ -42,9 +42,12 @@ build:
|
|||
- -DLLVM_ENABLE_PROJECTS='lld;clang'
|
||||
- -DLLVM_INCLUDE_DOCS=OFF
|
||||
- -DLLVM_INCLUDE_TESTS=OFF
|
||||
linux:
|
||||
ARGS:
|
||||
# the default is `ld` however clang when handling linking itself
|
||||
# internally passes flags that, in fact, expect `lld`
|
||||
#NOTE yes this is an issue even if `ld` is in fact a symlink to `lld`
|
||||
#NOTE only wanted on linux because on macOS we actually *need* the Apple
|
||||
# provided `ld` or things *also* break 😆
|
||||
- -DCLANG_DEFAULT_LINKER=lld
|
||||
darwin:
|
||||
ARGS:
|
||||
|
|
48
scripts/build-deps.ts
Executable file
48
scripts/build-deps.ts
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env -S tea -E
|
||||
|
||||
/*---
|
||||
args:
|
||||
- deno
|
||||
- run
|
||||
- --allow-read
|
||||
- --allow-env
|
||||
- --import-map={{ srcroot }}/import-map.json
|
||||
---*/
|
||||
|
||||
import { Package, PackageRequirement } from "types"
|
||||
import { usePantry, useFlags } from "hooks"
|
||||
import { hydrate } from "prefab"
|
||||
import * as ARGV from "./utils/args.ts"
|
||||
import { set_output } from "./utils/gha.ts"
|
||||
import { pkg } from "utils"
|
||||
|
||||
const pantry = usePantry()
|
||||
|
||||
useFlags()
|
||||
|
||||
const mode: 'build' | 'install' = 'build' //Deno.args.includes("-b") ? 'build' : 'install'
|
||||
|
||||
const get_deps = async (pkg: Package | PackageRequirement) => {
|
||||
const deps = await pantry.getDeps(pkg)
|
||||
switch (mode) {
|
||||
case 'build':
|
||||
return [...deps.build, ...deps.runtime]
|
||||
// case 'install':
|
||||
// return deps.runtime
|
||||
}
|
||||
}
|
||||
|
||||
const rv: PackageRequirement[] = []
|
||||
for await (const pkg of ARGV.pkgs()) {
|
||||
const deps = await get_deps(pkg)
|
||||
const wet = await hydrate(deps)
|
||||
rv.push(...wet.pkgs)
|
||||
}
|
||||
|
||||
const gas = rv.map(pkg.str)
|
||||
|
||||
if (Deno.env.get("GITHUB_ACTIONS")) {
|
||||
set_output("pkgs", gas)
|
||||
} else {
|
||||
console.log(gas.join("\n"))
|
||||
}
|
|
@ -17,13 +17,12 @@ args:
|
|||
- --import-map={{ srcroot }}/import-map.json
|
||||
---*/
|
||||
|
||||
import { usePantry, useFlags, useCellar, useInventory, usePrefix } from "hooks"
|
||||
import { usePantry, useFlags, useCellar, useInventory } from "hooks"
|
||||
import { hydrate, install, link } from "prefab"
|
||||
import { str as pkgstr } from "utils/pkg.ts"
|
||||
import * as ARGV from "./utils/args.ts"
|
||||
import { panic } from "utils/error.ts"
|
||||
import build, { BuildResult } from "./build/build.ts"
|
||||
import { set_output } from "./utils/gha.ts";
|
||||
import build from "./build/build.ts"
|
||||
|
||||
useFlags()
|
||||
|
||||
|
@ -32,8 +31,6 @@ const cellar = useCellar()
|
|||
const inventory = useInventory()
|
||||
const raw = await ARGV.toArray(ARGV.pkgs())
|
||||
|
||||
const rv: BuildResult[] = []
|
||||
|
||||
for (const rq of raw) {
|
||||
const dry = await pantry.getDeps(rq)
|
||||
const wet = await hydrate([...dry.runtime, ...dry.build])
|
||||
|
@ -47,13 +44,6 @@ for (const rq of raw) {
|
|||
}
|
||||
|
||||
const pkg = await pantry.resolve(rq)
|
||||
rv.push(await build(pkg))
|
||||
await build(pkg)
|
||||
await link(pkg)
|
||||
}
|
||||
|
||||
const to = usePrefix()
|
||||
await set_output("pkgs", rv.map(x => pkgstr(x.installation.pkg)))
|
||||
await set_output("paths", rv.map(x => x.installation.path), '%0A')
|
||||
await set_output("relative-paths", rv.map(x => x.installation.path.relative({ to })))
|
||||
await set_output("srcs", rv.map(x => x.src?.relative({ to }) ?? "~"))
|
||||
await set_output("srcs-relative-paths", rv.compact(x => x.src?.relative({ to })))
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
#!/usr/bin/env -S tea -E
|
||||
|
||||
/*---
|
||||
args:
|
||||
- deno
|
||||
- run
|
||||
- --allow-read
|
||||
- --allow-env
|
||||
- --import-map={{ srcroot }}/import-map.json
|
||||
---*/
|
||||
|
||||
import { PackageRequirement } from "types"
|
||||
import { usePantry, useFlags } from "hooks"
|
||||
import { hydrate } from "prefab"
|
||||
import { pkg } from "utils"
|
||||
|
||||
const pantry = usePantry()
|
||||
|
||||
useFlags()
|
||||
|
||||
const mode: 'build' | 'install' = Deno.args.includes("-b") ? 'build' : 'install'
|
||||
const get_deps = async (pkg: PackageRequirement) => {
|
||||
const deps = await pantry.getDeps(pkg)
|
||||
switch (mode) {
|
||||
case 'build':
|
||||
return [...deps.build, ...deps.runtime]
|
||||
case 'install':
|
||||
return deps.runtime
|
||||
}
|
||||
}
|
||||
|
||||
const dry = Deno.args.compact(arg => !arg.startsWith('-') && pkg.parse(arg))
|
||||
const explicit = new Set(dry.map(x=>x.project))
|
||||
const wet = await hydrate(dry, get_deps)
|
||||
const gas = wet.pkgs.compact(({project}) => {
|
||||
if (Deno.args.includes('-i')) {
|
||||
return project
|
||||
} else if (!explicit.has(project)){
|
||||
return project
|
||||
}
|
||||
})
|
||||
|
||||
if (Deno.env.get("GITHUB_ACTIONS")) {
|
||||
console.log(`::set-output name=pkgs::${gas.join(" ")}\n`)
|
||||
} else {
|
||||
console.log(gas.join("\n"))
|
||||
}
|
|
@ -6,7 +6,7 @@ import { parse } from "utils/pkg.ts"
|
|||
export async function *args(): AsyncGenerator<string> {
|
||||
if (Deno.isatty(Deno.stdin.rid)) {
|
||||
for (const arg of Deno.args) {
|
||||
yield arg
|
||||
if (arg[0] != '-') yield arg
|
||||
}
|
||||
} else {
|
||||
let yielded_something = false
|
||||
|
|
Loading…
Reference in a new issue