diff --git a/comp/src/gb.jit/.component b/comp/src/gb.jit/.component new file mode 100644 index 000000000..844988ff4 --- /dev/null +++ b/comp/src/gb.jit/.component @@ -0,0 +1,6 @@ +[Component] +Key=gb.jit +Version=3.10.90 +State=2 +Hidden=True +Authors=Benoît Minisini diff --git a/comp/src/gb.jit/.directory b/comp/src/gb.jit/.directory new file mode 100644 index 000000000..06dab1c8a --- /dev/null +++ b/comp/src/gb.jit/.directory @@ -0,0 +1,2 @@ +[Desktop Entry] +Icon=./.icon.png diff --git a/comp/src/gb.jit/.icon.png b/comp/src/gb.jit/.icon.png new file mode 100644 index 000000000..4e185c57a Binary files /dev/null and b/comp/src/gb.jit/.icon.png differ diff --git a/comp/src/gb.jit/.project b/comp/src/gb.jit/.project new file mode 100644 index 000000000..8b2777064 --- /dev/null +++ b/comp/src/gb.jit/.project @@ -0,0 +1,13 @@ +# Gambas Project File 3.0 +Title=Gambas JIT compiler support +Startup=Main +Version=3.10.90 +VersionFile=1 +Authors="Benoît Minisini" +TabSize=2 +Language=fr +Type=Component +Maintainer=benoit +Address=benoit@localhost +License=General Public Licence +Packager=1 diff --git a/comp/src/gb.jit/.src/Main.module b/comp/src/gb.jit/.src/Main.module new file mode 100644 index 000000000..96188747b --- /dev/null +++ b/comp/src/gb.jit/.src/Main.module @@ -0,0 +1,7 @@ +' Gambas module file + +Public Sub Main() + + + +End diff --git a/comp/src/gb.jit/.src/_Jit.module b/comp/src/gb.jit/.src/_Jit.module new file mode 100644 index 000000000..1390b3c75 --- /dev/null +++ b/comp/src/gb.jit/.src/_Jit.module @@ -0,0 +1,55 @@ +' Gambas module file + +Export + +Private $sCompiler As String + +Private Sub FindCompiler() + + $sCompiler = System.Find("gcc") + +End + +Public Sub Compile() As String + + Dim sFile As String + Dim sDir As String + Dim sName As String + Dim sPath As String + Dim hFile As File + Dim sResult As String + + sName = Component.FindFromPath("..") + sDir = File.Dir(Temp$()) &/ "jit" + Try Mkdir sDir + sPath = sDir &/ sName & ".c" + + hFile = Open sPath For Output Create + + Print #hFile, File.Load("gambas.h"); + Print #hFile, File.Load("jit.h"); + + sDir = "../.jit" + For Each sFile In Dir(sDir, "*.c") + Print #hFile, File.Load(sDir &/ sFile); + Next + + Close #hFile + + FindCompiler + 'gcc -c -fPIC -o foo.o foo.c + Exec [$sCompiler, "-c", "-fPIC", "-o", File.SetExt(sPath, "o"), sPath] To sResult + If Process.LastValue Then + Error("gb.jit: warning: unable to compile JIT code: " & sResult) + Return + Endif + 'gcc -shared -o libfoo.so foo.o + Exec [$sCompiler, "-shared", "-o", File.SetExt(sPath, "so"), File.SetExt(sPath, "o")] To sResult + If Process.LastValue Then + Error("gb.jit: warning: unable to link JIT code: " & sResult) + Return + Endif + + Return File.SetExt(sPath, "so") + +End diff --git a/comp/src/gb.jit/gambas.h b/comp/src/gb.jit/gambas.h new file mode 120000 index 000000000..e63efa23a --- /dev/null +++ b/comp/src/gb.jit/gambas.h @@ -0,0 +1 @@ +../../../main/share/gambas.h \ No newline at end of file diff --git a/comp/src/gb.jit/jit.h b/comp/src/gb.jit/jit.h new file mode 100644 index 000000000..e69de29bb