add library

This commit is contained in:
2025-05-30 19:11:53 +05:00
parent a6c2e1dc4c
commit c835c44872
14 changed files with 270959 additions and 0 deletions

37
shell/Makefile Executable file
View File

@@ -0,0 +1,37 @@
CC = kos32-gcc
LD = kos32-ld
ifeq ($(OS),Windows_NT)
TOOLCHAIN_PATH=C:/MinGW/msys/1.0/home/autobuild/tools/win32
else
TOOLCHAIN_PATH=/home/autobuild/tools/win32
endif
SDK_DIR = $(abspath ../../../../sdk)
DEFINES = -DSQLITE_OS_OTHER=1 -DHAVE_UNISTD_H=0 -D_NO_STDERR -DSQLITE_OMIT_POPEN -DSQLITE_THREADSAFE=0 -D_KOLIBRI -U__linux__ -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.36.0\" -DPACKAGE_STRING=\"sqlite\ 3.36.0\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.36.0\"
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 $(DEFINES) -I $(TOOLCHAIN_PATH)/include
LDFLAGS = -static -S -nostdlib -T app.lds --image-base 0
INCLUDES = -I $(TOOLCHAIN_PATH)/include -I..
LIBPATH = -L $(SDK_DIR)/lib -L $(TOOLCHAIN_PATH)/lib -L..
# Only selected
SRC = shell.c stub.c
# All .c files
# SRC = $(notdir $(wildcard *.c))
OBJECTS = $(patsubst %.c, %.o, $(SRC))
default: $(patsubst %.c,%.o,$(SRC))
kos32-ld $(LDFLAGS) $(LIBPATH) --subsystem console -o sqlite3 $(OBJECTS) -lgcc -lsqlite3.dll -lc.dll
strip -S sqlite3
objcopy sqlite3 -O binary
%.o : %.c Makefile $(SRC)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
clean:
rm *.o

21563
shell/shell.c Normal file

File diff suppressed because it is too large Load Diff

3
shell/stub.c Normal file
View File

@@ -0,0 +1,3 @@
int chmod(char *dir, int fake_mode){
return 1;
}

40
shell/test.c Normal file
View File

@@ -0,0 +1,40 @@
#include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
sqlite3 *db;
sqlite3_stmt *res;
int rc = sqlite3_open(":memory:", &db);
if (rc != SQLITE_OK) {
fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
return 1;
}
rc = sqlite3_prepare_v2(db, "SELECT SQLITE_VERSION()", -1, &res, 0);
if (rc != SQLITE_OK) {
fprintf(stderr, "Failed to fetch data: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
return 1;
}
rc = sqlite3_step(res);
if (rc == SQLITE_ROW) {
printf("%s\n", sqlite3_column_text(res, 0));
}
sqlite3_finalize(res);
sqlite3_close(db);
return 0;
}