felixecker / mariebuild Goto Github PK
View Code? Open in Web Editor NEWcustomary build system intended for my private use.
License: BSD 3-Clause "New" or "Revised" License
customary build system intended for my private use.
License: BSD 3-Clause "New" or "Revised" License
Parse a buildfile into C Structs
mb_exec_compile seems to cause heap corruption which causes mb_exec_finalize to fail and will cause further problems down the line. This issue is very urgent
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 and refactor the existing codebase to make work on it more pleasent in the future
Parse a buildfile and execute its compile and finalize command
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
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
When supplying the --keep-going
argument, mariebuild reports alls builds as successful even if a target or a rule had a failure.
Step one: Specify how Extensions should exactly Work
Step two: Implement Extensions
Implement support for multiple building modes with the standard modes of "debug" and "release"
Registering the mode_flags
in mb_execute.c#mb_exec_compile
causes the value of the file
field and potentially some other fields to break.
libmcfg can be found at this repo
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
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)
Add support for shell scripts in the .scripts sector according to the specification
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.