Move builds to bonnibel 0.2

This commit is contained in:
Justin C. Miller
2019-03-30 01:33:00 -07:00
parent f9193b4602
commit ee6d69bcd2
6 changed files with 23 additions and 202 deletions

View File

@@ -1,109 +1,14 @@
ninja_required_version = 1.3 {% extends "build.base.j2" %}
builddir = {{ buildroot }}
srcroot = {{ srcroot }}
modulefile = {{ modulefile }}
warnflags = $ {% block variables %}
-Wformat=2 $ {{ super() }}
-Winit-self $ ccflags = $ccflags $
-Wfloat-equal $
-Winline $
-Wmissing-format-attribute $
-Wmissing-include-dirs $
-Wswitch $
-Wundef $
-Wdisabled-optimization $
-Wpointer-arith $
-Wno-attributes $
-Wno-sign-compare $
-Wno-multichar $
-Wno-div-by-zero $
-Wno-endif-labels $
-Wno-pragmas $
-Wno-format-extra-args $
-Wno-unused-result $
-Wno-deprecated-declarations $
-Wno-unused-function $
-Werror
ccflags = $
-I${srcroot}/src/include $ -I${srcroot}/src/include $
-I${srcroot}/src/include/x86_64 $ -I${srcroot}/src/include/x86_64
-DVERSION_MAJOR={{ version.major }} $ {% endblock %}
-DVERSION_MINOR={{ version.minor }} $
-DVERSION_PATCH={{ version.patch }} $
-DVERSION_GITSHA=0x{% if version.dirty %}1{% else %}0{% endif %}{{ version.sha }} $
-DGIT_VERSION=\"{{ version.major }}.{{ version.minor }}.{{ version.patch }}-{{ version.sha }}\" $
-DGIT_VERSION_WIDE=L\"{{ version.major }}.{{ version.minor }}.{{ version.patch }}-{{ version.sha }}\" $
$warnflags
asflags = $
-DVERSION_MAJOR={{ version.major }} $
-DVERSION_MINOR={{ version.minor }} $
-DVERSION_PATCH={{ version.patch }} $
-DVERSION_GITSHA=0x{% if version.dirty %}1{% else %}0{% endif %}{{ version.sha }}
cflags = -std=c11
cxxflags = -std=c++14
libs =
rule cc
deps = gcc
depfile = $out.d
description = Compiling $name
command = $cc -MMD -MF $out.d $ccflags $cflags -o $out -c $in
rule dump_cc_defs
description = Dumping CC defines for $target
command = echo "" | $cc $ccflags $cflags -dM -E - > $out
rule dump_cc_run
description = Dumping CC arguments for $target
command = $
echo "#!/bin/bash" > $out; $
echo '$cc $ccflags $cflags $$*' > $out; $
chmod a+x $out
rule cxx
deps = gcc
depfile = $out.d
description = Compiling $name
command = $cxx -MMD -MF $out.d $cxxflags $ccflags -o $out -c $in
rule dump_cxx_defs
description = Dumping C++ defines for $target
command = echo "" | $cxx -x c++ $cxxflags $ccflags -dM -E - > $out
rule dump_cxx_run
description = Dumping C++ arguments for $target
command = $
echo "#!/bin/bash" > $out; $
echo '$cc $cxxflags $ccflags $$*' > $out; $
chmod a+x $out
rule nasm
deps = gcc
depfile = $out.d
description = Assembling $name
command = $nasm -o $out -felf64 -MD $out.d $asflags $in
rule exe
description = Linking $name
command = $ld $ldflags -o $out $in $libs
rule lib
description = Archiving $name
command = $ar qcs $out $in
rule regen
generator = true
description = Regenrating build files
command = {{ generator }} $builddir $modulefile
rule cp
description = Copying $name
command = cp $in $out
{% block baserules %}
{{ super() }}
rule makerd rule makerd
description = Making init ramdisk description = Making init ramdisk
command = $builddir/native/makerd $in $out command = $builddir/native/makerd $in $out
@@ -135,27 +40,9 @@ rule strip
objcopy --only-keep-debug $out $out.debug; $ objcopy --only-keep-debug $out $out.debug; $
strip -g $out; $ strip -g $out; $
objcopy --add-gnu-debuglink=$out.debug $out objcopy --add-gnu-debuglink=$out.debug $out
{% endblock %}
rule dump {% block extra %}
description = Dumping decompiled $name
command = objdump -DS $in > $out
{% for target in targets %}
subninja {{ target }}/target.ninja
{% endfor %}
build $
{%- for buildfile in buildfiles %}
{{ buildfile }} $
{%- endfor %}
: regen | $
{%- for template in templates %}
{{ template }} $
{%- endfor %}
$modulefile $
{{ generator }}
build $builddir/ovmf_vars.fd : cp $srcroot/assets/ovmf/x64/ovmf_vars.fd build $builddir/ovmf_vars.fd : cp $srcroot/assets/ovmf/x64/ovmf_vars.fd
name = ovmf_vars.fd name = ovmf_vars.fd
@@ -187,5 +74,13 @@ build $builddir/popcorn.img : makefat | $
$builddir/fatroot/efi/boot/bootx64.efi $builddir/fatroot/efi/boot/bootx64.efi
name = popcorn.img name = popcorn.img
default $
$builddir/ovmf_vars.fd $
$builddir/ovmf_vars_d.fd $
$builddir/popcorn.dump $
$builddir/popcorn.elf-gdb.py $
$builddir/popcorn.img
{% endblock %}
# vim: ft=ninja et ts=4 sts=4 sw=4 # vim: ft=ninja et ts=4 sts=4 sw=4

View File

@@ -1,8 +0,0 @@
{% extends "module.base.j2" %}
{% block variables %}
{{ super() }}
{% endblock %}
# vim: ft=ninja et ts=4 sts=4 sw=4

View File

@@ -1,4 +0,0 @@
{% extends "module.base.j2" %}
# vim: ft=ninja et ts=4 sts=4 sw=4

View File

@@ -1,41 +0,0 @@
moddir = ${builddir}/{{ module.name }}.dir
{% block variables %}
ccflags = $ccflags $
{%- for dep in module.depmods %}
{%- for inc in dep.includes %}
-I${srcroot}/{{ inc }} $
{%- endfor %}
{%- endfor %}
{%- for inc in module.includes %}
-I${srcroot}/{{ inc }} $
{%- endfor %}
{%- for define in module.defines %}
-D{{ define }} $
{%- endfor %}
{% endblock %}
{% for source in module.sources %}
build ${moddir}/{{ source.output }} : {{ source.action }} {{ source.input }} || {{ buildfile }}
name = {{ source.name }}
{% endfor %}
build ${builddir}/{{ module.output }} : {{ module.kind }} $
{%- for source in module.sources %}
${moddir}/{{ source.output }} $
{%- endfor -%}
{%- for dep in module.libdeps %}
${builddir}/{{ dep.output }} $
{%- endfor %}
| $
{% for dep in module.exedeps %}
${builddir}/{{ dep.output }} $
{%- endfor -%}
{{ buildfile }}
name = {{ module.name }}
{% block extra %}
{% endblock %}
# vim: ft=ninja et ts=4 sts=4 sw=4

View File

@@ -1,26 +0,0 @@
builddir = $builddir/{{ target }}
target = {{ target }}
{% block variables %}
{% endblock %}
{% block binaries %}
cc = clang
cxx = clang++
ld = clang++
ar = ar
nasm = nasm
objcopy = objcopy
{% endblock %}
{% for module in modules %}
subninja {{ module.name }}.ninja
{% endfor %}
build ${builddir}/cc.defs : dump_cc_defs | {{ buildfile }}
build ${builddir}/cxx.defs : dump_cxx_defs | {{ buildfile }}
build ${builddir}/cc.run : dump_cc_run | {{ buildfile }}
build ${builddir}/cxx.run : dump_cxx_run | {{ buildfile }}
# vim: ft=ninja et ts=4 sts=4 sw=4

View File

@@ -1,5 +1,10 @@
{% extends "target.default.j2" %} {% extends "target.default.j2" %}
{% block binaries %}
{{ super() }}
ld = clang++
{% endblock %}
{% block variables %} {% block variables %}
ccflags = $ccflags -g -ggdb ccflags = $ccflags -g -ggdb