mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	Get the executables building on WSL2 Fedora.
This commit is contained in:
		
							
								
								
									
										41
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								Makefile
									
									
									
									
									
								
							| @@ -1,9 +1,37 @@ | |||||||
| CC = gcc | export BUILDTYPE | ||||||
| CXX = g++ -std=c++17 | BUILDTYPE ?= host | ||||||
| CFLAGS = -g -O3 |  | ||||||
| LDFLAGS = |  | ||||||
|  |  | ||||||
| OBJ = .obj | ifeq ($(BUILDTYPE),windows) | ||||||
|  | 	MINGW = i686-w64-mingw32- | ||||||
|  | 	CC = $(MINGW)gcc | ||||||
|  | 	CXX = $(MINGW)g++ -std=c++17 | ||||||
|  | 	CFLAGS += -g -O3 | ||||||
|  | 	CXXFLAGS += \ | ||||||
|  | 		-fext-numeric-literals \ | ||||||
|  | 		-Wno-deprecated-enum-float-conversion \ | ||||||
|  | 		-Wno-deprecated-enum-enum-conversion | ||||||
|  | 	LDFLAGS += -static | ||||||
|  | 	AR = $(MINGW)ar | ||||||
|  | 	PKG_CONFIG = $(MINGW)pkg-config -static | ||||||
|  | 	WINDRES = $(MINGW)windres | ||||||
|  | 	WX_CONFIG = /usr/i686-w64-mingw32/sys-root/mingw/bin/wx-config-3.0 --static=yes | ||||||
|  | 	EXT = .exe | ||||||
|  | else | ||||||
|  | 	CC = gcc | ||||||
|  | 	CXX = g++ -std=c++17 | ||||||
|  | 	CFLAGS = -g -O3 | ||||||
|  | 	LDFLAGS = | ||||||
|  | 	AR = ar | ||||||
|  | 	PKG_CONFIG = pkg-config | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | HOSTCC = gcc | ||||||
|  | HOSTCXX = g++ -std=c++17 | ||||||
|  | HOSTCFLAGS = -g -O3 | ||||||
|  | HOSTLDFLAGS = | ||||||
|  |  | ||||||
|  | REALOBJ = .obj | ||||||
|  | OBJ = $(REALOBJ)/$(BUILDTYPE) | ||||||
| DESTDIR ?= | DESTDIR ?= | ||||||
| PREFIX ?= /usr/local | PREFIX ?= /usr/local | ||||||
| BINDIR ?= $(PREFIX)/bin | BINDIR ?= $(PREFIX)/bin | ||||||
| @@ -54,6 +82,9 @@ README.md: $(OBJ)/scripts/+mkdocindex/+mkdocindex$(EXT) | |||||||
| .PHONY: install install-bin | .PHONY: install install-bin | ||||||
| install:: all install-bin | install:: all install-bin | ||||||
|  |  | ||||||
|  | clean:: | ||||||
|  | 	$(hide) rm -rf $(REALOBJ) | ||||||
|  |  | ||||||
| install-bin: | install-bin: | ||||||
| 	@echo "INSTALL" | 	@echo "INSTALL" | ||||||
| 	$(hide) install -D -v "$(OBJ)/src+fluxengine/src+fluxengine" "$(DESTDIR)$(BINDIR)/fluxengine" | 	$(hide) install -D -v "$(OBJ)/src+fluxengine/src+fluxengine" "$(DESTDIR)$(BINDIR)/fluxengine" | ||||||
|   | |||||||
							
								
								
									
										78
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										78
									
								
								README.md
									
									
									
									
									
								
							| @@ -103,45 +103,45 @@ particular filesystem and can read (and sometimes write, support varies) files | |||||||
| directly from disks, flux files or disk images. Some formats have multiple | directly from disks, flux files or disk images. Some formats have multiple | ||||||
| choices because they can store multiple types of file system. | choices because they can store multiple types of file system. | ||||||
|  |  | ||||||
| <!-- FORMATSSTART --> | <!-- FORMATSSTART --> | ||||||
| <!-- This section is automatically generated. Do not edit. --> | <!-- This section is automatically generated. Do not edit. --> | ||||||
|  |  | ||||||
| | Profile | Format | Read? | Write? | Filesystem? | | | Profile | Format | Read? | Write? | Filesystem? | | ||||||
| |:--------|:-------|:-----:|:------:|:------------| | |:--------|:-------|:-----:|:------:|:------------| | ||||||
| | [`acornadfs`](doc/disk-acornadfs.md) | Acorn ADFS: BBC Micro, Archimedes | 🦖 |  |  | | | [`acornadfs`](doc/disk-acornadfs.md) | Acorn ADFS: BBC Micro, Archimedes | 🦖 |  |  | | ||||||
| | [`acorndfs`](doc/disk-acorndfs.md) | Acorn DFS: Acorn Atom, BBC Micro series | 🦄 |  | ACORNDFS  | | | [`acorndfs`](doc/disk-acorndfs.md) | Acorn DFS: Acorn Atom, BBC Micro series | 🦄 |  | ACORNDFS  | | ||||||
| | [`aeslanier`](doc/disk-aeslanier.md) | AES Lanier "No Problem": 616kB 5.25" 77-track SSDD hard sectored | 🦖 |  |  | | | [`aeslanier`](doc/disk-aeslanier.md) | AES Lanier "No Problem": 616kB 5.25" 77-track SSDD hard sectored | 🦖 |  |  | | ||||||
| | [`agat`](doc/disk-agat.md) | Agat: 840kB 5.25" 80-track DS | 🦖 | 🦖 |  | | | [`agat`](doc/disk-agat.md) | Agat: 840kB 5.25" 80-track DS | 🦖 | 🦖 |  | | ||||||
| | [`amiga`](doc/disk-amiga.md) | Amiga: 880kB 3.5" DSDD | 🦄 | 🦄 | AMIGAFFS  | | | [`amiga`](doc/disk-amiga.md) | Amiga: 880kB 3.5" DSDD | 🦄 | 🦄 | AMIGAFFS  | | ||||||
| | [`ampro`](doc/disk-ampro.md) | Ampro Little Board: CP/M | 🦖 |  | CPMFS  | | | [`ampro`](doc/disk-ampro.md) | Ampro Little Board: CP/M | 🦖 |  | CPMFS  | | ||||||
| | [`apple2`](doc/disk-apple2.md) | Apple II: Prodos, Appledos, and CP/M | 🦄 | 🦄 | APPLEDOS CPMFS PRODOS  | | | [`apple2`](doc/disk-apple2.md) | Apple II: Prodos, Appledos, and CP/M | 🦄 | 🦄 | APPLEDOS CPMFS PRODOS  | | ||||||
| | [`atarist`](doc/disk-atarist.md) | Atari ST: Almost PC compatible | 🦄 | 🦄 |  | | | [`atarist`](doc/disk-atarist.md) | Atari ST: Almost PC compatible | 🦄 | 🦄 |  | | ||||||
| | [`bk`](doc/disk-bk.md) | BK: 800kB 5.25"/3.5" 80-track 10-sector DSDD | 🦖 | 🦖 |  | | | [`bk`](doc/disk-bk.md) | BK: 800kB 5.25"/3.5" 80-track 10-sector DSDD | 🦖 | 🦖 |  | | ||||||
| | [`brother`](doc/disk-brother.md) | Brother word processors: GCR family | 🦄 | 🦄 | BROTHER120 FATFS  | | | [`brother`](doc/disk-brother.md) | Brother word processors: GCR family | 🦄 | 🦄 | BROTHER120 FATFS  | | ||||||
| | [`commodore`](doc/disk-commodore.md) | Commodore: 1541, 1581, 8050 and variations | 🦄 | 🦄 | CBMFS  | | | [`commodore`](doc/disk-commodore.md) | Commodore: 1541, 1581, 8050 and variations | 🦄 | 🦄 | CBMFS  | | ||||||
| | [`eco1`](doc/disk-eco1.md) | VDS Eco1: CP/M; 1210kB 77-track mixed format DSHD | 🦖 |  | CPMFS  | | | [`eco1`](doc/disk-eco1.md) | VDS Eco1: CP/M; 1210kB 77-track mixed format DSHD | 🦖 |  | CPMFS  | | ||||||
| | [`epsonpf10`](doc/disk-epsonpf10.md) | Epson PF-10: CP/M; 3.5" 40-track DSDD | 🦖 |  | CPMFS  | | | [`epsonpf10`](doc/disk-epsonpf10.md) | Epson PF-10: CP/M; 3.5" 40-track DSDD | 🦖 |  | CPMFS  | | ||||||
| | [`f85`](doc/disk-f85.md) | Durango F85: 461kB 5.25" 77-track SS | 🦖 |  |  | | | [`f85`](doc/disk-f85.md) | Durango F85: 461kB 5.25" 77-track SS | 🦖 |  |  | | ||||||
| | [`fb100`](doc/disk-fb100.md) | Brother FB-100: 100kB 3.5" 40-track SSSD | 🦖 |  |  | | | [`fb100`](doc/disk-fb100.md) | Brother FB-100: 100kB 3.5" 40-track SSSD | 🦖 |  |  | | ||||||
| | [`hplif`](doc/disk-hplif.md) | Hewlett-Packard LIF: a variety of disk formats used by HP | 🦄 | 🦄 | LIF  | | | [`hplif`](doc/disk-hplif.md) | Hewlett-Packard LIF: a variety of disk formats used by HP | 🦄 | 🦄 | LIF  | | ||||||
| | [`ibm`](doc/disk-ibm.md) | IBM PC: Generic PC 3.5"/5.25" disks | 🦄 | 🦄 | FATFS  | | | [`ibm`](doc/disk-ibm.md) | IBM PC: Generic PC 3.5"/5.25" disks | 🦄 | 🦄 | FATFS  | | ||||||
| | [`icl30`](doc/disk-icl30.md) | ICL Model 30: CP/M; 263kB 35-track DSSD | 🦖 |  | CPMFS  | | | [`icl30`](doc/disk-icl30.md) | ICL Model 30: CP/M; 263kB 35-track DSSD | 🦖 |  | CPMFS  | | ||||||
| | [`mac`](doc/disk-mac.md) | Macintosh: 400kB/800kB 3.5" GCR | 🦄 | 🦄 | MACHFS  | | | [`mac`](doc/disk-mac.md) | Macintosh: 400kB/800kB 3.5" GCR | 🦄 | 🦄 | MACHFS  | | ||||||
| | [`micropolis`](doc/disk-micropolis.md) | Micropolis: 100tpi MetaFloppy disks | 🦄 | 🦄 |  | | | [`micropolis`](doc/disk-micropolis.md) | Micropolis: 100tpi MetaFloppy disks | 🦄 | 🦄 |  | | ||||||
| | [`ms2000`](doc/disk-ms2000.md) | : MS2000 Microdisk Development System |  |  | MICRODOS  | | | [`ms2000`](doc/disk-ms2000.md) | : MS2000 Microdisk Development System |  |  | MICRODOS  | | ||||||
| | [`mx`](doc/disk-mx.md) | DVK MX: Soviet-era PDP-11 clone | 🦖 |  |  | | | [`mx`](doc/disk-mx.md) | DVK MX: Soviet-era PDP-11 clone | 🦖 |  |  | | ||||||
| | [`n88basic`](doc/disk-n88basic.md) | N88-BASIC: PC8800/PC98 5.25" 77-track 26-sector DSHD | 🦄 | 🦄 |  | | | [`n88basic`](doc/disk-n88basic.md) | N88-BASIC: PC8800/PC98 5.25" 77-track 26-sector DSHD | 🦄 | 🦄 |  | | ||||||
| | [`northstar`](doc/disk-northstar.md) | Northstar: 5.25" hard sectored | 🦄 | 🦄 |  | | | [`northstar`](doc/disk-northstar.md) | Northstar: 5.25" hard sectored | 🦄 | 🦄 |  | | ||||||
| | [`psos`](doc/disk-psos.md) | pSOS: 800kB DSDD with PHILE | 🦄 | 🦄 | PHILE  | | | [`psos`](doc/disk-psos.md) | pSOS: 800kB DSDD with PHILE | 🦄 | 🦄 | PHILE  | | ||||||
| | [`rolandd20`](doc/disk-rolandd20.md) | Roland D20: 3.5" electronic synthesiser disks | 🦄 | 🦖 | ROLAND  | | | [`rolandd20`](doc/disk-rolandd20.md) | Roland D20: 3.5" electronic synthesiser disks | 🦄 | 🦖 | ROLAND  | | ||||||
| | [`rx50`](doc/disk-rx50.md) | Digital RX50: 400kB 5.25" 80-track 10-sector SSDD | 🦖 | 🦖 |  | | | [`rx50`](doc/disk-rx50.md) | Digital RX50: 400kB 5.25" 80-track 10-sector SSDD | 🦖 | 🦖 |  | | ||||||
| | [`smaky6`](doc/disk-smaky6.md) | Smaky 6: 308kB 5.25" 77-track 16-sector SSDD, hard sectored | 🦖 |  | SMAKY6  | | | [`smaky6`](doc/disk-smaky6.md) | Smaky 6: 308kB 5.25" 77-track 16-sector SSDD, hard sectored | 🦖 |  | SMAKY6  | | ||||||
| | [`tids990`](doc/disk-tids990.md) | Texas Instruments DS990: 1126kB 8" DSSD | 🦖 | 🦖 |  | | | [`tids990`](doc/disk-tids990.md) | Texas Instruments DS990: 1126kB 8" DSSD | 🦖 | 🦖 |  | | ||||||
| | [`tiki`](doc/disk-tiki.md) | Tiki 100: CP/M |  |  | CPMFS  | | | [`tiki`](doc/disk-tiki.md) | Tiki 100: CP/M |  |  | CPMFS  | | ||||||
| | [`victor9k`](doc/disk-victor9k.md) | Victor 9000 / Sirius One: 1224kB 5.25" DSDD GCR | 🦖 | 🦖 |  | | | [`victor9k`](doc/disk-victor9k.md) | Victor 9000 / Sirius One: 1224kB 5.25" DSDD GCR | 🦖 | 🦖 |  | | ||||||
| | [`zilogmcz`](doc/disk-zilogmcz.md) | Zilog MCZ: 320kB 8" 77-track SSSD hard-sectored | 🦖 |  | ZDOS  | | | [`zilogmcz`](doc/disk-zilogmcz.md) | Zilog MCZ: 320kB 8" 77-track SSSD hard-sectored | 🦖 |  | ZDOS  | | ||||||
| {: .datatable } | {: .datatable } | ||||||
|  |  | ||||||
| <!-- FORMATSEND --> | <!-- FORMATSEND --> | ||||||
|  |  | ||||||
| ### Notes | ### Notes | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								build.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								build.py
									
									
									
									
									
								
							| @@ -1,7 +1,7 @@ | |||||||
| from build.ab import export | from build.ab import export | ||||||
| from build.c import clibrary, cxxlibrary | from build.c import clibrary, cxxlibrary | ||||||
| from build.protobuf import proto, protocc | from build.protobuf import proto, protocc | ||||||
| from build.pkg import package | from build.pkg import package, hostpackage | ||||||
| from build.utils import test | from build.utils import test | ||||||
| from glob import glob | from glob import glob | ||||||
| import config | import config | ||||||
| @@ -9,9 +9,14 @@ import re | |||||||
|  |  | ||||||
| package(name="protobuf_lib", package="protobuf") | package(name="protobuf_lib", package="protobuf") | ||||||
| package(name="z_lib", package="zlib") | package(name="z_lib", package="zlib") | ||||||
| package(name="fmt_lib", package="fmt") | package(name="fmt_lib", package="fmt", fallback="dep/fmt") | ||||||
| package(name="sqlite3_lib", package="sqlite3") | package(name="sqlite3_lib", package="sqlite3") | ||||||
|  |  | ||||||
|  | hostpackage(name="protobuf_host_lib", package="protobuf") | ||||||
|  | hostpackage(name="z_host_lib", package="zlib") | ||||||
|  | hostpackage(name="fmt_host_lib", package="fmt") | ||||||
|  | hostpackage(name="sqlite3_host_lib", package="sqlite3") | ||||||
|  |  | ||||||
| clibrary(name="protocol", hdrs={"protocol.h": "./protocol.h"}) | clibrary(name="protocol", hdrs={"protocol.h": "./protocol.h"}) | ||||||
|  |  | ||||||
| proto(name="fl2_proto", srcs=["lib/fl2.proto"]) | proto(name="fl2_proto", srcs=["lib/fl2.proto"]) | ||||||
| @@ -211,14 +216,15 @@ cxxlibrary( | |||||||
|     }, |     }, | ||||||
|     deps=[ |     deps=[ | ||||||
|         "+fl2_proto_lib", |         "+fl2_proto_lib", | ||||||
|  |         "+fmt_lib", | ||||||
|         "+protocol", |         "+protocol", | ||||||
|         "lib+config_proto_lib", |  | ||||||
|         "dep/adflib", |         "dep/adflib", | ||||||
|         "dep/agg", |         "dep/agg", | ||||||
|         "dep/fatfs", |         "dep/fatfs", | ||||||
|         "dep/hfsutils", |         "dep/hfsutils", | ||||||
|         "dep/libusbp", |         "dep/libusbp", | ||||||
|         "dep/stb", |         "dep/stb", | ||||||
|  |         "lib+config_proto_lib", | ||||||
|     ], |     ], | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ update-ab: | |||||||
| .PHONY: clean | .PHONY: clean | ||||||
| clean:: | clean:: | ||||||
| 	@echo CLEAN | 	@echo CLEAN | ||||||
| 	$(hide) rm -rf $(OBJ) bin | 	$(hide) rm -rf $(OBJ) | ||||||
|  |  | ||||||
| export PYTHONHASHSEED = 1 | export PYTHONHASHSEED = 1 | ||||||
| build-files = $(shell find . -name 'build.py') $(wildcard build/*.py) $(wildcard config.py) | build-files = $(shell find . -name 'build.py') $(wildcard build/*.py) $(wildcard config.py) | ||||||
|   | |||||||
| @@ -401,6 +401,7 @@ def emitter_endrule(rule, outs): | |||||||
|     emit("\t$(hide) touch", rule.sentinel) |     emit("\t$(hide) touch", rule.sentinel) | ||||||
|  |  | ||||||
|     for f in filenamesof(outs): |     for f in filenamesof(outs): | ||||||
|  |         emit(".SECONDARY:", f) | ||||||
|         emit(f, ":", rule.sentinel, ";") |         emit(f, ":", rule.sentinel, ";") | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										91
									
								
								build/c.py
									
									
									
									
									
								
							
							
						
						
									
										91
									
								
								build/c.py
									
									
									
									
									
								
							| @@ -18,6 +18,26 @@ from os.path import * | |||||||
| from types import SimpleNamespace | from types import SimpleNamespace | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Toolchain: | ||||||
|  |     label = "" | ||||||
|  |     cfile = ["$(CC) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"] | ||||||
|  |     cxxfile = ["$(CXX) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"] | ||||||
|  |     clibrary = ["$(AR) cqs {outs[0]} {ins}"] | ||||||
|  |     cxxlibrary = ["$(AR) cqs {outs[0]} {ins}"] | ||||||
|  |     cprogram = ["$(CC) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"] | ||||||
|  |     cxxprogram = ["$(CXX) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class HostToolchain: | ||||||
|  |     label = "HOST " | ||||||
|  |     cfile = ["$(HOSTCC) -c -o {outs[0]} {ins[0]} $(HOSTCFLAGS) {cflags}"] | ||||||
|  |     cxxfile = ["$(HOSTCXX) -c -o {outs[0]} {ins[0]} $(HOSTCFLAGS) {cflags}"] | ||||||
|  |     clibrary = ["$(HOSTAR) cqs {outs[0]} {ins}"] | ||||||
|  |     cxxlibrary = ["$(HOSTAR) cqs {outs[0]} {ins}"] | ||||||
|  |     cprogram = ["$(HOSTCC) -o {outs[0]} {ins} {ldflags} $(HOSTLDFLAGS)"] | ||||||
|  |     cxxprogram = ["$(HOSTCXX) -o {outs[0]} {ins} {ldflags} $(HOSTLDFLAGS)"] | ||||||
|  |  | ||||||
|  |  | ||||||
| def cfileimpl(self, name, srcs, deps, suffix, commands, label, kind, cflags): | def cfileimpl(self, name, srcs, deps, suffix, commands, label, kind, cflags): | ||||||
|     outleaf = stripext(basename(filenameof(srcs[0]))) + suffix |     outleaf = stripext(basename(filenameof(srcs[0]))) + suffix | ||||||
|  |  | ||||||
| @@ -40,9 +60,14 @@ def cfile( | |||||||
|     deps: Targets = None, |     deps: Targets = None, | ||||||
|     cflags: List = [], |     cflags: List = [], | ||||||
|     suffix=".o", |     suffix=".o", | ||||||
|     commands=["$(CC) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"], |     toolchain=Toolchain, | ||||||
|     label="CC", |     commands=None, | ||||||
|  |     label=None, | ||||||
| ): | ): | ||||||
|  |     if not label: | ||||||
|  |         label = toolchain.label + "CC" | ||||||
|  |     if not commands: | ||||||
|  |         commands = toolchain.cfile | ||||||
|     cfileimpl(self, name, srcs, deps, suffix, commands, label, "cfile", cflags) |     cfileimpl(self, name, srcs, deps, suffix, commands, label, "cfile", cflags) | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -54,15 +79,20 @@ def cxxfile( | |||||||
|     deps: Targets = None, |     deps: Targets = None, | ||||||
|     cflags: List = [], |     cflags: List = [], | ||||||
|     suffix=".o", |     suffix=".o", | ||||||
|     commands=["$(CXX) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"], |     toolchain=Toolchain, | ||||||
|     label="CXX", |     commands=None, | ||||||
|  |     label=None, | ||||||
| ): | ): | ||||||
|  |     if not label: | ||||||
|  |         label = toolchain.label + "CC" | ||||||
|  |     if not commands: | ||||||
|  |         commands = toolchain.cfile | ||||||
|     cfileimpl( |     cfileimpl( | ||||||
|         self, name, srcs, deps, suffix, commands, label, "cxxfile", cflags |         self, name, srcs, deps, suffix, commands, label, "cxxfile", cflags | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|  |  | ||||||
| def findsources(name, srcs, deps, cflags, filerule): | def findsources(name, srcs, deps, cflags, toolchain, filerule): | ||||||
|     objs = [] |     objs = [] | ||||||
|     for s in flatten(srcs): |     for s in flatten(srcs): | ||||||
|         objs += [ |         objs += [ | ||||||
| @@ -71,6 +101,7 @@ def findsources(name, srcs, deps, cflags, filerule): | |||||||
|                 srcs=[f], |                 srcs=[f], | ||||||
|                 deps=deps, |                 deps=deps, | ||||||
|                 cflags=cflags, |                 cflags=cflags, | ||||||
|  |                 toolchain=toolchain, | ||||||
|             ) |             ) | ||||||
|             for f in filenamesof(s) |             for f in filenamesof(s) | ||||||
|             if f.endswith(".c") |             if f.endswith(".c") | ||||||
| @@ -131,6 +162,7 @@ def libraryimpl( | |||||||
|     caller_ldflags, |     caller_ldflags, | ||||||
|     cflags, |     cflags, | ||||||
|     ldflags, |     ldflags, | ||||||
|  |     toolchain, | ||||||
|     commands, |     commands, | ||||||
|     label, |     label, | ||||||
|     kind, |     kind, | ||||||
| @@ -159,6 +191,7 @@ def libraryimpl( | |||||||
|         srcs, |         srcs, | ||||||
|         targetswithtraitsof(deps, "cheaders"), |         targetswithtraitsof(deps, "cheaders"), | ||||||
|         cflags + bubbledattrsof(deps, "caller_cflags"), |         cflags + bubbledattrsof(deps, "caller_cflags"), | ||||||
|  |         toolchain, | ||||||
|         kind, |         kind, | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
| @@ -188,10 +221,15 @@ def clibrary( | |||||||
|     caller_ldflags: List = [], |     caller_ldflags: List = [], | ||||||
|     cflags: List = [], |     cflags: List = [], | ||||||
|     ldflags: List = [], |     ldflags: List = [], | ||||||
|     commands=["$(AR) cqs {outs[0]} {ins}"], |     toolchain=Toolchain, | ||||||
|     label="LIB", |     commands=None, | ||||||
|  |     label=None, | ||||||
|     cfilerule=cfile, |     cfilerule=cfile, | ||||||
| ): | ): | ||||||
|  |     if not label: | ||||||
|  |         label = toolchain.label + "LIB" | ||||||
|  |     if not commands: | ||||||
|  |         commands = toolchain.clibrary | ||||||
|     libraryimpl( |     libraryimpl( | ||||||
|         self, |         self, | ||||||
|         name, |         name, | ||||||
| @@ -202,6 +240,7 @@ def clibrary( | |||||||
|         caller_ldflags, |         caller_ldflags, | ||||||
|         cflags, |         cflags, | ||||||
|         ldflags, |         ldflags, | ||||||
|  |         toolchain, | ||||||
|         commands, |         commands, | ||||||
|         label, |         label, | ||||||
|         cfilerule, |         cfilerule, | ||||||
| @@ -219,9 +258,14 @@ def cxxlibrary( | |||||||
|     caller_ldflags: List = [], |     caller_ldflags: List = [], | ||||||
|     cflags: List = [], |     cflags: List = [], | ||||||
|     ldflags: List = [], |     ldflags: List = [], | ||||||
|     commands=["$(AR) cqs {outs[0]} {ins}"], |     toolchain=Toolchain, | ||||||
|     label="LIB", |     commands=None, | ||||||
|  |     label=None, | ||||||
| ): | ): | ||||||
|  |     if not label: | ||||||
|  |         label = toolchain.label + "LIB" | ||||||
|  |     if not commands: | ||||||
|  |         commands = toolchain.clibrary | ||||||
|     libraryimpl( |     libraryimpl( | ||||||
|         self, |         self, | ||||||
|         name, |         name, | ||||||
| @@ -232,6 +276,7 @@ def cxxlibrary( | |||||||
|         caller_ldflags, |         caller_ldflags, | ||||||
|         cflags, |         cflags, | ||||||
|         ldflags, |         ldflags, | ||||||
|  |         toolchain, | ||||||
|         commands, |         commands, | ||||||
|         label, |         label, | ||||||
|         cxxfile, |         cxxfile, | ||||||
| @@ -239,19 +284,29 @@ def cxxlibrary( | |||||||
|  |  | ||||||
|  |  | ||||||
| def programimpl( | def programimpl( | ||||||
|     self, name, srcs, deps, cflags, ldflags, commands, label, filerule, kind |     self, | ||||||
|  |     name, | ||||||
|  |     srcs, | ||||||
|  |     deps, | ||||||
|  |     cflags, | ||||||
|  |     ldflags, | ||||||
|  |     toolchain, | ||||||
|  |     commands, | ||||||
|  |     label, | ||||||
|  |     filerule, | ||||||
|  |     kind, | ||||||
| ): | ): | ||||||
|     ars = filenamesmatchingof(deps, "*.a") |     ars = filenamesmatchingof(deps, "*.a") | ||||||
|     deps = deps + filenamesmatchingof(srcs, "*.h") |     deps = deps + filenamesmatchingof(srcs, "*.h") | ||||||
|     ldflags = ldflags + bubbledattrsof(deps, "caller_ldflags") |     ldflags = ldflags + bubbledattrsof(deps, "caller_ldflags") | ||||||
|  |  | ||||||
|     cfiles = findsources(name, srcs, deps, cflags, filerule) |     cfiles = findsources(name, srcs, deps, cflags, toolchain, filerule) | ||||||
|     normalrule( |     normalrule( | ||||||
|         replaces=self, |         replaces=self, | ||||||
|         ins=cfiles + ars + ars, |         ins=cfiles + ars + ars, | ||||||
|         outs=[basename(name) + "$(EXT)"], |         outs=[basename(name) + "$(EXT)"], | ||||||
|         deps=deps, |         deps=deps, | ||||||
|         label=label, |         label=toolchain.label + label, | ||||||
|         commands=commands, |         commands=commands, | ||||||
|         ldflags=ldflags, |         ldflags=ldflags, | ||||||
|     ) |     ) | ||||||
| @@ -265,11 +320,14 @@ def cprogram( | |||||||
|     deps: Targets = None, |     deps: Targets = None, | ||||||
|     cflags: List = [], |     cflags: List = [], | ||||||
|     ldflags: List = [], |     ldflags: List = [], | ||||||
|     commands=["$(CC) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"], |     toolchain=Toolchain, | ||||||
|  |     commands=None, | ||||||
|     label="CLINK", |     label="CLINK", | ||||||
|     cfilerule=cfile, |     cfilerule=cfile, | ||||||
|     cfilekind="cprogram", |     cfilekind="cprogram", | ||||||
| ): | ): | ||||||
|  |     if not commands: | ||||||
|  |         commands = toolchain.cprogram | ||||||
|     programimpl( |     programimpl( | ||||||
|         self, |         self, | ||||||
|         name, |         name, | ||||||
| @@ -277,6 +335,7 @@ def cprogram( | |||||||
|         deps, |         deps, | ||||||
|         cflags, |         cflags, | ||||||
|         ldflags, |         ldflags, | ||||||
|  |         toolchain, | ||||||
|         commands, |         commands, | ||||||
|         label, |         label, | ||||||
|         cfilerule, |         cfilerule, | ||||||
| @@ -292,9 +351,12 @@ def cxxprogram( | |||||||
|     deps: Targets = None, |     deps: Targets = None, | ||||||
|     cflags: List = [], |     cflags: List = [], | ||||||
|     ldflags: List = [], |     ldflags: List = [], | ||||||
|     commands=["$(CXX) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"], |     toolchain=Toolchain, | ||||||
|  |     commands=None, | ||||||
|     label="CXXLINK", |     label="CXXLINK", | ||||||
| ): | ): | ||||||
|  |     if not commands: | ||||||
|  |         commands = toolchain.cxxprogram | ||||||
|     programimpl( |     programimpl( | ||||||
|         self, |         self, | ||||||
|         name, |         name, | ||||||
| @@ -302,6 +364,7 @@ def cxxprogram( | |||||||
|         deps, |         deps, | ||||||
|         cflags, |         cflags, | ||||||
|         ldflags, |         ldflags, | ||||||
|  |         toolchain, | ||||||
|         commands, |         commands, | ||||||
|         label, |         label, | ||||||
|         cxxfile, |         cxxfile, | ||||||
|   | |||||||
							
								
								
									
										44
									
								
								build/pkg.py
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								build/pkg.py
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| from build.ab import Rule, emit, Target, bubbledattrsof | from build.ab import Rule, emit, Target, bubbledattrsof, filenamesof | ||||||
| from types import SimpleNamespace | from types import SimpleNamespace | ||||||
| import os | import os | ||||||
| import subprocess | import subprocess | ||||||
| @@ -7,12 +7,18 @@ emit( | |||||||
|     """ |     """ | ||||||
| PKG_CONFIG ?= pkg-config | PKG_CONFIG ?= pkg-config | ||||||
| PACKAGES := $(shell $(PKG_CONFIG) --list-all | cut -d' ' -f1 | sort) | PACKAGES := $(shell $(PKG_CONFIG) --list-all | cut -d' ' -f1 | sort) | ||||||
|  |  | ||||||
|  | HOST_PKG_CONFIG ?= pkg-config | ||||||
|  | HOST_PACKAGES := $(shell $(HOST_PKG_CONFIG) --list-all | cut -d' ' -f1 | sort) | ||||||
| """ | """ | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  |  | ||||||
| @Rule | @Rule | ||||||
| def package(self, name, package=None, fallback: Target = None): | def package(self, name, package=None, fallback: Target = None): | ||||||
|  |     self.ins = [] | ||||||
|  |     self.outs = [] | ||||||
|  |  | ||||||
|     emit("ifeq ($(filter %s, $(PACKAGES)),)" % package) |     emit("ifeq ($(filter %s, $(PACKAGES)),)" % package) | ||||||
|     if fallback: |     if fallback: | ||||||
|         emit( |         emit( | ||||||
| @@ -23,7 +29,7 @@ def package(self, name, package=None, fallback: Target = None): | |||||||
|             f"PACKAGE_LDFLAGS_{package} := ", |             f"PACKAGE_LDFLAGS_{package} := ", | ||||||
|             bubbledattrsof(fallback, "caller_ldflags"), |             bubbledattrsof(fallback, "caller_ldflags"), | ||||||
|         ) |         ) | ||||||
|         emit(f"PACKAGE_DEP_{package} := ", fallback.name) |         self.outs = filenamesof(fallback) | ||||||
|     else: |     else: | ||||||
|         emit(f"$(error Required package '{package}' not installed.)") |         emit(f"$(error Required package '{package}' not installed.)") | ||||||
|     emit("else") |     emit("else") | ||||||
| @@ -33,11 +39,41 @@ def package(self, name, package=None, fallback: Target = None): | |||||||
|     emit( |     emit( | ||||||
|         f"PACKAGE_LDFLAGS_{package} := $(shell $(PKG_CONFIG) --libs {package})" |         f"PACKAGE_LDFLAGS_{package} := $(shell $(PKG_CONFIG) --libs {package})" | ||||||
|     ) |     ) | ||||||
|     emit(f"PACKAGE_DEP_{package} := ") |  | ||||||
|     emit("endif") |     emit("endif") | ||||||
|  |  | ||||||
|     self.attr.caller_cflags = [f"$(PACKAGE_CFLAGS_{package})"] |     self.attr.caller_cflags = [f"$(PACKAGE_CFLAGS_{package})"] | ||||||
|     self.attr.caller_ldflags = [f"$(PACKAGE_LDFLAGS_{package})"] |     self.attr.caller_ldflags = [f"$(PACKAGE_LDFLAGS_{package})"] | ||||||
|  |     self.traits.add("clibrary") | ||||||
|  |     self.traits.add("cheaders") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @Rule | ||||||
|  | def hostpackage(self, name, package=None, fallback: Target = None): | ||||||
|  |     emit("ifeq ($(filter %s, $(HOST_PACKAGES)),)" % package) | ||||||
|  |     if fallback: | ||||||
|  |         emit( | ||||||
|  |             f"HOST_PACKAGE_CFLAGS_{package} :=", | ||||||
|  |             bubbledattrsof(fallback, "caller_cflags"), | ||||||
|  |         ) | ||||||
|  |         emit( | ||||||
|  |             f"HOST_PACKAGE_LDFLAGS_{package} := ", | ||||||
|  |             bubbledattrsof(fallback, "caller_ldflags"), | ||||||
|  |         ) | ||||||
|  |         emit(f"HOST_PACKAGE_DEP_{package} := ", fallback.name) | ||||||
|  |     else: | ||||||
|  |         emit(f"$(error Required host package '{package}' not installed.)") | ||||||
|  |     emit("else") | ||||||
|  |     emit( | ||||||
|  |         f"HOST_PACKAGE_CFLAGS_{package} := $(shell $(HOST_PKG_CONFIG) --cflags {package})" | ||||||
|  |     ) | ||||||
|  |     emit( | ||||||
|  |         f"HOST_PACKAGE_LDFLAGS_{package} := $(shell $(HOST_PKG_CONFIG) --libs {package})" | ||||||
|  |     ) | ||||||
|  |     emit(f"HOST_PACKAGE_DEP_{package} := ") | ||||||
|  |     emit("endif") | ||||||
|  |  | ||||||
|  |     self.attr.caller_cflags = [f"$(HOST_PACKAGE_CFLAGS_{package})"] | ||||||
|  |     self.attr.caller_ldflags = [f"$(HOST_PACKAGE_LDFLAGS_{package})"] | ||||||
|  |  | ||||||
|     self.ins = [] |     self.ins = [] | ||||||
|     self.outs = [f"$(PACKAGE_DEP_{package})"] |     self.outs = [f"$(HOST_PACKAGE_DEP_{package})"] | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								config.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								config.py
									
									
									
									
									
								
							| @@ -1,5 +1,11 @@ | |||||||
| import platform | import platform | ||||||
|  | import os | ||||||
|  |  | ||||||
| windows = platform.system() == "Windows" | if os.getenv("BUILDTYPE") == "windows": | ||||||
| osx = platform.system() == "Darwin" |     windows = True | ||||||
| unix = not windows |     osx = False | ||||||
|  |     unix = False | ||||||
|  | else: | ||||||
|  |     windows = False | ||||||
|  |     osx = platform.system() == "Darwin" | ||||||
|  |     unix = True | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								dep/fmt/build.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								dep/fmt/build.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | from build.c import cxxlibrary, HostToolchain | ||||||
|  |  | ||||||
|  | cxxlibrary( | ||||||
|  |     name="fmt", | ||||||
|  |     srcs=[ | ||||||
|  |         "./src/format.cc", | ||||||
|  |         "./src/os.cc", | ||||||
|  |     ], | ||||||
|  |     cflags=["-Idep/fmt/include"], | ||||||
|  |     hdrs={ | ||||||
|  |         "fmt/args.h": "./include/fmt/args.h", | ||||||
|  |         "fmt/chrono.h": "./include/fmt/chrono.h", | ||||||
|  |         "fmt/core.h": "./include/fmt/core.h", | ||||||
|  |         "fmt/format.h": "./include/fmt/format.h", | ||||||
|  |         "fmt/ostream.h": "./include/fmt/ostream.h", | ||||||
|  |         "fmt/ranges.h": "./include/fmt/ranges.h", | ||||||
|  |         }) | ||||||
| @@ -61,7 +61,7 @@ clibrary( | |||||||
|     name="libusbp", |     name="libusbp", | ||||||
|     srcs=srcs, |     srcs=srcs, | ||||||
|     cflags=["-Idep/libusbp/include", "-Idep/libusbp/src"], |     cflags=["-Idep/libusbp/include", "-Idep/libusbp/src"], | ||||||
|     ldflags=ldflags, |     caller_ldflags=ldflags, | ||||||
|     deps=deps, |     deps=deps, | ||||||
|     hdrs={ |     hdrs={ | ||||||
|         "libusbp_internal.h": "./src/libusbp_internal.h", |         "libusbp_internal.h": "./src/libusbp_internal.h", | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| from build.ab import Rule, normalrule, Targets | from build.ab import Rule, normalrule, Targets | ||||||
| from build.c import cxxprogram | from build.c import cxxprogram, HostToolchain | ||||||
|  |  | ||||||
| encoders = {} | encoders = {} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,4 +6,4 @@ | |||||||
| #include "winuser.h" | #include "winuser.h" | ||||||
|  |  | ||||||
| CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "src/gui/manifest.xml" | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "src/gui/manifest.xml" | ||||||
| 101 ICON DISCARDABLE ".obj/extras+fluxengine_ico/fluxengine.ico" | 101 ICON DISCARDABLE ".obj/windows/extras/+fluxengine_ico/fluxengine.ico" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user