Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/workflows/Dockerfile_builder
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ FROM ubuntu:22.04
SHELL ["/bin/bash", "-c"]
USER root:root
# Install build tools
RUN apt-get update && apt-get install -y make clang libx11-dev gcc
RUN apt-get update \
&& apt-get install -y build-essential gcc pkgconf make clang cmake \
&& apt-get install -y libx11-dev libbsd-dev libpcap-dev
USER root
WORKDIR /root
ENTRYPOINT /bin/bash
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
PROJECT(maiko C)

SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)

SET(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -37,6 +36,12 @@ IF(NEED_LIB_M)
SET(MAIKO_LIBRARIES m)
ENDIF()

IF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBBSD-OVERLAY REQUIRED IMPORTED_TARGET "libbsd-overlay")
SET(MAIKO_LIBRARIES ${MAIKO_LIBRARIES} PkgConfig::LIBBSD-OVERLAY)
ENDIF()

SET (MAIKO_RELEASE 351 CACHE STRING "Release version to build. Release: 115, 200, 201, 210, 300, 350, 351")
SET_PROPERTY(CACHE MAIKO_RELEASE PROPERTY STRINGS 115 200 201 210 300 350 351)

Expand Down Expand Up @@ -448,6 +453,7 @@ ADD_CUSTOM_COMMAND(OUTPUT vdate.c
ADD_EXECUTABLE(lde src/ldeboot.c src/unixfork.c)
TARGET_COMPILE_DEFINITIONS(lde PRIVATE ${MAIKO_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(lde PRIVATE inc)
TARGET_LINK_LIBRARIES(lde ${MAIKO_LIBRARIES})
IF(MAIKO_DISPLAY_X11)
# Tell it that the X11 launcher is available.
TARGET_COMPILE_DEFINITIONS(lde PRIVATE ${MAIKO_DISPLAY_X11_DEFINITIONS})
Expand Down Expand Up @@ -528,3 +534,21 @@ TARGET_INCLUDE_DIRECTORIES(setsout PRIVATE inc)
ADD_EXECUTABLE(tstsout src/tstsout.c src/byteswap.c)
TARGET_COMPILE_DEFINITIONS(tstsout PRIVATE ${MAIKO_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(tstsout PRIVATE inc)

# Installation Targets
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/../" CACHE PATH "Installation prefix" FORCE)
ENDIF()
execute_process(
COMMAND sh -c "echo $(../bin/osversion).$(../bin/machinetype)"
OUTPUT_VARIABLE release_dir
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Comment thread
fghalasz marked this conversation as resolved.
INSTALL(TARGETS lde DESTINATION ${release_dir})
IF(MAIKO_DISPLAY_X11)
INSTALL(TARGETS ldex ldeinit DESTINATION ${release_dir})
ENDIF()
IF(MAIKO_DISPLAY_SDL)
INSTALL(TARGETS ldesdl DESTINATION ${release_dir})
ENDIF()
15 changes: 15 additions & 0 deletions bin/linux-common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Common Options for All Linuxes

CC = gcc $(GCC_CFLAGS)
# CC = clang $(CLANG_CFLAGS)

include linux-libbsd.mk

# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) $(BSD_CFLAGS) $(ADDITIONAL_DFLAGS)

LDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)

OBJECTDIR = ../$(RELEASENAME)/
24 changes: 24 additions & 0 deletions bin/linux-libbsd.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Check that pkg-config is available and that the libbsd-dev package is installed
# If one of these is missing, error out
# FGH 2026-03-08
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),cleanup)

CHK_PKG_CONFIG := $(shell command -v pkg-config)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On online.interlisp.org, this fails with:

$ ./makeright x
making release 351 for linux on x86_64.
making with display x releasename linux.x86_64-x ldename ldex
start making lde for linux.x86_64-x
make: command: Command not found
linux-libbsd.mk:10: *** "pkg-config not found. Please install it to build this project.".  Stop.

This may be a case where $(shell which pkg-config) is needed.

ifeq ($(CHK_PKG_CONFIG),)
# pkg-config not found, print an error
$(error "pkg-config not found. Please install it to build this project.")
endif

CHK_LIBBSD_DEV := $(shell pkg-config --exists libbsd-overlay && echo true)
ifneq ($(CHK_LIBBSD_DEV),true)
$(error "libbsd-dev (or libbsd-devel) package not found. Please install it to build this project.")
endif
endif
endif

BSD_CFLAGS = $(shell pkg-config --cflags libbsd-overlay)

BSD_LDFLAGS = $(shell pkg-config --libs libbsd-overlay)


14 changes: 14 additions & 0 deletions bin/linux-sdl.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Common Options for Linux using SDL instead of X Windows

XFILES = $(OBJECTDIR)sdl.o

#
# For SDL version 2
# -DSDL=2 in XFLAGS and -lSDL2 in LDFLAGS
# For SDL version 3
# -DSDL=3 in XFLAGS and -lSDL3 in LDFLAGS
#
XFLAGS = -DSDL=2

XLDFLAGS = -lSDL2

17 changes: 17 additions & 0 deletions bin/linux-x.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Common Options for Linux with X Windows

XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o


XFLAGS = -DXWINDOW

XLDFLAGS = -L/usr/X11/lib -lX11

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I'd note is that we require libx11 version 1.7.0 or later, since we're using XSetIOErrorExitHandler.

25 changes: 4 additions & 21 deletions bin/makefile-init-linux.aarch64
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
# Options for Linux, aarch64 processor, X windows, for INIT processing

CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
include linux-x.mk

XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o


XFLAGS = -DXWINDOW

# OPTFLAGS is normally -O2, for INIT we want unoptimized in case we need to debug it
OPTFLAGS = -O0 -g
DEBUGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT

LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
include linux-common.mk

OBJECTDIR = ../$(RELEASENAME)/
OPTFLAGS = -O0 -g

default : ../$(OSARCHNAME)/ldeinit
25 changes: 4 additions & 21 deletions bin/makefile-init-linux.x86_64
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
# Options for Linux, x86 processor, X windows, for INIT processing

CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
include linux-x.mk

XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o


XFLAGS = -DXWINDOW

# OPTFLAGS is normally -O2, for INIT we want unoptimized in case we need to debug it
OPTFLAGS = -O0 -g
DEBUGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT

LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
include linux-common.mk

OBJECTDIR = ../$(RELEASENAME)/
OPTFLAGS = -O0 -g

default : ../$(OSARCHNAME)/ldeinit
4 changes: 2 additions & 2 deletions bin/makefile-init-wsl1.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ OPTFLAGS = -O0 -g
DEBUGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT -D__wsl1__

LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
Comment thread
fghalasz marked this conversation as resolved.

OBJECTDIR = ../$(RELEASENAME)/

Expand Down
4 changes: 2 additions & 2 deletions bin/makefile-init-wsl1.x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ OPTFLAGS = -O0 -g
DEBUGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT -D__wsl1__

LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd

OBJECTDIR = ../$(RELEASENAME)/

Expand Down
23 changes: 4 additions & 19 deletions bin/makefile-linux.386-sdl
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
# Options for Linux, Intel 386/486 and SDL

CC = gcc -m32 $(GCC_CFLAGS)
# CC = clang $(CLANG_CFLAGS)
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
Comment thread
fghalasz marked this conversation as resolved.

XFILES = $(OBJECTDIR)sdl.o
include linux-sdl.mk

#
# For SDL version 2
# -DSDL=2 in XFLAGS and -lSDL2 in LDFLAGS
# For SDL version 3
# -DSDL=3 in XFLAGS and -lSDL3 in LDFLAGS
#
XFLAGS = -DSDL=2

# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)

LDFLAGS = -lm -lSDL2
LDELDFLAGS =

OBJECTDIR = ../$(RELEASENAME)/
include linux-common.mk

default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
25 changes: 4 additions & 21 deletions bin/makefile-linux.386-x
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
# Options for Linux, Intel 386/486 and X-Window

CC = gcc -m32 $(GCC_CFLAGS)
# CC = clang -m32 $(CLANG_CFLAGS)
GCC_CFLAGS := -m32 $(GCC_CFLAGS)
CLANG_CFLAGS := -m32 $(CLANG_CFLAGS)

XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
include linux-x.mk

XFLAGS = -DXWINDOW

# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)

LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm

OBJECTDIR = ../$(RELEASENAME)/
include linux-common.mk

default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
22 changes: 2 additions & 20 deletions bin/makefile-linux.aarch64-sdl
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
# Options for Linux, ARM64 and SDL

CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
include linux-sdl.mk

XFILES = $(OBJECTDIR)sdl.o

#
# For SDL version 2
# -DSDL=2 in SDLFLAGS and -lSDL2 in LDFLAGS
# For SDL version 3
# -DSDL=3 in SDLFLAGS and -lSDL3 in LDFLAGS
#
SDLFLAGS = -DSDL=2

# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(SDLFLAGS) -DRELEASE=$(RELEASE)

LDFLAGS = -lSDL2 -lm
LDELDFLAGS =

OBJECTDIR = ../$(RELEASENAME)/
include linux-common.mk

default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
24 changes: 2 additions & 22 deletions bin/makefile-linux.aarch64-x
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
# Options for Linux, aarch64 and X-Window

CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
include linux-x.mk

XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o

XFLAGS = -DXWINDOW

# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)

LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm

OBJECTDIR = ../$(RELEASENAME)/
include linux-common.mk

default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
22 changes: 2 additions & 20 deletions bin/makefile-linux.armv7l-sdl
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
# Options for Linux, ARMv7 and SDL

CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
include linux-sdl.mk

XFILES = $(OBJECTDIR)sdl.o

#
# For SDL version 2
# -DSDL=2 in XFLAGS and -lSDL2 in LDFLAGS
# For SDL version 3
# -DSDL=3 in XFLAGS and -lSDL3 in LDFLAGS
#
XFLAGS = -DSDL=2

# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)

LDFLAGS = -lm -lSDL2
LDELDFLAGS =

OBJECTDIR = ../$(RELEASENAME)/
include linux-common.mk

default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
Loading