titan-lang / titan

The Titan programming language
http://titan-lang.org
MIT License
406 stars 13 forks source link

Changes to build and run Titan modules and applications with stock Lua (without changes needed to `luaconf.h`) #231

Closed mascarenhas closed 6 years ago

mascarenhas commented 6 years ago

Link Titan modules statically with part of the Lua object files (only change over a regular Lua installation is that they need to be compiled with -fPIC, but no changes to luaconf.h are needed.

All static functions that every Titan module/app uses should be in a separate titan.c file (some of these functions may be compiled from Lua and specialized, with proper attribution).

Titan applications do not need Lua object files compiled with -fPIC, for now we can just have one set of object files, in the future we might want to have two.

I am also trying to get Travis to do OSX builds of Titan, but as I do not have a local OSX machine myself I will leave this out of this PR if it turns out to be too much trouble.

hishamhm commented 6 years ago

I am also trying to get Travis to do OSX builds of Titan, but as I do not have a local OSX machine myself I will leave this out of this PR if it turns out to be too much trouble.

I'm going to push a commit here attempting to fix this, I checked the changes against the LuaRocks .travis.yml.

mascarenhas commented 6 years ago

Right now it seems like the Travis OSX worker is busted, it is erroring while downloading Python.

hishamhm commented 6 years ago

@mascarenhas my bad, just refresh :) I messed it up for a second when force-pushing a fixed-fix.

mascarenhas commented 6 years ago

We can already remove the lua folder from the repository, by the way. About this PR, I still have not tested if Titan executables are building correctly (I suspect not), and after fixing this we can merge and do the specialization of getgeneric some other time.

mascarenhas commented 6 years ago

Looks like the FFI needs some fixes to work on OSX. We should just leave the Travis build commented out for now and try to do these fixes in another PR, preferably with access to an OSX machine.

hishamhm commented 6 years ago

All right, macOS ran, but c-parser is failing to parse some standard library headers there (those are usually the ones that push the parser the hardest).

hishamhm commented 6 years ago

@mascarenhas agreed!

codecov-io commented 6 years ago

Codecov Report

Merging #231 into master will increase coverage by 0.77%. The diff coverage is n/a.

Impacted Files Coverage Δ
titan-compiler/coder.lua 96.38% <ø> (+0.05%) :arrow_up:
titan-compiler/driver.lua 79.51% <ø> (+19.94%) :arrow_up:
titan-compiler/lexer.lua 100% <0%> (+1.66%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 32b0450...844f7a8. Read the comment docs.

mascarenhas commented 6 years ago

Ok, will make sure we can still compile Titan applications, and not just Lua modules, later.

mascarenhas commented 6 years ago

All systems go @hishamhm!