First commit of compilable code for OS4
This commit is contained in:
parent
b086db24e8
commit
c155f797cf
|
@ -59,17 +59,20 @@ end
|
||||||
|
|
||||||
|
|
||||||
function core.reschedule_project_scan()
|
function core.reschedule_project_scan()
|
||||||
if core.project_scan_thread_id then
|
-- if core.project_scan_thread_id then
|
||||||
core.threads[core.project_scan_thread_id].wake = 0
|
-- core.threads[core.project_scan_thread_id].wake = 0
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function core.set_project_dir(new_dir, change_project_fn)
|
function core.set_project_dir(new_dir, change_project_fn)
|
||||||
|
-- print("LUA DBG: before pcall " .. tostring(new_dir))
|
||||||
local chdir_ok = pcall(system.chdir, new_dir)
|
local chdir_ok = pcall(system.chdir, new_dir)
|
||||||
|
-- print("LUA DBG: after pcall " .. tostring(chdir_ok))
|
||||||
if chdir_ok then
|
if chdir_ok then
|
||||||
if change_project_fn then change_project_fn() end
|
if change_project_fn then change_project_fn() end
|
||||||
core.project_dir = normalize_path(new_dir)
|
core.project_dir = normalize_path(new_dir)
|
||||||
|
-- print("LUA DBG: after normalize_path " .. tostring(new_dir) .. "\n" .. tostring(core.project_dir))
|
||||||
core.project_directories = {}
|
core.project_directories = {}
|
||||||
core.add_project_directory(new_dir)
|
core.add_project_directory(new_dir)
|
||||||
core.project_files = {}
|
core.project_files = {}
|
||||||
|
@ -503,6 +506,7 @@ function core.init()
|
||||||
update_recents_project("remove", project_dir)
|
update_recents_project("remove", project_dir)
|
||||||
end
|
end
|
||||||
project_dir_abs = system.absolute_path(".")
|
project_dir_abs = system.absolute_path(".")
|
||||||
|
-- print("LUA DBG: project_dir_abs " .. tostring(project_dir_abs))
|
||||||
if not core.set_project_dir(project_dir_abs) then
|
if not core.set_project_dir(project_dir_abs) then
|
||||||
system.show_fatal_error("Lite XL internal error", "cannot set project directory to cwd")
|
system.show_fatal_error("Lite XL internal error", "cannot set project directory to cwd")
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cflags="-D__USE_INLINE__ -DLITE_XL_DATA_USE_EXEDIR -DLITE_USE_SDL_RENDERER -Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc -Ilib/font_renderer -I/sdk/local/newlib/include/SDL2 -lSDL2 -llua -lauto"
|
||||||
|
#cflags+=" $(pkg-config --cflags lua5.2) $(sdl2-config --cflags)"
|
||||||
|
lflags="-mcrt=newlib -static-libgcc -static-libstdc++ -lSDL2 -lagg -lfreetype -llua -lm -lpthread -athread=native"
|
||||||
|
#for package in libagg freetype2 lua5.2; do
|
||||||
|
# lflags+=" $(pkg-config --libs $package)"
|
||||||
|
#done
|
||||||
|
#lflags+=" $(sdl2-config --libs) -lm"
|
||||||
|
|
||||||
|
#if [[ $* == *windows* ]]; then
|
||||||
|
# echo "cross compiling for windows is not yet supported"
|
||||||
|
# exit 1
|
||||||
|
#else
|
||||||
|
outfile="lite"
|
||||||
|
compiler="gcc"
|
||||||
|
cxxcompiler="g++"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#lib/font_renderer/build.sh || exit 1
|
||||||
|
#libs=libfontrenderer.a
|
||||||
|
libs="-lfontrenderer"
|
||||||
|
|
||||||
|
echo "compiling lite..."
|
||||||
|
|
||||||
|
gcc -c $cflags src/fontdesc.c -o fontdesc.o
|
||||||
|
gcc -c $cflags src/main.c -o main.o
|
||||||
|
gcc -c $cflags src/rencache.c -o rencache.o
|
||||||
|
gcc -c $cflags src/renderer.c -o renderer.o
|
||||||
|
gcc -c $cflags src/renwindow.c -o renwindow.o
|
||||||
|
|
||||||
|
gcc -c $cflags src/api/api.c -o api.o
|
||||||
|
gcc -c $cflags src/api/cp_replace.c -o cp_replace.o
|
||||||
|
gcc -c $cflags src/api/renderer.c -o apirenderer.o
|
||||||
|
gcc -c $cflags src/api/renderer_font.c -o renderer_font.o
|
||||||
|
gcc -c $cflags src/api/system.c -o system.o
|
||||||
|
|
||||||
|
gcc -c $cflags src/platform/amigaos4.c -o amigaos4.o
|
||||||
|
|
||||||
|
echo "linking..."
|
||||||
|
g++ -o $outfile *.o $libs $lflags
|
||||||
|
|
||||||
|
echo "cleaning up..."
|
||||||
|
rm *.o
|
||||||
|
echo "done"
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __amigaos4__
|
||||||
|
#include "platform/amigaos4.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
extern SDL_Window *window;
|
extern SDL_Window *window;
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,9 +427,14 @@ static int f_list_dir(lua_State *L) {
|
||||||
#define realpath(x, y) _fullpath(y, x, MAX_PATH)
|
#define realpath(x, y) _fullpath(y, x, MAX_PATH)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __amigaos4__
|
||||||
|
#define realpath(x, y) _fullpath(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
static int f_absolute_path(lua_State *L) {
|
static int f_absolute_path(lua_State *L) {
|
||||||
const char *path = luaL_checkstring(L, 1);
|
const char *path = luaL_checkstring(L, 1);
|
||||||
char *res = realpath(path, NULL);
|
char *res = realpath(path, NULL);
|
||||||
|
//printf("DBG: f_absolute_path() %s\n", res);
|
||||||
if (!res) { return 0; }
|
if (!res) { return 0; }
|
||||||
lua_pushstring(L, res);
|
lua_pushstring(L, res);
|
||||||
free(res);
|
free(res);
|
||||||
|
|
|
@ -70,6 +70,10 @@ static void get_exe_filename(char *buf, int sz) {
|
||||||
char exepath[size];
|
char exepath[size];
|
||||||
_NSGetExecutablePath(exepath, &size);
|
_NSGetExecutablePath(exepath, &size);
|
||||||
realpath(exepath, buf);
|
realpath(exepath, buf);
|
||||||
|
#elif __amigaos4__
|
||||||
|
#include "platform/amigaos4.h"
|
||||||
|
// TODO: Add code to get the name of the executable
|
||||||
|
strcpy(buf, _fullpath("PROGDIR:lite"));
|
||||||
#else
|
#else
|
||||||
strcpy(buf, "./lite");
|
strcpy(buf, "./lite");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "amigaos4.h"
|
||||||
|
|
||||||
|
// TODO: check if this is set in SDK
|
||||||
|
#define MAX_PATH_SIZE 255
|
||||||
|
|
||||||
|
char *_fullpath(const char *path)
|
||||||
|
{
|
||||||
|
//rintf("DBG: _fullpath() %s\n", path);
|
||||||
|
|
||||||
|
if (strcmp(path, "."))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
STRPTR appPath = AllocVecTags(sizeof(char) * MAX_PATH_SIZE,
|
||||||
|
AVT_Type, MEMF_SHARED,
|
||||||
|
AVT_ClearWithValue, "\0",
|
||||||
|
TAG_DONE);
|
||||||
|
*/
|
||||||
|
char *appPath = malloc(sizeof(char) * MAX_PATH_SIZE);
|
||||||
|
|
||||||
|
BPTR pathLock = Lock(path, SHARED_LOCK);
|
||||||
|
if (pathLock)
|
||||||
|
{
|
||||||
|
//BPTR parentLock = ParentDir(pathLock);
|
||||||
|
NameFromLock(pathLock, appPath, sizeof(char) * MAX_PATH_SIZE);
|
||||||
|
|
||||||
|
//printf("DBG: apppath %s\n", appPath);
|
||||||
|
//UnLock(parentLock);
|
||||||
|
UnLock(pathLock);
|
||||||
|
|
||||||
|
return appPath;
|
||||||
|
//return "ram:";
|
||||||
|
}
|
||||||
|
//printf("DBG: pathLock failed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Deal with . path
|
||||||
|
if (!strcmp(path, "."))
|
||||||
|
{
|
||||||
|
//printf("DBG: return app folder\n");
|
||||||
|
return "Applications:Programming/workspace/MyProjects/lite-xl_v1.16.12";
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef _AMIGAOS4_H
|
||||||
|
#define _AMIGAOS4_H
|
||||||
|
|
||||||
|
#include <proto/dos.h>
|
||||||
|
#include <proto/exec.h>
|
||||||
|
|
||||||
|
char *_fullpath(const char *);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue