Skip to content

Commit 2da0cd1

Browse files
committed
wip
1 parent f39edf0 commit 2da0cd1

File tree

9 files changed

+113
-142
lines changed

9 files changed

+113
-142
lines changed

.github/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RUN apt-get update && apt-get install -y curl
33
RUN curl https://pkgx.sh/$(uname)/$(uname -m).tgz | tar xz -C /usr/local/bin
44

55
ENV PKGX_DIST_URL="https://dist.pkgx.dev/v2"
6-
RUN pkgx +llvm.org +patchelf +deno^2 +gnu.org/gcc/libstdcxx^14
6+
RUN pkgx +llvm.org^19 +patchelf +deno^2 +gnu.org/gcc/libstdcxx^14
77
COPY ./brewkit /work/brewkit
88
COPY ./.github /work/.github
99
COPY ./deno.jsonc /work/deno.jsonc

README.md

Lines changed: 42 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,54 @@
11
# `pantry^2`
22

3-
- Configuration is hardcoded to /etc
4-
- We use vendor-built binaries where possible
5-
- We assume the vendor knows how to build their product better than us
6-
- Means issues are almost always upstream and not ours
7-
- Notably excepting when the prebuilt binaries vendor libraries we provide
8-
- windows/x86-64 support from day 1
9-
- Relocatable without environment fixes for all base packages
10-
- If we package a package manager and it provides a tool (in a unpainful way)
11-
then pkgx will invoke that other tool to get the thing
12-
- eg. `cargo-binstall`, `npx`, `uvx` etc. will be used instead of us
13-
packaging them
14-
- these other mechanisms are generally _preferred_ by the developer and
15-
end-user, we'll just know how to get you the end-product with a consistent
16-
CLI
17-
- this means we can focus on ensuring the base is as good as possible
18-
without distraction from a massive pkg list
19-
- We will still index everything and show it at [pkgx.dev/pkgs]
20-
- Minimizing deps on macOS
21-
- we added deps because Linux needed them in v1 due to laziness and urgency
3+
## Goals
4+
5+
- Better optimized packages
6+
- Much more careful dependency selection
7+
- We have reviewed everything that is transitive thoroughly
8+
- Leaner, more streamlined packages
9+
- Python reduced from 280MB to 78MB
10+
- LLVM pruned to just what is needed and split out into multiple packages
11+
reduing its size from 1.5GB to 300MB
12+
- More consistent namespacing
13+
- More reliable builds
14+
- More robust bottles
15+
- eg. `rpath` fixes are now much more thorough and careful
16+
- Better configured and more consistently configured packages
17+
- In general we set configuration to be `/etc` with user config carve outs
18+
- Across the board dependency on OpenSSL^3 rather ^1.1.1
19+
- Use of macOS system libraries where possible
20+
- Windows native support
21+
- Faster build infrastructure
22+
- More minimal pre-requisite footprint on Linux
23+
- 100% relocatable packages without environment fixes for all base packages
24+
- Use vendor built binaries where possible and sensible
25+
- Provided the vendor does not statically link in libraries this is a
26+
better choice since we assume the vendor knows how to build their product
27+
better than us
2228
- No magic
23-
- git no longer looks for `git-foo` if you type `git foo`
24-
- etc.
25-
- we would consider adding these back, but not as _part_ of the package
26-
itself. The package itself should solely focus on our other goals and
27-
otherwise be vanilla.
28-
- `pkgx^1,^2` will use pantry^1, `pkgx^3` will use pantry^2
29-
- building with as minimal images as is possible to ensure we are sure about
30-
what goes into our packages
29+
- eg. `git` stub that looks to `pkgx` for `git-foo`
30+
- More flexible build infrastructure
31+
- Less unwise hacks
32+
- eg. symlinking versioned include directories, instead we now set `CPATH`
33+
in the package.yaml runtime env
34+
- Separating out eg. `gem` from Ruby for purity reasons was a mistake
35+
- No more packaging for projects without versioning or with careless
36+
versioning. Eg. `llama.cpp` and `vim`.
37+
- Users still want these so we can instead make them build from source on
38+
demand.
39+
- It is gross currently since these projects release multiple times *a day*
40+
41+
## Future Goals
42+
3143
- First class `pkgm` support
3244
- everything should install to `/usr/local` and just work
33-
- No weird handling for calver
34-
- no (or much less) pre-reqs on Linux
35-
- we only need glibc and libgcc
36-
- strictly we don’t need the user to provide libgcc, but us building and
37-
using our own is more or a pita than we can handle RN
38-
- variable deps
39-
- eg. a major version requires new deps
40-
- eg. heaven forbid, a minor version changes the dep constraint
41-
- sources tarball locations can vary by version
42-
- program lists can vary by version
43-
- no deversioning of inner directories (for `pkgm`)
44-
- no support for dollar prefixed moustaches in `package.yml`
45-
- independently versioned things must be independent
46-
- generally we are already good at this
47-
- things without established versioning and/or programs are not valid to be
48-
packaged. They go in `pkgo`
45+
- Zero pre-requisties on Linux
46+
- Dependencies can vary by version
47+
- Program lists can vary by version
4948
- standardize pkgs
5049
- use XDG and standard dirs on other platforms
5150
- configure things that install things to install them to
5251
`${INSTALL_ROOT:-$HOME/.local}` by default
53-
- more consistent project names
54-
- no foo.github.io, just github.com/foo etc.
55-
- no strict adherance to homepages, it's more about namespacing
56-
57-
[pkgx.dev/pkgs]: https://pkgx.dev/pkgs
5852

5953
## Usage
6054

@@ -94,18 +88,6 @@ $ ls bin
9488

9589
- glibc, libgcc and their `-dev` pkgs are still required at this time
9690

97-
## Wins
98-
99-
- Python from 280MB to 78MB
100-
- Cleaner rpath handling across the board
101-
- linux rpath fixes were actually broken with `pantry^1`
102-
- Less env pollution by carefully using `pkgx` during builds rather than
103-
importing dep-envs before builds, meaning more reliable builds with less
104-
unexpected deps
105-
- Carefuly pruning of deps and build options for all base deps
106-
- much tighter python venv handling
107-
- more XDG adherance for base packages
108-
10991
### Build Infra Wins
11092

11193
- a pkg depending on itself now works without conflict since destination
@@ -129,34 +111,6 @@ complexity mounts and mounts. You may as well just use a real language.
129111

130112
Also we needed a cross platform language to support Windows. Bash is not that.
131113

132-
### Criteria for Inclusion
133-
134-
- We require that packages are versioned.
135-
- We require that the project bew licensed such that we are permitted to
136-
redistribute it.
137-
- Stuff that is so new that its build instructions are likely to change a lot
138-
in future may be rejected due to our inability to reliably maintain that.
139-
- Things that can have other general executors (eg. npx) should be run that
140-
way using the `providers` system.
141-
- Things that do not respect reasonable release schedules may be rejected
142-
(eg. we have seen packages release 10+ times a day, every day).
143-
144-
### Requirements
145-
146-
For local builds we need some stuff set up:
147-
148-
* macOS
149-
* The Xcode Command Line Tools are expected to be installed
150-
* Windows
151-
* Visual Studio Community Edition with C++
152-
* Some things expect `nmake` and thus you will need to run a
153-
“developer prompt”
154-
* Linux
155-
* glibc libs and headers
156-
* stdc++
157-
158-
Mostly, otherwise we source build tools from `pkgx`.
159-
160114
### Boostrapping New Platforms
161115

162116
You will need preinstalled versions of the following:

bin/pkg-build

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ async function prep_toolchain(tmpdir: Path, srcroot: Path) {
6060
const llvm_bin = new Path(await backticks_quiet`pkgx -q +llvm.org -- which clang`).parent();
6161
const ln = (tool: string, llvm_tool: string) =>
6262
bin.join(tool).ln('s', { target: llvm_bin.join(llvm_tool) });
63-
ln('cc', 'clang');
64-
ln('gcc', 'clang');
65-
ln('clang', 'clang');
66-
ln('c++', 'clang++');
67-
ln('g++', 'clang++');
68-
ln('clang++', 'clang++');
69-
ln('cpp', 'clang-cpp');
70-
ln('ld', 'ld.lld');
71-
ln('ar', 'llvm-ar');
72-
ln('as', 'llvm-as');
73-
ln('nm', 'llvm-nm');
74-
ln('strings', 'llvm-strings');
75-
ln('ranlib', 'llvm-ranlib');
63+
// ln('cc', 'clang');
64+
// ln('gcc', 'clang');
65+
// ln('clang', 'clang');
66+
// ln('c++', 'clang++');
67+
// ln('g++', 'clang++');
68+
// ln('clang++', 'clang++');
69+
// ln('cpp', 'clang-cpp');
70+
// ln('ld', 'ld.lld');
71+
// ln('ar', 'llvm-ar');
72+
// ln('as', 'llvm-as');
73+
// ln('nm', 'llvm-nm');
74+
// ln('strings', 'llvm-strings');
75+
// ln('ranlib', 'llvm-ranlib');
7676

7777
env["PATH"] = `${bin}:/usr/bin:/bin:/usr/sbin:/sbin`;
7878
// stops ./configure from erroring in our container

brewkit/run.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ function run_f(args: string[]) {
44
}
55
const cmd = args.shift()!;
66

7-
console.error("%c+", "color:yellow", cmd, ...args);
7+
const pretty_args = args.map((arg) => {
8+
if (arg.includes(" ")) {
9+
return arg.replaceAll(/\s+/g, "\\ ");
10+
} else {
11+
return arg;
12+
}
13+
});
14+
15+
console.error("%c+", "color:yellow", cmd, ...pretty_args);
816

917
const { success, code } = new Deno.Command(cmd, {
1018
args,
@@ -79,7 +87,7 @@ function splitArgs(input: string): string[] {
7987
input = input.replace(/#.*$/gm, "");
8088

8189
while ((match = regex.exec(input)) !== null) {
82-
args.push(match[1] || match[2] || match[3]);
90+
args.push((match[1] || match[2] || match[3]).trim());
8391
}
8492

8593
return args;

projects/gnu.org/gcc/build.ts

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
11
import { env_include, BuildOptions, Path, run, unarchive } from "brewkit";
22
import { expandGlob } from "jsr:@std/fs@1/expand-glob";
33

4-
export default async function build({ prefix, version }: BuildOptions) {
4+
export default async function build({ prefix, version, deps }: BuildOptions) {
55
await unarchive(`https://ftpmirror.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.gz`);
66

77
let extra = "";
88

9+
Object.entries(Deno.env.toObject()).forEach(([k,v]) => {
10+
console.error(`${k}=${v}`);
11+
});
12+
913
if (Deno.build.os == "linux") {
10-
const old = Deno.env.get("PKGX_DIST_URL");
11-
Deno.env.delete("PKGX_DIST_URL");
12-
Deno.env.delete("PKGX_PANTRY_DIR");
13-
env_include("gnu.org/gcc^14");
14-
Deno.env.set("PKGX_DIST_URL", "https://dist.pkgx.dev/v2");
15-
Deno.env.set("PKGX_PANTRY_DIR", old!);
14+
Deno.env.delete("LD_LIBRARY_PATH");
15+
// const old = Deno.env.get("PKGX_PANTRY_DIR");
16+
// Deno.env.delete("PKGX_DIST_URL");
17+
// Deno.env.delete("PKGX_PANTRY_DIR");
18+
// env_include("gnu.org/gcc^14");
19+
// Deno.env.set("LD_LIBRARY_PATH", [
20+
// deps['gnu.org/mpfr'].prefix.join("lib").string,
21+
// deps['gnu.org/mpc'].prefix.join("lib").string,
22+
// deps['gnu.org/gmp'].prefix.join("lib").string
23+
// ].join(":")); // temporary to stop illegal instructions
24+
// Deno.env.set("PKGX_DIST_URL", "https://dist.pkgx.dev/v2");
25+
// Deno.env.set("PKGX_PANTRY_DIR", old!);
1626

1727
extra = `
1828
--disable-multilib
19-
--enable-default-pie
20-
--enable-pie-tools
21-
--enable-host-pie
29+
--build=x86_64-pc-linux-gnu # or compile fails due to dupe pid_t
30+
--with-arch=x86-64 # or c++ crashes with illegal instructions inside docker
31+
--with-tune=generic # ^^ same
32+
#--enable-default-pie
33+
#--enable-pie-tools
34+
#--enable-host-pie
2235
`;
2336
}
2437

@@ -28,16 +41,16 @@ export default async function build({ prefix, version }: BuildOptions) {
2841
--prefix=${prefix}
2942
--enable-languages=c,c++
3043
--disable-multilib
31-
--disable-bootstrap
32-
--with-bugurl="https://github.com/pkgxdev/manifests/issues"
33-
# "--with-boot-ldflags=-static-libgcc -static-libstdc++"
44+
--enable-bootstrap
45+
--with-bugurl=https://github.com/pkgxdev/manifests/issues
46+
"--with-boot-ldflags=-static-libgcc -static-libstdc++"
3447
--disable-nls
3548
--enable-shared
3649
# --with-system-zlib #TODO
3750
"--with-pkgversion=pkgx GCC ${version}"
3851
${extra}
3952
`;
40-
run`make --jobs ${navigator.hardwareConcurrency}`;
53+
run`make`; //--jobs ${navigator.hardwareConcurrency}`;
4154
run`make install-strip`; // cannot install in parallel
4255

4356
const lib64 = prefix.join("lib64");

projects/gnu.org/gcc/libstdcxx/build.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { env_include, BuildOptions, Path, run, unarchive } from "brewkit";
33
export default async function build({ prefix, version }: BuildOptions) {
44
await unarchive(`https://ftpmirror.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.gz`);
55

6-
const old = Deno.env.get("PKGX_DIST_URL");
7-
Deno.env.delete("PKGX_DIST_URL");
8-
Deno.env.delete("PKGX_PANTRY_DIR");
6+
// const old = Deno.env.get("PKGX_DIST_URL");
7+
// Deno.env.delete("PKGX_DIST_URL");
8+
// Deno.env.delete("PKGX_PANTRY_DIR");
99
env_include("gnu.org/gcc^14");
10-
Deno.env.set("PKGX_DIST_URL", "https://dist.pkgx.dev/v2");
11-
Deno.env.set("PKGX_PANTRY_DIR", old!);
10+
// Deno.env.set("PKGX_DIST_URL", "https://dist.pkgx.dev/v2");
11+
// Deno.env.set("PKGX_PANTRY_DIR", old!);
1212

1313
Path.cwd().join("build").mkdir().cd();
1414

@@ -24,8 +24,8 @@ export default async function build({ prefix, version }: BuildOptions) {
2424
`;
2525
run`make
2626
--jobs ${navigator.hardwareConcurrency}
27-
all-target-libstdc++-v3
28-
all-target-libgcc`;
27+
# all-target-libstdc++-v3
28+
# all-target-libgcc`;
2929
run`make
3030
install-strip-target-libstdc++-v3
3131
install-strip-target-libgcc`;

projects/gnu.org/gcc/package.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ programs:
2828
platforms:
2929
- linux/x86-64
3030

31-
dependencies:
32-
gnu.org/mpc: ^1.3
31+
# dependencies:
32+
# gnu.org/mpc: ^1.3
3333

34-
linux:
35-
dependencies:
36-
gnu.org/gcc/libstdcxx: ^14
34+
# linux:
35+
# dependencies:
36+
# gnu.org/gcc/libstdcxx: ^14
3737

3838
# we don’t provide a shared libgcc or libstdc++
3939
# we probs should provide a shared libgcc in the future but a share dlibstdc++

projects/google.com/highway/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { BuildOptions, unarchive, run, Path } from "brewkit";
1+
import { BuildOptions, unarchive, run } from "brewkit";
22

33
export default async function ({ prefix, version }: BuildOptions) {
44
await unarchive(`https://github.com/google/highway/archive/refs/tags/${version}.tar.gz`);
55
run`cmake
66
-B bld
7+
-G "Unix Makefiles"
78
-DBUILD_SHARED_LIBS=ON
89
-DCMAKE_INSTALL_PREFIX=${prefix}
910
-DHWY_ENABLE_TESTS=OFF
1011
-DHWY_ENABLE_EXAMPLES=OFF
11-
-DCMAKE_BUILD_TYPE=Release
1212
`;
1313
run`cmake --build bld --target install`;
1414

projects/jpeg.org/jpegxl/build.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,20 @@ export default async function ({ prefix, version, tag }: BuildOptions) {
1717

1818
if (Deno.build.os == "linux") {
1919
// ld.lld: error: undefined reference: __extendhfsf2
20-
Deno.env.set("LDFLAGS", "-Wl,--allow-shlib-undefined");
20+
// Deno.env.set("LDFLAGS", "-Wl,--allow-shlib-undefined");
2121
}
2222

2323
run`cmake
24+
-G "Unix Makefiles"
2425
-B bld
26+
-DCMAKE_VERBOSE_MAKEFILE=ON
2527
-DCMAKE_BUILD_TYPE=Release
2628
-DCMAKE_INSTALL_PREFIX=${prefix}
2729
-DBUILD_TESTING=OFF
2830
-DJPEGXL_ENABLE_SKCMS=OFF
2931
-DJPEGXL_ENABLE_BENCHMARK=OFF
3032
-DJPEGXL_VERSION=${version}
3133
`;
32-
run`cmake --build bld --target install`;
33-
34-
// linux/x86-64:
35-
// ARGS:
36-
// - '-DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined,-lstdc++fs'
37-
// linux/aarch64:
38-
// ARGS:
39-
// - '-DCMAKE_EXE_LINKER_FLAGS=-Wl,-lstdc++fs'
40-
}
34+
// run`cmake --build bld --target install`;
35+
run`make -C bld`;
36+
}

0 commit comments

Comments
 (0)