samplecount / shake-language-c Goto Github PK
View Code? Open in Web Editor NEWCross-compilation framework based on the Shake Haskell library.
Home Page: https://github.com/samplecount/shake-language-c#shake-language-c
License: Apache License 2.0
Cross-compilation framework based on the Shake Haskell library.
Home Page: https://github.com/samplecount/shake-language-c#shake-language-c
License: Apache License 2.0
For Stackage Nightly:
src/Development/Shake/Language/C/Config.hs:76:12: error:
• Couldn't match type ‘RuleResult Config’ with ‘Maybe String’
arising from a use of ‘addOracle’
• In a stmt of a 'do' block:
query <- addOracle
$ \ (Config (deps, file, env, key))
-> Map.lookup key <$> fileCache (deps, file, env)
In the expression:
do fileCache <- newCache $ \ (deps, file, env) -> do ...
query <- addOracle
$ \ (Config (deps, file, env, key))
-> Map.lookup key <$> fileCache (deps, file, env)
return
$ \ deps file env key -> query (Config (deps, file, env, key))
In an equation for ‘mkConfig’:
mkConfig
= do fileCache <- newCache $ \ (deps, file, env) -> ...
query <- addOracle
$ \ (Config (deps, file, env, key))
-> Map.lookup key <$> fileCache ...
return $ \ deps file env key -> query (Config ...)
|
76 | query <- addOracle $ \(Config (deps, file, env, key)) -> Map.lookup key <$> fileCache (deps, file, env)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For example fclabels.
Change signature of build rules in Shake.Development.Language.C.Rules
to
buildProduct ::
Action ToolChain -- ^ Action returning a target 'ToolChain'
-> Action (BuildFlags -> BuildFlags) -- ^ Action returning a 'BuildFlags' modifier
-> Action [FilePath] -- ^ Action returning a list of input source files
-> Rules (FilePath -> Action()) -- ^ Rule returning an action that produces the given output file
This would allow for further build product processing without introducing intermediate (phony) targets. The old rules functions can still be provided as trivial wrappers of the new ones:
buildProcuct_ toolChain flags sources output =
(output *>) =<< buildProduct toolChain flags sources
Fix libcxx
include path. Possibly keep old definition for backwards compatibility.
Trying to build Methcla on an ARMv7 running Linux:
./shake .update
Unknown host architecture armv7l
CallStack (from HasCallStack):
error, called at src/Development/Shake/Language/C/Host/Linux.hs:33:14 in shake-language-c-0.10.0-3OxHz2LdZSyIlVaBYgvPMo:Development.Shake.Language.C.Host.Linux
The default build flags for each target/platform/toolchain combination should be part of the toolchain record. The library/executable rules wouldn't need a build flags argument anymore, but directly apply the source tree to the toolchain build flags.
It's probably how BuildFlags.fromConfig
is defined.
It's not normally needed by client code.
Remove linkResultFileName
from ToolChain
and provide combinators for building platform specific build product names instead.
These shouldn't really be in the export list, move them to private modules under Development.Shake.Language.C.Host
.
That's where it's normally needed. The current inclusion/documentation structure is a bit confusing.
The ToBuildPrefix
instance of Arch
provides the same functionality.
This could be something like type Configure a = Action (Maybe a)
and would allow the toolchain to depend on the contents of a configuration file (as in Development.Shake.Config).
The downside is that the toolchain is only defined when executing the actions for a rule and cannot be inspected before.
Was playing around, and couldn't figure out the rules to apply for the following situation:
test_lib.[h, cc]
bin1.cc (includes test_lib.h, should link against test_lib)
build/ (dir to be used by shake)
I tried the following rules (omitting toolchain, flags):
lib1 <- staticLibrary "build/libtest_lib.a" (pure ["test_lib.cc"])
bin1 <- executable "build/bin1" (pure ["bin1.cc", "build/libtest_lib.a"])
want [bin1]
I'm sure I'm missing something. This is the output:
# gcc (for build/libtest_lib_a_obj/test_lib.cc.rel.o)
# ar (for build/libtest_lib.a)
# ranlib (for build/libtest_lib.a)
# gcc (for build/bin1_obj/build/libtest_lib.a.rel.o)
gcc: warning: build/libtest_lib.a: linker input file unused because linking not done
Error when running Shake build system:
* build/bin1
* build/bin1_obj/build/libtest_lib.a.rel.o
build/bin1_obj/build/libtest_lib.a.rel.o.d: openBinaryFile: does not exist (No such file or directory)
build/
├── bin1_obj
│ └── build
├── libtest_lib.a
└── libtest_lib_a_obj
├── test_lib.cc.rel.o
└── test_lib.cc.rel.o.d
Thanks!
...
Allow running the shakefile via runhaskell. Saves compilation time and avoids out of sync build system problems.
See e.g. http://pastebin.com/N1DsFnky and http://stackoverflow.com/questions/17014270/how-can-i-use-ghci-with-the-new-cabal-1-17-sandboxes
SDK version should be passed in at toolchain creation.
Allow to use actions in config file environment, i.e. change withConfig
signature to
withConfig :: [FilePath]
-> Rules ( [(String, Action String)]
-> FilePath
-> String
-> Action (Maybe String))
Use case: Pass toolchain variant determined from host toolchain (returned in Action
monad) to config file environment.
Provide instances for Default class from data-default-class package where appropriate, e.g. BuildFlags
and ToolChain
.
Add support for code signing on OSX for building dynamically loadable bundles.
Citing from http://hydra.cryp.to/build/1330346/nixlog/1/raw:
Test suite spectests: RUNNING...
Host toolchain
compiles a C file to an executable FAILED [1]
compiles a C++ file to an executable FAILED [2]
Failures:
tests/spectests.hs:51:
1) Host toolchain compiles a C file to an executable
uncaught exception: ShakeException (Error when running Shake build system:
* tests/build/host_toolchain_compile_c/output/result.txt
* tests/build/host_toolchain_compile_c/output/result
arch: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
)
tests/spectests.hs:71:
2) Host toolchain compiles a C++ file to an executable
uncaught exception: ShakeException (Error when running Shake build system:
* tests/build/host_toolchain_compile_cpp/output/result.txt
* tests/build/host_toolchain_compile_cpp/output/result
arch: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
)
Randomized with seed 123489781
Finished in 0.0144 seconds
2 examples, 2 failures
Test suite spectests: FAIL
Unpacking to shake-language-c-0.6.4/
Resolving dependencies...
Configuring shake-language-c-0.6.4...
Building shake-language-c-0.6.4...
Preprocessing library shake-language-c-0.6.4...
[ 1 of 19] Compiling Development.Shake.Language.C.Util ( src/Development/Shake/Language/C/Util.hs, dist/build/Development/Shake/Language/C/Util.o )
[ 2 of 19] Compiling Development.Shake.Language.C.Config ( src/Development/Shake/Language/C/Config.hs, dist/build/Development/Shake/Language/C/Config.o )
src/Development/Shake/Language/C/Config.hs:15:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[ 3 of 19] Compiling Development.Shake.Language.C.Label ( src/Development/Shake/Language/C/Label.hs, dist/build/Development/Shake/Language/C/Label.o )
src/Development/Shake/Language/C/Label.hs:30:1: Warning:
The import of ‘Data.Monoid’ is redundant
except perhaps to import instances from ‘Data.Monoid’
To import instances alone, use: import Data.Monoid()
[ 4 of 19] Compiling Development.Shake.Language.C.Language ( src/Development/Shake/Language/C/Language.hs, dist/build/Development/Shake/Language/C/Language.o )
[ 5 of 19] Compiling Development.Shake.Language.C.BuildFlags ( src/Development/Shake/Language/C/BuildFlags.hs, dist/build/Development/Shake/Language/C/BuildFlags.o )
src/Development/Shake/Language/C/BuildFlags.hs:57:1: Warning:
The import of ‘Data.Monoid’ is redundant
except perhaps to import instances from ‘Data.Monoid’
To import instances alone, use: import Data.Monoid()
[ 6 of 19] Compiling Development.Shake.Language.C.ToolChain ( src/Development/Shake/Language/C/ToolChain.hs, dist/build/Development/Shake/Language/C/ToolChain.o )
src/Development/Shake/Language/C/ToolChain.hs:57:1: Warning:
The import of ‘Data.Monoid’ is redundant
except perhaps to import instances from ‘Data.Monoid’
To import instances alone, use: import Data.Monoid()
[ 7 of 19] Compiling Development.Shake.Language.C.Rules ( src/Development/Shake/Language/C/Rules.hs, dist/build/Development/Shake/Language/C/Rules.o )
src/Development/Shake/Language/C/Rules.hs:94:10:
Ambiguous occurrence ‘*>’
It could refer to either ‘Prelude.*>’,
imported from ‘Prelude’ at src/Development/Shake/Language/C/Rules.hs:57:8-41
(and originally defined in ‘GHC.Base’)
or ‘Development.Shake.*>’,
imported from ‘Development.Shake’ at src/Development/Shake/Language/C/Rules.hs:65:1-24
src/Development/Shake/Language/C/Rules.hs:104:53:
Ambiguous occurrence ‘*>’
It could refer to either ‘Prelude.*>’,
imported from ‘Prelude’ at src/Development/Shake/Language/C/Rules.hs:57:8-41
(and originally defined in ‘GHC.Base’)
or ‘Development.Shake.*>’,
imported from ‘Development.Shake’ at src/Development/Shake/Language/C/Rules.hs:65:1-24
[ 8 of 19] Compiling Development.Shake.Language.C.Target ( src/Development/Shake/Language/C/Target.hs, dist/build/Development/Shake/Language/C/Target.o )
[ 9 of 19] Compiling Development.Shake.Language.C.Target.Android ( src/Development/Shake/Language/C/Target/Android.hs, dist/build/Development/Shake/Language/C/Target/Android.o )
src/Development/Shake/Language/C/Target/Android.hs:112:18: Warning:
This binding for ‘target’ shadows the existing binding
defined at src/Development/Shake/Language/C/Target/Android.hs:65:1
[10 of 19] Compiling Development.Shake.Language.C.Target.Linux ( src/Development/Shake/Language/C/Target/Linux.hs, dist/build/Development/Shake/Language/C/Target/Linux.o )
[11 of 19] Compiling Development.Shake.Language.C.Host.Linux ( src/Development/Shake/Language/C/Host/Linux.hs, dist/build/Development/Shake/Language/C/Host/Linux.o )
[12 of 19] Compiling Development.Shake.Language.C.Host.Windows ( src/Development/Shake/Language/C/Host/Windows.hs, dist/build/Development/Shake/Language/C/Host/Windows.o )
[13 of 19] Compiling Development.Shake.Language.C.Target.OSX ( src/Development/Shake/Language/C/Target/OSX.hs, dist/build/Development/Shake/Language/C/Target/OSX.o )
src/Development/Shake/Language/C/Target/OSX.hs:41:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[14 of 19] Compiling Development.Shake.Language.C.Host.OSX ( src/Development/Shake/Language/C/Host/OSX.hs, dist/build/Development/Shake/Language/C/Host/OSX.o )
src/Development/Shake/Language/C/Host/OSX.hs:19:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[15 of 19] Compiling Development.Shake.Language.C.Host ( src/Development/Shake/Language/C/Host.hs, dist/build/Development/Shake/Language/C/Host.o )
[16 of 19] Compiling Development.Shake.Language.C.Target.Windows ( src/Development/Shake/Language/C/Target/Windows.hs, dist/build/Development/Shake/Language/C/Target/Windows.o )
The target passed to create a particular toolchain should be part of the toolchain record. This saves one argument in most rule functions.
Overkill.
Add a target constructor that corresponds to the build host's platform and architecture.
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.