Modest
Modest copied to clipboard
Add posix port headers for ib build tool support
The problem
I love ib build tool. It help keeps my code sane and easy to integrate with other projects. When building one of the examples, I ran into a lot of errors with undefined references. The references were undefined because ib could not find the implementation of some functions. I believe this is because ib works by running the preprocessor on the target, then follows all headers files in the evaluated source code and repeats for all found implementations. The problem is the source code for modest is unable to be compiled this way. So I decided to change some things to allow ib to compile one of the examples. I hope this is ok :)
The solution
In order for the build tool to work on Modest source code, I need to at least add missing headers for posix port implementation and any other implementations lacking a include-able header. I definitely missed some in this pr, but I didn't want to continue in case this pr is not welcome. I hope these changes are ok.
What worked for me
The following build tool specific code was not added to this pr because I thought it would be redundant when a Makefile is already used. I do not care to add build tool specific code to the project unless the project decided to replace make with ib. I got ib working in a few steps after this code change.
-
Create file to tell
ibwhere project root issource/__ib__touch source/__ib__ -
Create file to specify simple compiler and make options. More info here
source/debug.cfgcc = Obj( tool='clang', flags=[], hdrs_flags=[ '-MM', '-MG' ], incl_dirs=[] ) link = Obj( tool='clang', flags=[ '-pthread' ], libs=[], static_libs=[], lib_dirs=[] ) make = Obj( tool='make', flags=[ '-s' ], force_flag='-B', all_pseudo_target='all' ) -
Create a new target that can be compiled using
ib, it's a modified version ofexamples/modest/css_property_to_node.c. I needed to include myport/posix headers and any others to fix undefined reference errors.source/css_property_to_node.c/* ALLOW INCLUDING PORT IMPLEMENTATION USING IB */ #include <myport/posix/mycore/utils/mcsync.h> #include <myport/posix/mycore/io.h> #include <myport/posix/mycore/memory.h> #include <myport/posix/mycore/thread.h> #include <myport/posix/mycore/perf.h> /* INCLUDE MISSED HEADERS */ #include <myhtml/tag_init.h> #include <mycss/property/parser.h> #include <mycss/property/parser_text_decoration.h> #include <mycss/property/parser_background.h> #include <mycss/property/parser_url.h> #include <mycss/property/parser_image.h> #include <myencoding/detect.h> /* .... REST OF examples/modest/css_property_to_node.c */ -
Build target using ib and run
# switch /usr/bin/python to python2 cd source # remove all .o files so ib know to compile .c files to continue following headers rm **/*.o # build executable target (no extension) ib css_property_to_node # run built executable ../out/debug/css_property_to_node
Will any changes in this pr negatively impact other users of Modest?
No impact at all, assuming I did not make any mistakes. The implementation is unchanged left intact.