Skip to content

Commit

Permalink
Various build fixes for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Aug 15, 2021
1 parent f9939c4 commit 893218a
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 13 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: macos-10.15
strategy:
matrix:
scheme: [iSH, "iSH+Linux"]
kernel: [ish, linux]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -50,5 +50,12 @@ jobs:
run: |
brew install llvm ninja libarchive
pip3 install meson
- name: Clone Linux
if: matrix.kernel == 'linux'
run: deps/clone-linux.sh
- name: Build
run: xcodebuild -project iSH.xcodeproj -scheme ${{matrix.scheme}} -sdk iphoneos CODE_SIGNING_ALLOWED=NO
if: matrix.kernel == 'ish'
run: xcodebuild -project iSH.xcodeproj -scheme iSH -arch arm64 -sdk iphoneos CODE_SIGNING_ALLOWED=NO
- name: Build
if: matrix.kernel == 'linux'
run: xcodebuild -project iSH.xcodeproj -scheme iSH+Linux -arch x86_64 -sdk iphonesimulator CODE_SIGNING_ALLOWED=NO
2 changes: 1 addition & 1 deletion deps/clone-linux.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh -e
repo_root="$(realpath "$(dirname $0)/..")"
repo_root="$(dirname $0)/.."
sub_path=deps/linux
sub_repo="$repo_root/$sub_path"
git submodule init "$sub_path"
Expand Down
2 changes: 1 addition & 1 deletion deps/linux
13 changes: 12 additions & 1 deletion deps/linux-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export ISH_CFLAGS="$5"
export LIB_ISH_EMU="$6"
export ARCH=ish

# https://stackoverflow.com/a/3572105/1455016
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

makeargs=()
if [[ -n "$LINUX_HOSTCC" ]]; then
makeargs+="HOSTCC=$LINUX_HOSTCC"
Expand All @@ -24,5 +29,11 @@ if [[ "$srctree/arch/ish/configs/$defconfig" -nt "$objtree/.config" ]]; then
make -C "$srctree" O="$(realpath "$objtree")" "${makeargs[@]}" "$defconfig"
fi

make -C "$objtree" -j "$(nproc)" "${makeargs[@]}" --debug=v | tee "/tmp/log" | "$srctree/../makefilter.py" "$depfile" "$output"
case "$(uname)" in
Darwin) cpus=$(sysctl -n hw.ncpu) ;;
Linux) cpus=$(nproc) ;;
*) cpus=1 ;;
esac

make -C "$objtree" -j "$cpus" "${makeargs[@]}" --debug=v | tee "/tmp/log" | "$srctree/../makefilter.py" "$depfile" "$output"
cp "$objtree/vmlinux" "$output"
6 changes: 3 additions & 3 deletions deps/makefilter.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3 -u
#!/usr/bin/env python3
import sys
import re
import os
line_re = re.compile(r'^ [A-Z]+\s+')
dep_re = re.compile(r'\s+Prerequisite `([^\']*)\' is (older|newer) than target')
deps = set()
for line in sys.stdin:
if line_re.match(line):
sys.stdout.write(line)
if line.endswith('\n'):
line = line[:-1]
if line_re.match(line):
print(line)
m = dep_re.match(line)
if m:
deps.add(m.group(1))
Expand Down
17 changes: 13 additions & 4 deletions deps/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,23 @@ if get_option('kernel') == 'linux'
'-Wno-null-pointer-arithmetic',
],
link_with: [build_linux[0]],
sources: [build_linux[1]],
)

if host_machine.system() == 'darwin'
liblinux_link_args = [
'-sectalign', '__DATA', '__percpu_first', '1000',
'-sectalign', '__DATA', '__tracepoints', '20',
]
elif host_machine.system() == 'linux'
liblinux_link_args = [
'-Wl,-T', meson.current_build_dir()+'/linux/arch/ish/kernel/vmlinux.lds'
]
endif
liblinux = declare_dependency(
link_with: [libish_emu],
link_whole: [build_linux[0]],
link_args: [
'-sectalign', '__DATA', '__percpu_first', '1000',
'-sectalign', '__DATA', '__tracepoints', '20',
],
sources: [build_linux[1]],
link_args: liblinux_link_args,
)
endif
2 changes: 1 addition & 1 deletion linux/fakefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ static int fakefs_iterate(struct file *file, struct dir_context *ctx) {
ctx->pos = host_telldir(dir) + 1;
// TODO fix inode numbers!!!!!
ent.ino = 0;
if (!dir_emit(ctx, ent.name, ent.name_len, ent.ino, ent.type))
if (!dir_emit(ctx, ent.name, strlen(ent.name), ent.ino, ent.type))
break;
}
return res;
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ elif get_option('kernel') == 'linux'
link_with: [libfakefs],
dependencies: [
liblinux,
libm,
threads,
declare_dependency(link_whole: modules),
])
endif
Expand Down

0 comments on commit 893218a

Please sign in to comment.