Skip to content

Commit

Permalink
meson: further work
Browse files Browse the repository at this point in the history
Started top-level build file with pkgconf generator.
  • Loading branch information
stsp committed Dec 6, 2023
1 parent 51aa112 commit d8c966b
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 18 deletions.
1 change: 1 addition & 0 deletions fdpp/kernel/hdr
1 change: 1 addition & 0 deletions fdpp/kernel/include
File renamed without changes.
2 changes: 1 addition & 1 deletion fdpp/kernel/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif
# given the names are fixed. Also $(TARGET).% won't work that way at all:
# you need to explicitly list all files that are created simultaneously,
# and yet use pattern in all of them.
DEPS_OF_ELF = $(srcdir)/$(T)/kernel.ld $(OBJS) $(PPOBJS) $(DOBJS)
DEPS_OF_ELF = $(srcdir)/kernel.ld $(OBJS) $(PPOBJS) $(DOBJS)
need = 4.3
ifneq ($(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need)))),)
$(T)/$(TARGET).elf $(T)/$(TARGET).map &: $(DEPS_OF_ELF)
Expand Down
24 changes: 13 additions & 11 deletions fdpp/kernel/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
project('kernel', ['nasm', 'c'], version: '1.7')
TOP = '../..'
PD = TOP / 'fdpp/parsers/parse_decls.sh'
SRC = TOP / 'kernel'
DSRC = SRC / 'drivers'
kernel_ld = TOP / 'kernel.ld'
rel_inc = TOP / 'include/fdpp'
PD = 'parsers/parse_decls.sh'
SRC = 'src'
DSRC = 'src/drivers'
kernel_ld = meson.current_source_dir() / 'kernel.ld'
rel_inc = 'include/fdpp'
abs_inc = meson.current_source_dir() / rel_inc
incdir = include_directories(rel_inc)
cpp = meson.get_compiler('c')
Expand All @@ -17,16 +16,17 @@ BVER = cpp.get_define('BPRM_VER',
FVER = AVER + '.' + BVER
TARGET = 'fdppkrnl.' + FVER
GIT_DESCRIBE = run_command('git', 'describe', check: true).stdout().strip()
hdr = [TOP / 'kernel', TOP / 'hdr', TOP / 'fdpp', rel_inc]
hdr = ['src', 'hdr', rel_inc]
incdir2 = include_directories(hdr)
sfiles = cpp.preprocess(['cdata.S', 'plt.S'],
output : '@[email protected]',
include_directories: incdir2,
compile_args : [
'-D__ASSEMBLER__',
'-DKERNEL_VERSION=' + meson.project_version() +
dependencies: declare_dependency(
compile_args : [
'-D__ASSEMBLER__',
'-DKERNEL_VERSION=' + meson.project_version() +
' [GIT: ' + GIT_DESCRIBE + ']',
'-DCMA=,', '-P'])
'-DCMA=,', '-P']))
env = environment()
env.set('CPP', 'cpp')
env.set('srcdir', meson.current_source_dir() / '../parsers')
Expand Down Expand Up @@ -83,3 +83,5 @@ custom_target(TARGET + '.elf',
install_dir: get_option('datadir') / 'fdpp',
install_mode: 'rw-r--r--',
build_by_default: true)

VERSION = meson.project_version()
1 change: 1 addition & 0 deletions fdpp/kernel/parsers
1 change: 1 addition & 0 deletions fdpp/kernel/src
1 change: 1 addition & 0 deletions fdpp/kernel/thunks_priv.h
1 change: 1 addition & 0 deletions fdpp/kernel/toolchain.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
nasm = 'nasm-segelf'
c = 'gcc'
strip = 'llvm-strip'
pkg-config = 'pkg-config'

[constants]
arch = 'i386-linux-gnu'
Expand Down
1 change: 1 addition & 0 deletions fdpp/loader/include
5 changes: 2 additions & 3 deletions fdpp/loader/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
project('loader', 'c', version: '0.1')
TOP = '../..'
rel_inc = TOP / 'include/fdpp'
rel_inc = 'include/fdpp'
abs_inc = meson.current_source_dir() / rel_inc
lelf = dependency('libelf')
incdir = include_directories(rel_inc)
Expand All @@ -13,7 +12,7 @@ BVER = cpp.get_define('BPRM_VER',
prefix: '#include "bprm.h"')
FVER = AVER + '.' + BVER
TARGET = 'fdppkrnl.' + FVER
shared_library('fdldr', 'elf.c', 'loader.c',
LIBLOADER = shared_library('fdldr', 'elf.c', 'loader.c',
dependencies: lelf, include_directories: incdir,
version: FVER,
c_args: [
Expand Down
5 changes: 2 additions & 3 deletions fdpp/meson.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
project('libfdpp', ['c', 'cpp'], version: '0.1')
TOP = '..'
MF = meson.current_source_dir() / 'parsers/mkfar.sh'
MA = meson.current_source_dir() / 'parsers/mkasmdefs.sh'
PD = meson.current_source_dir() / 'parsers/parse_decls.sh'
M4 = meson.current_source_dir() / 'parsers/thunks.m4'
tg = subproject('thunk_gen')
TG = tg.get_variable('TG')
TFLAGS = ['-a', '2', '-p', '2']
SRC = TOP / 'kernel'
SRC = 'src'
rel_inc = 'include/fdpp'
abs_inc = meson.current_source_dir() / rel_inc
incdir = include_directories(rel_inc)
Expand Down Expand Up @@ -138,7 +137,7 @@ FDPP_CCFILES = ['thunks.cc', 'thunks_c.cc', 'thunks_a.cc', 'thunks_p.cc',
CPPFILES = ['objhlp.cpp', 'ctors.cpp', 'farhlp.cpp', 'objtrace.cpp']
hdr = ['src', 'hdr', '.', rel_inc]
incdir2 = include_directories(hdr)
shared_library('fdpp', [ccfiles, ppccf, FDPP_CCFILES, CPPFILES],
LIBFDPP = shared_library('fdpp', [ccfiles, ppccf, FDPP_CCFILES, CPPFILES],
include_directories: incdir2,
version: FVER,
sources: [gad, pac, pap, tc, ta],
Expand Down
12 changes: 12 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
project('fdpp', ['cpp', 'c', 'nasm'], version: '0.1')
li = subproject('libfdpp')
LIBFDPP = li.get_variable('LIBFDPP')
lo = subproject('loader')
LIBLOADER = lo.get_variable('LIBLOADER')
ke = subproject('kernel')
VERSION = ke.get_variable('VERSION')

pkg = import('pkgconfig')
pkg.generate(LIBFDPP,
libraries: LIBLOADER,
version: VERSION)
1 change: 1 addition & 0 deletions subprojects/kernel
1 change: 1 addition & 0 deletions subprojects/libfdpp
1 change: 1 addition & 0 deletions subprojects/loader

0 comments on commit d8c966b

Please sign in to comment.