Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6f1f944
configure: locate scripts/ relative to the wrapper, not the CWD
dlmiles Jul 22, 2026
5e9423f
build: make configure relocatable (out-of-tree)
dlmiles Jul 22, 2026
1fba029
build: VPATH-enable shared make machinery (out-of-tree)
dlmiles Jul 22, 2026
5a8c266
build: top Makefile.in + build-dir orchestration (out-of-tree)
dlmiles Jul 22, 2026
9c8c959
build: out-of-tree outlier Makefiles — full make + install
dlmiles Jul 22, 2026
1a31a92
gitignore: ignore generated top-level Makefile and config.status
dlmiles Jul 22, 2026
527c4e9
build: out-of-tree .so variants, oa, and latexfiles PS regen
dlmiles Jul 22, 2026
9cf634c
build: WASM post-build.sh from the source tree (out-of-tree)
dlmiles Jul 22, 2026
222b39e
build: WASM --embed-file paths per source/build tree (out-of-tree)
dlmiles Jul 22, 2026
5342474
build: WASM npm build runs out-of-source (out-of-tree)
dlmiles Jul 22, 2026
13cd0e9
gitignore: ignore out-of-source WASM build dirs (out-of-tree)
dlmiles Jul 22, 2026
395d26b
wasm: force TCL select() notifier (Emscripten has no working epoll)
dlmiles Jul 22, 2026
05c806e
build: auto-detect latex/dvips and regenerate docs in default make
dlmiles Jul 22, 2026
1689e40
appimage: install texlive so the images regenerate + ship docs
dlmiles Jul 22, 2026
27b22f3
ext2sim: fix native "finds" build; drop phantom sim2simp target
dlmiles Jul 22, 2026
ad68570
build: fix bundled-readline out-of-tree (unblocks the non-Tcl build)
dlmiles Jul 22, 2026
1152893
ci: build the Tcl auto-load modules and add a non-Tcl build job
dlmiles Jul 22, 2026
0c49e3f
build: put the generated header under include/ for relocated builds
dlmiles Jul 22, 2026
35be746
build: add "make prepare" and use it in docs/CI instead of database.h…
dlmiles Jul 22, 2026
33c1513
build: generate <magic/autoconf/config.h> from configure
dlmiles Jul 22, 2026
6a3b49c
build: accept @srcdir@-substituted subdir Makefiles
dlmiles Jul 22, 2026
2dc8c5e
build: generate tiles/Makefile from tiles/Makefile.in (rename unit)
dlmiles Jul 22, 2026
1401a89
build: tiles/Makefile.in uses @srcdir@ substitution
dlmiles Jul 22, 2026
5117031
build: generate 21 standard-module Makefiles from Makefile.in (rename…
dlmiles Jul 22, 2026
1f11e92
build: standard-module Makefile.in use @srcdir@ substitution
dlmiles Jul 22, 2026
4af25de
build: generate near-standard + outlier Makefiles from Makefile.in (r…
dlmiles Jul 22, 2026
3e333c9
build: near-standard + outlier Makefile.in use @srcdir@
dlmiles Jul 22, 2026
372e94d
build: generate magic/tcltk/scmos/doc/lisp Makefiles from Makefile.in…
dlmiles Jul 22, 2026
befc974
build: magic/tcltk/scmos/doc/lisp Makefile.in use @srcdir@
dlmiles Jul 22, 2026
c40f609
build: convert nested children + rewire parent recursion to native
dlmiles Jul 22, 2026
7892686
build: nested-child Makefile.in use @srcdir@
dlmiles Jul 22, 2026
a91cc7f
build: doc/html install ships only content, not build files
dlmiles Jul 22, 2026
2677409
build: make the -f recursion path readline-specific
dlmiles Jul 22, 2026
7382926
build: reduce the srcdir derivation to a minimal fallback
dlmiles Jul 22, 2026
21707f5
build: include rules.mak from source, drop the build-top copy
dlmiles Jul 22, 2026
0e2896e
build: declarative subdir recursion, no for-loops/FORCE
dlmiles Jul 22, 2026
fb274e2
build: -j correctness — database archive edge + serial docs
dlmiles Jul 22, 2026
e956a60
doc: fix maint1.tex LaTeX errors so it compiles (docs 28/28)
dlmiles Jul 23, 2026
ac67b0d
build: make the psfigures symlink source-safe and -j-safe
dlmiles Jul 23, 2026
fcd6c02
wasm: pin INCOMING_MODULE_JS_API (fixes wasmBinary abort on emsdk 6.x)
dlmiles Jul 23, 2026
d2d985d
wasm: embed scmos display styles/colour maps (fix out-of-source init)
dlmiles Jul 23, 2026
1376e04
gitignore: ignore npm/examples/output-tcl/ (tcl smoke-test output)
dlmiles Jul 23, 2026
3cf0ace
build: isolate build-info defines into utils/buildinfo.c (ccache-frie…
dlmiles Jul 23, 2026
e9482e4
build: honor SOURCE_DATE_EPOCH for the build date; graceful git fallback
dlmiles Jul 23, 2026
6834fdd
build: add --disable-magic-builddate (reproducible, ccache-stable bui…
dlmiles Jul 23, 2026
cd282aa
build: autodetect ccache (configure --disable-ccache to opt out)
dlmiles Jul 23, 2026
ec418db
build: --enable-ccache-prefix-map for cross-tree ccache sharing
dlmiles Jul 23, 2026
5d2321c
doc: document --disable-magic-builddate and the ccache options in INS…
dlmiles Jul 23, 2026
cfb6963
build: per-file automatic dependencies (.deps), retire the Depend/sed…
dlmiles Jul 23, 2026
bd6e629
build: remove the depend phase/barrier from the top Makefile
dlmiles Jul 23, 2026
035692d
build: address code-review findings (low-risk cleanups)
dlmiles Jul 23, 2026
b3ffc11
build: detect GNU/BSD date at configure time for SOURCE_DATE_EPOCH
dlmiles Jul 23, 2026
7cb1c87
build: enforce LF on build inputs via .gitattributes; drop sed CR-str…
dlmiles Jul 23, 2026
ce18d18
build: compute version/commit/date once, not per sub-make recursion
dlmiles Jul 23, 2026
8904bb9
doc: note coreutils/gdate is optional on macOS (INSTALL_MacOS.md)
dlmiles Jul 23, 2026
c5d94c9
build: require system readline (or Tcl); drop the bundled fallback (P…
dlmiles Jul 23, 2026
a040643
build: serialize module@X/lib@X per directory to fix a -j race
dlmiles Jul 23, 2026
7ca2e0a
build: remove bundled-readline wiring from the Makefiles (Patch 2)
dlmiles Jul 23, 2026
72c010e
build: remove the bundled readline/ subdirectory (Patch 3)
dlmiles Jul 23, 2026
0b1171e
tcltk: honor CAD_ROOT for the Tcl runtime dir, not just the baked TCL…
dlmiles Jul 23, 2026
5e26b32
build: add run_magic*.sh launchers to run magic from the build tree
dlmiles Jul 23, 2026
8afa134
build: document run_magic* launchers, template WISH/TCLSH, validate t…
dlmiles Jul 23, 2026
b4aa0c9
build: let run_magic_gdb/valgrind take tool options via a "--" separator
dlmiles Jul 23, 2026
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
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@
Makefile filter=header

*.gds diff=gds

# Keep build/shell scripts and makefiles LF even when checked out on Windows
# (git core.autocrlf=true), or the shell and make reject CRLF. .gitattributes
# overrides core.autocrlf, so this is the authoritative fix and the WASM build
# (npm/build.sh) no longer needs to strip CRs from the source tree.
/configure text eol=lf
/scripts/** text eol=lf
*.sh text eol=lf
*.mak text eol=lf
*.mak.in text eol=lf
Makefile.in text eol=lf
14 changes: 7 additions & 7 deletions .github/workflows/canary-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
os: [ubuntu-26.04, ubuntu-24.04, ubuntu-22.04]
# Configure Options
# X11 OGL CAIRO
pkgs: [all, none, no_tk_tcl_rl, no_tk_tcl_brl, no_zlib, no_gc_gl_gu, no_gc, no_gl_gu]
pkgs: [all, none, no_tk_tcl_rl, no_zlib, no_gc_gl_gu, no_gc, no_gl_gu]
# Toolchain:
# ubuntu-20.04 [gcc-9, clang-10] # gcc-7 .. gcc-10 / clang-7 .. clang-12 + clang-18
# ubuntu-22.04 [gcc-11, clang-14] # gcc-9 .. gcc-12 / clang-11 .. clang-15
Expand Down Expand Up @@ -110,7 +110,6 @@ jobs:
# z no.*_zl zlib1g-dev
# n no.*_nc libncurses-dev
# r no.*_rl libreadline-dev
# R no.*_brl --enable-readline-bundled
# c no.*_tcl tcl-dev
# k no.*_tk tk-dev
# C no.*_gc libcairo-dev
Expand All @@ -121,8 +120,6 @@ jobs:
pkgs=$(echo -n "$pkgs" | sed -e 's#z##'); fi
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_nc"; then
pkgs=$(echo -n "$pkgs" | sed -e 's#n##'); fi
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_brl"; then
pkgs=$(echo -n "$pkgs" | sed -e 's#r#R#'); fi # replace
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_rl"; then
pkgs=$(echo -n "$pkgs" | sed -e 's#r##'); fi
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_tcl"; then
Expand Down Expand Up @@ -153,10 +150,13 @@ jobs:

#
_configure_args=()
# "none" installs no dev packages (no libreadline-dev among them). Since
# configure now requires system readline for a non-Tcl build (unless told
# otherwise), the minimal "none" build must pass --disable-readline.
if [ "${MATRIX_PKGS}" = "none" ]; then
_configure_args+=(--disable-readline); fi
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_zl"; then
_configure_args+=(--disable-compression); fi
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_brl"; then
_configure_args+=(--enable-readline-bundled); fi
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_rl"; then
_configure_args+=(--disable-readline); fi
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_tcl"; then
Expand Down Expand Up @@ -285,7 +285,7 @@ jobs:
#sed -e 's# -Werror=# -Wno-unused-local-typedefs -Werror=#' -i defs.mak
#sed -e 's# -Werror=# -Wno-unused-label -Werror=#' -i defs.mak
#sed -e 's# -Werror=# -Wno-unused-but-set-variable -Werror=#' -i defs.mak
make database/database.h
make prepare
make -j$(nproc) 2>&1 | tee MAKE.LOG

- name: Summary
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/main-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ jobs:
- name: Get Dependencies
run: |
sudo apt-get update
sudo apt-get install -y tcl-dev tk-dev libcairo-dev
sudo apt-get install -y tcl-dev tk-dev libcairo-dev \
texlive-latex-base texlive-latex-recommended texlive-fonts-recommended
- name: Build
run: |
./configure
make database/database.h
make prepare
make -j$(nproc)
4 changes: 2 additions & 2 deletions .github/workflows/main-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
cat defs.mak
echo "===== defs.mak ====="

make database/database.h
make prepare
make -j$(sysctl -n hw.ncpu) 2>&1 | tee MAKE.LOG

- name: Install
Expand Down Expand Up @@ -361,7 +361,7 @@ jobs:
cat defs.mak
echo "===== defs.mak ====="

make database/database.h
make prepare
make -j$(sysctl -n hw.ncpu) 2>&1 | tee MAKE.LOG

- name: Install
Expand Down
38 changes: 36 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,43 @@ jobs:
- name: Get Dependencies
run: |
sudo apt-get update
sudo apt-get install -y tcl-dev tk-dev libcairo-dev
# tcl/tk + cairo for the build; texlive (latex + dvips) so the default
# "make" also regenerates the PostScript documentation. Docs are
# best-effort — a missing texlive package just falls back to the
# pre-built PostScript, it does not fail the build.
sudo apt-get install -y tcl-dev tk-dev libcairo-dev \
texlive-latex-base texlive-latex-recommended texlive-fonts-recommended
- name: Build
run: |
./configure
make database/database.h
make prepare
make -j$(nproc)
- name: Build Tcl auto-load modules
# These per-module Tcl shared libraries are real products but are not
# part of the default target (their modules are not in PROGRAMS), so
# build them explicitly to keep them from bit-rotting.
run: |
for m in lef plot router ext2spice ext2sim; do
make -C "$m" tcl-main
done

standard_build_linux:
# Non-Tcl "standard" configuration: native magic binary + system GNU
# readline. Distinct code paths (MAGIC_WRAPPER off, readline) that the Tcl
# build above does not exercise.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Get Dependencies
# X11 + cairo for graphics; readline (the non-Tcl line editor) + its
# ncurses dependency; texlive for the docs. NB: package set not validated
# on the runner -- adjust if the build cannot find a library.
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libcairo-dev libreadline-dev libncurses-dev \
texlive-latex-base texlive-latex-recommended texlive-fonts-recommended
- name: Build (non-Tcl / standard)
run: |
./configure --without-tcl --without-opengl
make prepare
make -j$(nproc)
85 changes: 83 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,84 @@ config.log
scripts/config.log
scripts/config.status
scripts/defs.mak
# Generated at the build top (in-tree = source top): the top Makefile is now
# produced from Makefile.in, and config.status runs in the build directory.
/Makefile
/config.status
# Build-tree launch helpers (configure-generated) + the CAD_ROOT symlink tree they
# stage; in-tree these land in the source root.
/run_magic.sh
/run_magicnull.sh
/run_magic_gdb.sh
/run_magic_valgrind.sh
/magic_run_common.sh
/CAD_DIR/
install.log
make.log
reconfigure.sh

# Generated per-directory Makefiles (Makefile.in migration). POLICY: whenever a
# module's Makefile becomes a configure-generated Makefile.in, add its
# "<dir>/Makefile" here in the *same commit*, so an in-tree build never lets a
# generated Makefile be committed. (Top-level /Makefile is handled above.)
# --- converted dirs below ---
tiles/Makefile
bplane/Makefile
calma/Makefile
cif/Makefile
cmwind/Makefile
dbwind/Makefile
debug/Makefile
drc/Makefile
extflat/Makefile
extract/Makefile
garouter/Makefile
gcr/Makefile
grouter/Makefile
irouter/Makefile
mzrouter/Makefile
netmenu/Makefile
plow/Makefile
resis/Makefile
select/Makefile
sim/Makefile
textio/Makefile
wiring/Makefile
utils/Makefile
windows/Makefile
commands/Makefile
database/Makefile
lef/Makefile
plot/Makefile
router/Makefile
ext2spice/Makefile
ext2sim/Makefile
extcheck/Makefile
net2ir/Makefile
graphics/Makefile
oa/Makefile
magic/Makefile
tcltk/Makefile
scmos/Makefile
doc/Makefile
lisp/Makefile
scmos/cif_template/Makefile
doc/man/Makefile
doc/tutcells/Makefile
doc/html/Makefile
doc/latexfiles/Makefile

# Compiled objects / libraries
*.o
*.a
*.so
*/Depend
*/Depend*.tmp
# Per-file dependency fragments (in-tree they land in each source module dir;
# out-of-tree they are under the build dir). Replaces the old */Depend files.
.deps/
database/database.h
# autoconf config header, generated by ./configure (in-tree location; out-of-tree
# it lives under the build dir's include/ and is covered by the build-dir rules).
magic/autoconf/config.h

# Editor / OS cruft
.*.swp
Expand Down Expand Up @@ -57,16 +123,31 @@ magic/magic.js.symbols
magic/magic.symbols
magic/magic.wasm
build-tcl-wasm/
# Out-of-source WASM build directories created by npm/build.sh (one per variant;
# fixed names build-wasm-<tcl|notcl>). Disposable, recreated each run.
build-wasm-tcl/
build-wasm-notcl/
net2ir/net2ir
net2ir/net2ir.js
net2ir/net2ir.wasm

# Generated test output
npm/examples/output/
npm/examples/output-tcl/

# AI stuff
.claude/
.claude_agent/
.claudeignore
CLAUDE.md
CLAUDE.local.md
# LaTeX documentation build artifacts (an in-tree "make" regenerates the
# PostScript here when latex+dvips are installed; out-of-tree these live in the
# build dir instead). The pre-built PostScript under doc/psfiles/ stays tracked.
doc/latexfiles/psfiles/
doc/latexfiles/*.dvi
doc/latexfiles/*.aux
doc/latexfiles/*.log

# Out-of-tree build directory (generated; was accidentally committed in e7fd0e90)
/build-alt/
27 changes: 27 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,33 @@ Autoconf Capsule Summary:
.mag files. Normally enabled, if the zlib
development package is installed.

--disable-magic-builddate
Omit the build date/time from the binary. The date
is normally baked in (reported by "magic --version"
and written into some output files); omitting it makes
the build reproducible -- two builds of the same commit
then produce byte-identical objects and binaries, with
no dependence on when they were built. (It also keeps
ccache fully effective during development, since the
date is the one compile input that changes every
second.) Normally enabled.

--disable-ccache
Do not use ccache even if it is installed. When
ccache is found on PATH it is auto-detected and used
to speed up recompiles (the build date is isolated to
one object so it does not spoil the cache); this
turns that off.

--enable-ccache-prefix-map
Relativize the source paths embedded in compiled
objects so a ccache cache can be shared across
different checkouts / build directories. Off by
default (it makes debugger source paths relative, so
gdb needs "set substitute-path . <srcdir>"). Only
meaningful with ccache, and cross-tree cache hits also
need CCACHE_BASEDIR=<build dir> set in the environment.

Notes to Magic maintainers:
--------------------------

Expand Down
7 changes: 6 additions & 1 deletion INSTALL_MacOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ brew install cairo tcl-tk@8 python3 gnu-sed
brew install --cask xquartz
./scripts/configure_mac
# If you have both TCL8 and TCL9 installed you may need to verify which was selected.
make database/database.h
make prepare
make -j$(sysctl -n hw.ncpu)
make install # may need sudo depending on your setup
```

> Optional: `coreutils` (for GNU `gdate`) is **not required** — reproducible
> `SOURCE_DATE_EPOCH` builds work with the native BSD `date` too, and `configure`
> auto-detects either. Install it (`brew install coreutils`) only if you prefer
> GNU `date`.

## Without Brew
Get [XQuartz](https://github.com/XQuartz/XQuartz)

Expand Down
Loading
Loading