Git Product home page Git Product logo

mariebuild's Introduction

Mariebuild

A build system primarly designed and intended for my use.

Building

Setup

To quickly setup mariebuild for development, simply run the setup.sh script. This will automatically build libmcfg_2 from the latest commit on its main branch.

Compiling

With mariebuild (0.4.0 or higher): mb -t release
Without mariebuild: sh build.sh

mb usage

By default mb looks for a build.mb file which is the executed in debug mode.

Usage: mb [OPTION...]
A simple build system inspired by my hate against makefiles
Author: Marie Eckert

  -f, --force                Force a build, regardless if target is
                             incremental
  -i, --in=FILE              Specify a buildfile
  -k, --keep-going           Ignore any failures (if possible) and keep on building
  -n, --no-splash            Disable splash screen/logo
  -t, --target=TARGET        Specify the build target
  -v, --verbosity=LEVEL      Set the verbosity level (0-3)
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to https://github.com/FelixEcker/mariebuild/issues.

TODO (for mariebuild 1.0.0)

  • Move to MCFG/2
  • Incremental and Full Builds
  • Unify and Singular Rules
  • Implementation of the "force" argument
  • Target-Dependant Fields
  • Documentation

License

Mariebuild is licensed under the BSD 3-Clause License, see The LICENSE file.

mariebuild's People

Contributors

felixecker avatar

Stargazers

 avatar

Watchers

 avatar

mariebuild's Issues

Building Modes

Implement support for multiple building modes with the standard modes of "debug" and "release"

Field embeds in filed "mariebuild/files" are not resolved properly

When embedding a field in ".config/mariebuild/files", the field is not properly resolved for the finalization command.

Sample buildfile:

sector .config
  depends:
    includes 'include/'
    files    'butter/stack.c'

  mariebuild:
    name 'bs'
    cc 'gcc'

    std_flags '-Wall -I$(depends/includes)'
    debug_flags '-ggdb'
    release_flags '-O3'

    files '$(depends/files):bs.c:main.c'

    comp_cmd '$(cc) $(mode_flags) $(std_flags) -c -o out/$(file).o src/$(file)'
    finalize_cmd '$(cc) $(mode_flags) -o $(name) out/$(files).o'

Output:

> gcc -ggdb -Wall -Iinclude/ -c -o out/butter/stack.c.o src/butter/stack.c
>> gcc -ggdb -Wall -Iinclude/ -c -o out/bs.c.o src/bs.c
>> gcc -ggdb -Wall -Iinclude/ -c -o out/main.c.o src/main.c
>> gcc -ggdb -o bs out/$(depends/files).o out/bs.c.o out/main.c.o
sh: line 1: depends/files: No such file or directory
/usr/bin/ld: cannot find out/.o: No such file or directory
collect2: error: ld returned 1 exit status
!! Finalization Command returned non-zero exit code: 1
!! Build failed: An errror occured whilst finalizing! (0x20000005)

Compile and Finalize Script Sections

Some projects/builds need more complex compilation and/or finalization commands. Putting all of these into the same single field can be quite fugly and unmaintainable.
This is why there should be sections for a compile_script and finalize_script within the .scripts sector.
This will be worked on on the topic/comp-fin-scripts branch

Parse Program Arguments

Parse mariebuilds command line arguments according to the spec:

    e exec
        Execute a specific script from the build file
    c check
        Check if the given mb file is valid
    i in
        Specify a file to be used. This is not required as mb will look for
        a mb file named "build.mb" by default.
    p platform
        Specify the targeted platforms name
    d disable-extensions
        Disable all extensions. Can not be overriden in the extensions section
    q quiet
        Disable all output from mb, only output from scripts will be allowed
    v verbose
        Enable verbose output from mb

Memory Leak in mb_exec_compile

A memory leak is caused by mb_exec_compile on line 164 in mb_execute.c

Valgrind Log:

==14573== Memcheck, a memory error detector
==14573== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==14573== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==14573== Command: ./mb -m release
==14573==
>> Executing script prepare...
==14573== Invalid read of size 8
==14573==    at 0x10BFA4: mb_exec_compile (mb_execute.c:164)
==14573==    by 0x10C318: mb_exec_build (mb_execute.c:232)
==14573==    by 0x10C798: main (mb.c:135)
==14573==  Address 0x4a70f98 is 152 bytes inside a block of size 192 free'd
==14573==    at 0x4846BE0: realloc (vg_replace_malloc.c:1649)
==14573==    by 0x10A09B: register_field (mb_parse.c:143)
==14573==    by 0x10BF1F: mb_exec_compile (mb_execute.c:154)
==14573==    by 0x10C318: mb_exec_build (mb_execute.c:232)
==14573==    by 0x10C798: main (mb.c:135)
==14573==  Block was alloc'd at
==14573==    at 0x4846BE0: realloc (vg_replace_malloc.c:1649)
==14573==    by 0x10A09B: register_field (mb_parse.c:143)
==14573==    by 0x10BB40: mb_exec_prepare_mode (mb_execute.c:91)
==14573==    by 0x10C2EA: mb_exec_build (mb_execute.c:227)
==14573==    by 0x10C798: main (mb.c:135)
==14573==
>> gcc -O3 -Wall -Iinclude/ -c -o out/mb_utils.c.o src/mb_utils.c
>> gcc -O3 -Wall -Iinclude/ -c -o out/mb_parse.c.o src/mb_parse.c
>> gcc -O3 -Wall -Iinclude/ -c -o out/mb_script.c.o src/mb_script.c
>> gcc -O3 -Wall -Iinclude/ -c -o out/mb_execute.c.o src/mb_execute.c
>> gcc -O3 -Wall -Iinclude/ -c -o out/mb.c.o src/mb.c
>> gcc -O3 -o mb out/mb_utils.c.o out/mb_parse.c.o out/mb_script.c.o out/mb_execute.c.o out/mb.c.o
>> Build succeeded!
==14573==
==14573== HEAP SUMMARY:
==14573==     in use at exit: 16 bytes in 1 blocks
==14573==   total heap usage: 872 allocs, 871 frees, 21,071 bytes allocated
==14573==
==14573== 16 bytes in 1 blocks are definitely lost in loss record 1 of 1
==14573==    at 0x4841848: malloc (vg_replace_malloc.c:431)
==14573==    by 0x10BBEB: mb_exec_prepare_mode (mb_execute.c:106)
==14573==    by 0x10C2EA: mb_exec_build (mb_execute.c:227)
==14573==    by 0x10C798: main (mb.c:135)
==14573==
==14573== LEAK SUMMARY:
==14573==    definitely lost: 16 bytes in 1 blocks
==14573==    indirectly lost: 0 bytes in 0 blocks
==14573==      possibly lost: 0 bytes in 0 blocks
==14573==    still reachable: 0 bytes in 0 blocks
==14573==         suppressed: 0 bytes in 0 blocks
==14573==
==14573== For lists of detected and suppressed errors, rerun with: -s
==14573== ERROR SUMMARY: 6 errors from 2 contexts (suppressed: 0 from 0)

Cleanup existing code

Cleanup and refactor the existing codebase to make work on it more pleasent in the future

Mariebuild Extensions

Step one: Specify how Extensions should exactly Work
Step two: Implement Extensions

Implement proper handling for embedding of field "files"

mb_parse.resolve_fields() needs to implement the proper handling when the field .config/mariebuild/files is embedded:

files
    Required field which holds all source files in a colon-seperated list.
    Wildcarding with * is allowed.

    If embedded into another field with the $() operator, the list is inserted
    with space-seperation. Chars which come immediatly after the embed are
    postfixed to every file.

    Example:
    $(files).o
    = file1.o file2.o file3.o

This is requried for issue #5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.