-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (90 loc) · 3.1 KB
/
Makefile
File metadata and controls
103 lines (90 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
.PHONY: all dynamod installer rootfs iso clean distclean test-qemu test-qemu-serial test-qemu-install
ECLIPSE_VERSION ?= 0.1.0
BUILD_DIR := $(CURDIR)/build
ROOTFS_DIR := $(BUILD_DIR)/rootfs
ISO_FILE := $(BUILD_DIR)/eclipse-linux-$(ECLIPSE_VERSION).iso
DYNAMOD_DIR := $(CURDIR)/dynamod
DYNAMOD_ZIG_OUT := $(DYNAMOD_DIR)/zig/zig-out/bin
DYNAMOD_RUST_OUT := $(shell if [ -d "$(DYNAMOD_DIR)/rust/target/x86_64-unknown-linux-musl/release" ]; then \
echo "$(DYNAMOD_DIR)/rust/target/x86_64-unknown-linux-musl/release"; else \
echo "$(DYNAMOD_DIR)/rust/target/release"; fi)
all: iso
# dynamod builds as the current user (needs zig + rustup configured for your user).
# Do NOT run this target under sudo.
dynamod:
$(MAKE) -C $(DYNAMOD_DIR)
# GUI installer — builds as the current user.
# Requires: rustup target add x86_64-unknown-linux-musl && sudo pacman -S musl
# Do NOT run this target under sudo.
INSTALLER_DIR := $(CURDIR)/eclipse-installer
INSTALLER_BIN := $(INSTALLER_DIR)/target/x86_64-unknown-linux-musl/release/eclipse-installer
installer:
cargo build --manifest-path $(INSTALLER_DIR)/Cargo.toml \
--target x86_64-unknown-linux-musl --release
# rootfs and iso require root for chroot/mount/losetup.
# They invoke sudo internally so the top-level `make` can run unprivileged.
rootfs: dynamod
sudo scripts/build-rootfs.sh $(BUILD_DIR)
iso: rootfs
sudo scripts/build-iso.sh $(BUILD_DIR)
test-qemu:
@[ -f $(ISO_FILE) ] || { echo "ERROR: $(ISO_FILE) not found. Run 'make iso' first."; exit 1; }
@echo "Booting Eclipse Linux ISO in QEMU..."
@QEMU_EXTRA=""; \
if [ -w /dev/kvm ]; then \
QEMU_EXTRA="-enable-kvm -cpu host"; \
echo "KVM: enabled"; \
else \
echo "KVM: not available (will be slower)"; \
fi; \
qemu-system-x86_64 \
$$QEMU_EXTRA \
-cdrom $(ISO_FILE) \
-boot d \
-m 2048M \
-smp 2 \
-device virtio-vga-gl \
-display gtk,gl=on
test-qemu-serial:
@[ -f $(ISO_FILE) ] || { echo "ERROR: $(ISO_FILE) not found. Run 'make iso' first."; exit 1; }
@echo "Booting Eclipse Linux ISO in QEMU (serial console)..."
@QEMU_EXTRA=""; \
if [ -w /dev/kvm ]; then \
QEMU_EXTRA="-enable-kvm -cpu host"; \
echo "KVM: enabled"; \
else \
echo "KVM: not available (will be slower)"; \
fi; \
qemu-system-x86_64 \
$$QEMU_EXTRA \
-cdrom $(ISO_FILE) \
-boot d \
-m 2048M \
-smp 2 \
-nographic \
-no-reboot
test-qemu-install:
@[ -f $(ISO_FILE) ] || { echo "ERROR: $(ISO_FILE) not found. Run 'make iso' first."; exit 1; }
@echo "Booting Eclipse Linux ISO in QEMU with a blank 20GB disk for installation..."
@mkdir -p $(BUILD_DIR)
@[ -f $(BUILD_DIR)/test-disk.qcow2 ] || qemu-img create -f qcow2 $(BUILD_DIR)/test-disk.qcow2 20G
@QEMU_EXTRA=""; \
if [ -w /dev/kvm ]; then \
QEMU_EXTRA="-enable-kvm -cpu host"; \
echo "KVM: enabled"; \
else \
echo "KVM: not available (will be slower)"; \
fi; \
qemu-system-x86_64 \
$$QEMU_EXTRA \
-cdrom $(ISO_FILE) \
-drive file=$(BUILD_DIR)/test-disk.qcow2,format=qcow2,if=virtio \
-boot d \
-m 2048M \
-smp 2 \
-device virtio-vga-gl \
-display gtk,gl=on
clean:
rm -rf $(BUILD_DIR)
distclean: clean
$(MAKE) -C $(DYNAMOD_DIR) clean