+glib+meson+flex (#76)

This commit is contained in:
Max Howell 2022-08-10 14:58:22 -04:00 committed by GitHub
parent 0e4d60b919
commit 255f93071b
12 changed files with 126 additions and 42 deletions

View file

@ -16,7 +16,7 @@ jobs:
- ubuntu-latest
include:
- os: macos-11
container: "~"
container: ~
- os: ubuntu-latest
container: ghcr.io/teaxyz/infuser:main
container: ${{ matrix.container }}

View file

@ -0,0 +1,26 @@
distributable:
url: https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
strip-components: 1
versions:
github: westes/flex
strip: /^flex /
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
gnu.org/m4: 1
script: |
./configure --prefix={{ prefix }}
make --jobs {{ hw.concurrency }} install
test:
dependencies:
tea.xyz/gx/cc: c99
script: |
flex {{ pkg.pantry-prefix }}/test.flex
cc lex.yy.c -lfl
OUT=$(echo "Hello World" | ./a.out)
test "$OUT" = "Hello
World"

View file

@ -0,0 +1,10 @@
CHAR [a-z][A-Z]
%%
{CHAR}+ printf("%s", yytext);
[ \t\n]+ printf("\n");
%%
int main()
{
yyin = stdin;
yylex();
}

View file

@ -0,0 +1,2 @@
project('hello', 'c')
executable('hello', 'test.c')

View file

@ -0,0 +1,33 @@
distributable:
url: https://github.com/mesonbuild/meson/releases/download/{{ version }}/meson-{{ version }}.tar.gz
strip-components: 1
versions:
github: mesonbuild/meson/tags
#FIXME
# we need to fix the virtual-env of this thing
dependencies:
python.org: 3
build:
script: |
python3 -m venv {{prefix}}/libexec
{{prefix}}/libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed meson
mkdir {{prefix}}/bin
ln -s {{prefix}}/libexec/bin/meson {{prefix}}/bin/meson
# tidy up
find \
{{prefix}}/libexec/bin \
-name pip\* -o -name easy_install\* -o -name activate\* -o -name Activate.ps1 \
| xargs rm
test:
dependencies:
ninja-build.org: 1
tea.xyz/gx/cc: c99
script: |
meson {{ pkg.pantry-prefix }}
test -f build.ninja

View file

@ -0,0 +1,4 @@
main() {
puts("hi");
return 0;
}

View file

@ -62,6 +62,15 @@ build:
# put data that doesnt vary between pythons in a consistent place
- --datarootdir="$SHARE"
- --datadir="$SHARE"
#FIXME get rid of these v*
OPENSSL_INCLUDES: /opt/openssl.org/v*/include
OPENSSL_LDFLAGS: -L/opt/openssl.org/v*/lib'
#FIXME we should get the include path from the ncurses `.pc` files
CPATH: /opt/invisible-island.net/ncurses/v*/include/ncursesw:$CPATH
# required for `setup.py` which is used to detect the libs for pythons modules
diff: |
diff --git a/setup.py b/setup.py
index 85a2b26..4f2f742 100644

18
scripts/_lib.ts Normal file
View file

@ -0,0 +1,18 @@
import usePantry from "hooks/usePantry.ts"
import { PackageRequirement } from "types"
export function get_build_deps(dry: Set<string>) {
const pantry = usePantry()
return async (pkg: PackageRequirement) => {
const deps = await pantry.getDeps(pkg)
if (dry.has(pkg.project)) {
// we hydrate the runtime deps of any build deps since if
// any of `dry` is a runtime dep of any build dep (obv. from another)
// pkg in the set we are building then it needs to be sorted first
return [...deps.runtime, ...deps.build]
} else {
return deps.runtime
}
}
}

View file

@ -23,6 +23,12 @@ import { semver, PackageRequirement, Package } from "types"
import { parsePackageRequirement } from "types"
import hydrate from "prefab/hydrate.ts"
import resolve from "prefab/resolve.ts"
import { get_build_deps } from "./_lib.ts"
//<FIXME>
import { print } from "utils"
print("this because otherwise console.verbose is not defined lol")
//</FIXME>
const pantry = usePantry()
const cellar = useCellar()
@ -32,20 +38,10 @@ const dry = Deno.args.map(project => {
return match ? match[1] : project
}).map(parsePackageRequirement)
//FIXME this isnt as specific as we are above
const explicit_deps = new Set(dry.map(({ project }) => project))
const build_deps = await (async () => {
const rv: PackageRequirement[] = []
for (const pkg of dry) {
const foo = await pantry.getDeps(pkg)
rv.push(...foo.build)
}
return rv
})()
const wet = await hydrate([...dry, ...build_deps])
const gas = await resolve(await (async () => {
const wet = await hydrate(dry, get_build_deps(explicit_deps))
const gas = async () => {
const rv: PackageRequirement[] = []
for (const pkg of wet) {
if (await cellar.isInstalled(pkg)) continue
@ -53,9 +49,10 @@ const gas = await resolve(await (async () => {
rv.push(pkg)
}
return rv
})())
}
const plasma = await resolve(await gas())
for await (const pkg of gas) {
for await (const pkg of plasma) {
console.log({ installing: pkg.project })
const installation = install(pkg)
await link(installation)

View file

@ -13,37 +13,22 @@ args:
---*/
import { parsePackageRequirement } from "types"
import usePantry from "hooks/usePantry.ts"
import hydrate from "prefab/hydrate.ts"
import { get_build_deps } from "./_lib.ts"
//<FIXME>
import { print } from "utils"
print("this because otherwise console.verbose is not defined lol")
//</FIXME>
const dry = Deno.args.map(project => {
const match = project.match(/projects\/(.*)\/package.yml/)
return match ? match[1] : project
}).map(parsePackageRequirement)
const cum: string[] = []
const set = new Set(dry.map(x => x.project))
const wet = await hydrate(dry, get_build_deps(set))
const gas = wet.map(x => x.project)
.filter(x => set.has(x)) // we're only sorting `dry` so reject the rest
const pantry = usePantry()
for (const pkg of dry) {
const deps = await pantry.getDeps(pkg)
const wet = await hydrate([...deps.runtime, ...deps.build])
for (const {project: dep} of wet) {
if (set.has(dep)) {
cum.push(dep)
}
}
cum.push(pkg.project)
}
const rv = new Array<string>()
const newset = new Set()
for (const pkg of cum) {
if (!newset.has(pkg)) {
rv.push(pkg)
newset.add(pkg)
}
}
console.log(`::set-output name=pkgs::${rv.join(" ")}`)
console.log(`::set-output name=pkgs::${gas.join(" ")}`)

View file

@ -15,7 +15,7 @@ args:
import { parsePackage, semver, Path, PackageRequirement, PlainObject } from "types"
import usePantry from "hooks/usePantry.ts"
import useShellEnv, { expand } from "hooks/useShellEnv.ts"
import { run, undent, isPlainObject, isString } from "utils"
import { run, undent, isPlainObject } from "utils"
import { validatePackageRequirement } from "utils/lvl2.ts"
//TODO install any other deps