build: make release builds for aarch64 reproducible
ci/woodpecker/push/woodpecker Pipeline was successful Details

part of #2
pull/21/head
alex 1 year ago
commit 53812cbd37
Signed by: x1ddos
GPG Key ID: FDEFB4A63CBD8460

@ -7,11 +7,12 @@ pipeline:
image: git.qcode.ch/nakamochi/ci-zig0.10.1:v2 image: git.qcode.ch/nakamochi/ci-zig0.10.1:v2
commands: commands:
- zig build test - zig build test
aarch64:
image: git.qcode.ch/nakamochi/ci-zig0.10.1:v2
commands:
- zig build -Ddriver=fbev -Dtarget=aarch64-linux-musl
sdl2: sdl2:
image: git.qcode.ch/nakamochi/ci-zig0.10.1:v2 image: git.qcode.ch/nakamochi/ci-zig0.10.1:v2
commands: commands:
- zig build -Ddriver=sdl2 - zig build -Ddriver=sdl2
aarch64:
image: git.qcode.ch/nakamochi/ci-zig0.10.1:v2
commands:
- zig build -Ddriver=fbev -Dtarget=aarch64-linux-musl -Drelease-safe -Dstrip
- sha256sum zig-out/bin/nd zig-out/bin/ngui

@ -14,6 +14,14 @@ pub fn build(b: *std.build.Builder) void {
const buildopts = b.addOptions(); const buildopts = b.addOptions();
buildopts.addOption(DriverTarget, "driver", drv); buildopts.addOption(DriverTarget, "driver", drv);
const common_cflags = .{
"-Wall",
"-Wextra",
"-Wundef",
// strip source file paths for repro builds
b.fmt("-ffile-prefix-map={s}/=/", .{b.pathFromRoot("")}),
};
// gui build // gui build
const ngui = b.addExecutable("ngui", "src/ngui.zig"); const ngui = b.addExecutable("ngui", "src/ngui.zig");
ngui.setTarget(target); ngui.setTarget(target);
@ -26,32 +34,26 @@ pub fn build(b: *std.build.Builder) void {
ngui.addIncludePath("src/ui/c"); ngui.addIncludePath("src/ui/c");
ngui.linkLibC(); ngui.linkLibC();
const lvgl_flags = &.{ const lvgl_flags = .{
"-std=c11", "-std=c11",
"-fstack-protector", "-fstack-protector",
"-Wall",
"-Wextra",
"-Wformat", "-Wformat",
"-Wformat-security", "-Wformat-security",
"-Wundef", } ++ common_cflags;
}; ngui.addCSourceFiles(lvgl_generic_src, &lvgl_flags);
ngui.addCSourceFiles(lvgl_generic_src, lvgl_flags);
const ngui_cflags: []const []const u8 = &.{ const ngui_cflags = .{
"-std=c11", "-std=c11",
"-Wall",
"-Wextra",
"-Wshadow", "-Wshadow",
"-Wundef",
"-Wunused-parameter", "-Wunused-parameter",
"-Werror", "-Werror",
}; } ++ common_cflags;
ngui.addCSourceFiles(&.{ ngui.addCSourceFiles(&.{
"src/ui/c/ui.c", "src/ui/c/ui.c",
"src/ui/c/lv_font_courierprimecode_14.c", "src/ui/c/lv_font_courierprimecode_14.c",
"src/ui/c/lv_font_courierprimecode_16.c", "src/ui/c/lv_font_courierprimecode_16.c",
"src/ui/c/lv_font_courierprimecode_24.c", "src/ui/c/lv_font_courierprimecode_24.c",
}, ngui_cflags); }, &ngui_cflags);
ngui.defineCMacroRaw(b.fmt("NM_DISP_HOR={}", .{disp_horiz})); ngui.defineCMacroRaw(b.fmt("NM_DISP_HOR={}", .{disp_horiz}));
ngui.defineCMacroRaw(b.fmt("NM_DISP_VER={}", .{disp_vert})); ngui.defineCMacroRaw(b.fmt("NM_DISP_VER={}", .{disp_vert}));
@ -62,15 +64,15 @@ pub fn build(b: *std.build.Builder) void {
ngui.defineCMacro("LV_TICK_CUSTOM_SYS_TIME_EXPR", "(nm_get_curr_tick())"); ngui.defineCMacro("LV_TICK_CUSTOM_SYS_TIME_EXPR", "(nm_get_curr_tick())");
switch (drv) { switch (drv) {
.sdl2 => { .sdl2 => {
ngui.addCSourceFiles(lvgl_sdl2_src, lvgl_flags); ngui.addCSourceFiles(lvgl_sdl2_src, &lvgl_flags);
ngui.addCSourceFile("src/ui/c/drv_sdl2.c", ngui_cflags); ngui.addCSourceFile("src/ui/c/drv_sdl2.c", &ngui_cflags);
ngui.defineCMacro("NM_DRV_SDL2", null); ngui.defineCMacro("NM_DRV_SDL2", null);
ngui.defineCMacro("USE_SDL", null); ngui.defineCMacro("USE_SDL", null);
ngui.linkSystemLibrary("SDL2"); ngui.linkSystemLibrary("SDL2");
}, },
.fbev => { .fbev => {
ngui.addCSourceFiles(lvgl_fbev_src, lvgl_flags); ngui.addCSourceFiles(lvgl_fbev_src, &lvgl_flags);
ngui.addCSourceFile("src/ui/c/drv_fbev.c", ngui_cflags); ngui.addCSourceFile("src/ui/c/drv_fbev.c", &ngui_cflags);
ngui.defineCMacro("NM_DRV_FBEV", null); ngui.defineCMacro("NM_DRV_FBEV", null);
ngui.defineCMacro("USE_FBDEV", null); ngui.defineCMacro("USE_FBDEV", null);
ngui.defineCMacro("USE_EVDEV", null); ngui.defineCMacro("USE_EVDEV", null);