Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate samu #15

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
38f9de1
rename timer_end to timer_read
annacrombie Jan 5, 2024
eed0346
integrate samurai
annacrombie Jan 5, 2024
c9a1648
factor samu output to allow outputting to file
annacrombie Jan 6, 2024
9deaf33
error on external_program.full_path if multi elem
annacrombie Jan 6, 2024
c3a525b
remove ninja requirement from muon bootstrap
annacrombie Jan 6, 2024
232b5b8
port samu build to use run_cmd_ctx
annacrombie Jan 8, 2024
3b56302
run_cmd posix: check if child terminated by signal
annacrombie Jan 8, 2024
4489187
remove some more cleanup functions that do nothing
annacrombie Jan 10, 2024
4eec0d7
move mtime calculation to platform/
annacrombie Jan 10, 2024
a43f5c9
change scan.c to use a buffer directly
annacrombie Jan 10, 2024
f8054b4
move os_ functions that only path should call
annacrombie Jan 10, 2024
40d4ca8
fix arrangement of tracy calls wrt freed pointers
annacrombie Jan 10, 2024
a2226ce
use fs_write in samu_write_file
annacrombie Jan 10, 2024
5ea94d6
fix argument type
annacrombie Jan 10, 2024
253b287
use fs_mkdir functions in samu_makedirs
annacrombie Jan 10, 2024
5684611
use path_chdir rather than chdir
annacrombie Jan 10, 2024
aea8927
add os_ functions for querying job spawning info
annacrombie Jan 10, 2024
b638101
use os_parallel_job_count() in cmd_test
annacrombie Jan 10, 2024
da01690
use path_cwd rather than getcwd
annacrombie Jan 10, 2024
5e57858
remove unused includes
annacrombie Jan 10, 2024
40c77ef
re-add job failure message
annacrombie Jan 10, 2024
c13a701
Include exit status in job failure message
michaelforney Jun 18, 2023
7d224d0
deps: Handle escaped newlines in Makefile fragments
michaelforney Jun 30, 2023
fdaf9a8
fix detection/usage of getloadavg
annacrombie Jan 14, 2024
8a03815
fix macos build
annacrombie Jan 14, 2024
d5b7d32
fix variable name typo
annacrombie Jan 14, 2024
7f6f41b
fix samu failed job detection
annacrombie Jan 14, 2024
10e551a
add -v in ci
annacrombie Jan 14, 2024
c4cc3ba
make compiler checks log the source they are using
annacrombie Jan 14, 2024
6c8cbce
fix getloadavg detection on macos
annacrombie Jan 14, 2024
0805dff
implement job count calculation for windows
annacrombie Jan 15, 2024
7305678
add verbose test output to macos build
annacrombie Jan 15, 2024
77c7569
fix bad job calculation when n = -1;
annacrombie Jan 15, 2024
ea04a9f
calculate ncpus properly on macos
annacrombie Jan 15, 2024
0289042
remove bogus assert
annacrombie Jan 17, 2024
0d9cc5f
samu_makedirs: don't fail if dir already exists
annacrombie Jan 17, 2024
e78d694
samu deps.c: avoid rename() call
annacrombie Jan 17, 2024
05b480d
fs_read: report EOF error correctly
annacrombie Jan 17, 2024
efaff85
change muon private dir to .muon
annacrombie Jan 17, 2024
3315256
set ninja builddir as muon private dir
annacrombie Jan 17, 2024
6089e9f
add win32_fatal
annacrombie Jan 25, 2024
679fd8d
change samu mtime special values
annacrombie Jan 25, 2024
267c9a8
refactor samu deps parser to not use f* calls
annacrombie Jan 25, 2024
9e34ab3
refactor samu log parser to not use f* calls
annacrombie Jan 25, 2024
2aabf8d
remove setvbuf call
annacrombie Jan 25, 2024
548c53e
avoid non-standard %z specifier
annacrombie Jan 25, 2024
2882acb
sbuf: allow into_str with manual alloc'd sbuf
annacrombie Jan 25, 2024
7e01271
use sbuf_into_str with run_cmd output
annacrombie Jan 25, 2024
e147af2
fix implementation of windows fs_mtime
annacrombie Jan 25, 2024
3e1f9a1
refactor windows run_cmd to allow async commands
annacrombie Jan 25, 2024
fd23afc
use sbufs in posix run cmd
annacrombie Jan 25, 2024
794d272
fix warnings
annacrombie Jan 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .builds/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tasks:
fi
- build_gcc: |
cd muon
CC=gcc tools/ci/fullbootstrap.sh -Dbuildtype=release -Dstatic=true -Dwebsite=true
CC=gcc tools/ci/bootstrap.sh build -Dbuildtype=release -Dstatic=true -Dwebsite=true
- build_tcc: |
cd muon
CC=tcc tools/ci/bootstrap.sh build-tcc
Expand All @@ -81,14 +81,12 @@ tasks:
CC=gcc build/muon setup \
-Dbuildtype=minsize \
-Dstatic=true \
-Dsamurai=enabled \
-Dlibcurl=disabled \
-Dlibarchive=disabled \
build-small
samu -C build-small
- release: |
cd muon
tools/ci/git_archive_with_samurai.sh muon-edge+samurai
tools/ci/prepare_release_docs.sh build
tools/ci/prepare_binary.sh build edge-amd64-linux-static
tools/ci/prepare_binary.sh build-small edge-amd64-linux-static-small
Expand All @@ -98,12 +96,10 @@ tasks:
build/muon-edge-amd64-linux-static \
build/muon-edge-amd64-linux-static.md5 \
build-small/muon-edge-amd64-linux-static-small \
build-small/muon-edge-amd64-linux-static-small.md5 \
muon-edge+samurai.tar.gz
build-small/muon-edge-amd64-linux-static-small.md5
artifacts:
- muon/build/muon-edge-amd64-linux-static
- muon/build/muon-edge-amd64-linux-static.md5
- muon/build-small/muon-edge-amd64-linux-static-small
- muon/build-small/muon-edge-amd64-linux-static-small.md5
- muon/build/doc/docs/man.tar.gz
- muon/muon-edge+samurai.tar.gz
6 changes: 1 addition & 5 deletions .builds/netbsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@

image: netbsd/latest
packages:
- curl
- libarchive
- pkgconf
- samurai
sources:
- https://git.sr.ht/~lattis/muon
tasks:
- build: |
cd muon
# TODO remove this when we implement rpaths
export LD_LIBRARY_PATH=/usr/pkg/lib
tools/ci/fullbootstrap.sh
tools/ci/bootstrap.sh build
- test: |
cd muon/build
# TODO remove this when we implement rpaths
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
- name: bootstrap_deps
run: |
set -x
CFLAGS=-DNO_GETLOADAVG tools/bootstrap_ninja.sh build
mkdir -p build
curl -L -o build/pkgconf-1.9.3.tar.gz https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-1.9.3.tar.gz
tar xvf build/pkgconf-1.9.3.tar.gz
mv pkgconf-pkgconf-1.9.3 subprojects/pkgconf
- name: bootstrap
run: |
./bootstrap.sh build
PATH="build:$PATH" CFLAGS=-DNO_GETLOADAVG build/muon setup -Dsamurai=enabled build
build/samu -C build
PATH="build:$PATH" build/muon -v setup build
build/muon -C build samu
- name: test
run: |
build/muon -C build test || true
build/muon -C build test -v -ddots || true
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ Patches and bug reports welcome!
Essential:

- `c99`
- a ninja-compatible build tool (`samu` can be optionally bootstrapped with
`tools/bootstrap_ninja.sh`)

For `pkgconf` support:

Expand Down Expand Up @@ -90,19 +88,14 @@ Stage 1:
./bootstrap.sh build
```

Optionally, if your system does not provide a ninja-compatible build tool, you
may use the provided ninja bootstrapping script.

```
./tools/bootstrap_ninja.sh build
ninja=build/samu
```
This will by default build a copy of samurai into the resulting executable. To
disable this behavior use `CFLAGS=-DBOOTSTRAP_NO_SAMU`.

Stage 2:

```
build/muon setup build
$ninja -C build
build/muon -C build samu
build/muon -C build test
build/muon -C build install
```
Expand Down
2 changes: 1 addition & 1 deletion include/backend/ninja.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ struct write_tgt_ctx {
};

bool ninja_write_all(struct workspace *wk);
int ninja_run(struct workspace *wk, obj args, const char *chdir, const char *capture);
bool ninja_run(struct workspace *wk, obj args, const char *chdir, const char *capture);
#endif
9 changes: 7 additions & 2 deletions include/external/samurai.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
#ifndef MUON_EXTERNAL_SAMURAI_H
#define MUON_EXTERNAL_SAMURAI_H

#include <stdint.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

struct samu_opts {
FILE *out;
};

extern const bool have_samurai;

bool muon_samu(uint32_t argc, char *const argv[]);
bool samu_main(int argc, char *argv[], struct samu_opts *opts);
#endif
30 changes: 30 additions & 0 deletions include/external/samurai/arg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* SPDX-FileCopyrightText: Michael Forney <[email protected]>
* SPDX-FileCopyrightText: Stone Tickle <[email protected]>
* SPDX-License-Identifier: MIT
*/

#ifndef MUON_EXTERNAL_SAMU_ARG_H
#define MUON_EXTERNAL_SAMU_ARG_H

#define SAMU_ARGBEGIN \
for (;;) { \
if (argc > 0) \
++argv, --argc; \
if (argc == 0 || (*argv)[0] != '-') \
break; \
if ((*argv)[1] == '-' && !(*argv)[2]) { \
++argv, --argc; \
break; \
} \
for (char *opt_ = &(*argv)[1], done_ = 0; !done_ && *opt_; ++opt_) { \
switch (*opt_)

#define SAMU_ARGEND \
} \
}

#define SAMU_EARGF(x) \
(done_ = 1, *++opt_ ? opt_ : argv[1] ? --argc, *++argv : ((x), abort(), (char *)0))

#endif
19 changes: 19 additions & 0 deletions include/external/samurai/build.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: Michael Forney <[email protected]>
* SPDX-FileCopyrightText: Stone Tickle <[email protected]>
* SPDX-License-Identifier: MIT
*/

#ifndef MUON_EXTERNAL_SAMU_BUILD_H
#define MUON_EXTERNAL_SAMU_BUILD_H

struct samu_node;

/* reset state, so a new build can be executed */
void samu_buildreset(struct samu_ctx *ctx);
/* schedule a particular target to be built */
void samu_buildadd(struct samu_ctx *ctx, struct samu_node *n);
/* execute rules to build the scheduled targets */
void samu_build(struct samu_ctx *ctx);

#endif
Loading
Loading