Skip to content

Commit 52026aa

Browse files
authored
Merge pull request #265 from chrisws/12_32_2
12 32 2
2 parents 66ba6fc + 330883b commit 52026aa

58 files changed

Lines changed: 1454 additions & 402 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ set(VERSION "12.29")
99
cmake_minimum_required(VERSION 3.10)
1010
project(SmallBASIC VERSION ${VERSION} LANGUAGES C CXX)
1111

12-
set(CMAKE_CXX_STANDARD 14)
12+
# clang-check ../*.cpp
13+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
14+
set(CMAKE_CXX_STANDARD 20)
1315
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1416

1517
# cmake -DWITH_DEBUG=ON
@@ -85,7 +87,7 @@ function(buildSDL)
8587
include_directories(${FONTCONFIG_INCLUDE_DIRS})
8688
add_compile_options(${FONTCONFIG_CFLAGS_OTHER})
8789
execute_process(
88-
COMMAND ${XXD_EXECUTABLE} -i images/sb-desktop-128x128.png
90+
COMMAND ${XXD_EXECUTABLE} -i ${CMAKE_SOURCE_DIR}/images/io.github.smallbasic.png
8991
OUTPUT_FILE ${CMAKE_BINARY_DIR}/src/platform/sdl/icon.h
9092
)
9193
endif()
@@ -109,8 +111,9 @@ function(buildSDL)
109111
set(IMPL_LOG_WRITE ON)
110112

111113
# Process assets
114+
message("generating main_bas.h")
112115
execute_process(
113-
COMMAND ${XXD_EXECUTABLE} -i src/platform/android/app/src/main/assets/main.bas
116+
COMMAND ${XXD_EXECUTABLE} -i ${CMAKE_SOURCE_DIR}/src/platform/android/app/src/main/assets/main.bas
114117
OUTPUT_FILE ${CMAKE_BINARY_DIR}/src/platform/sdl/main_bas.h
115118
)
116119
writeConfig()

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2026-01-20 (12.32)
2+
SDL: Created flatpak based build
3+
4+
2025-10-14 (12.32)
5+
ANDROID: replace react/mui based portal with native javascript solution
6+
17
2025-09-11 (12.31)
28
ANDROID: Implemented support for editing with the system keypad
39

Makefile.am

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,53 @@ appImage:
6868
~/apps/linuxdeploy-x86_64.AppImage --appdir=AppDir --executable=./src/platform/fltk/sbasici && \
6969
~/apps/appimagetool-x86_64.AppImage AppDir
7070

71+
#
72+
# flatpak install flathub org.flatpak.Builder
73+
# sudo apt install flatpak-builder
74+
# https://docs.flathub.org/docs/for-app-authors/submission
75+
#
76+
# inspect build-dir/files (or /app from flatpack-shell) for additional "cleanup" items
77+
#
78+
79+
# starting from scratch, download and build all dependencies
80+
flatpak-build:
81+
flatpak-builder --force-clean --ccache build-dir io.github.smallbasic.SmallBASIC.json
82+
83+
# development workflow
84+
flatpak-run:
85+
make -s -j$(nproc) && \
86+
flatpak-builder --user --install --force-clean --ccache --disable-download build-dir io.github.smallbasic.SmallBASIC.json && \
87+
flatpak run io.github.smallbasic.SmallBASIC
88+
89+
# debugging specific flatpak issues
90+
flatpak-debug:
91+
make -s -j$(nproc) && \
92+
flatpak-builder --build-only --force-clean --ccache --disable-download --disable-updates build-dir io.github.smallbasic.SmallBASIC.json && \
93+
flatpak-builder --run build-dir io.github.smallbasic.SmallBASIC.json gdb sbasicg
94+
95+
# to inspect the built components - requires commenting deletion of xxd
96+
flatpak-shell:
97+
flatpak-builder --build-shell=sbasicg build-dir io.github.smallbasic.SmallBASIC.json
98+
99+
# how to invoke the command line sbasic
100+
flatpak-command:
101+
flatpak run --filesystem=`pwd` --command=sbasic io.github.smallbasic.SmallBASIC $1
102+
103+
# preparing for release
104+
flatpak-lint1:
105+
flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest io.github.smallbasic.SmallBASIC.json
106+
107+
flatpak-lint2:
108+
flatpak run --command=flatpak-builder-lint org.flatpak.Builder builddir build-dir
109+
110+
# extra step 1 preparing for release
111+
flatpak-create-repo:
112+
flatpak-builder --repo=repo build-dir io.github.smallbasic.SmallBASIC.json
113+
114+
# extra step 2 preparing for release
115+
flatpak-lint3:
116+
flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo repo
117+
71118
EXTRA_DIST = \
72119
documentation/build_kwp.cpp \
73120
documentation/sbasic_ref.csv \

configure.ac

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [12.31])
10+
AC_INIT([smallbasic], [12.32])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET
@@ -174,6 +174,9 @@ function buildSDL() {
174174

175175
PKG_CHECK_MODULES([SDL3], [sdl3])
176176

177+
AC_MSG_CHECKING([for SDL3 library linking])
178+
SDL3_LIBS=`pkg-config sdl3 --libs --static`
179+
177180
SAVED_CPPFLAGS="$CPPFLAGS"
178181
CPPFLAGS="$CPPFLAGS `pkg-config freetype2 --cflags`"
179182
AC_CHECK_HEADERS([ft2build.h], [], [AC_MSG_ERROR([libfreetype6-dev not installed: configure failed.])])
@@ -184,6 +187,15 @@ function buildSDL() {
184187
AC_MSG_ERROR([xxd command not installed: configure failed.])
185188
fi
186189

190+
AC_ARG_WITH(flatpak,
191+
[ --with-flatpak Build the flatpak version default=no],
192+
[with_flatpak=$withval],
193+
[with_flatpak=no])
194+
if test "$with_flatpak" = "yes" || test "$with_flatpak" = "full"
195+
then
196+
AC_DEFINE(_FLATPAK, 1, [flatpak build enabled])
197+
fi
198+
187199
case "${host_os}" in
188200
*mingw* | cygwin*)
189201
dnl avoid using MSCRT versions of printf for long double
@@ -222,11 +234,7 @@ function buildSDL() {
222234

223235
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} ${FONTCONFIG_CFLAGS}"
224236

225-
(cd images && xxd -i sb-desktop-128x128.png > ../src/platform/sdl/icon.h)
226-
227-
AC_MSG_CHECKING([for SDL3 library linking])
228-
SDL3_LIBS=`pkg-config sdl3 --libs --static`
229-
AC_MSG_RESULT([$SDL3_LIBS])
237+
(cd images && xxd -i io.github.smallbasic.SmallBASIC.png > ../src/platform/sdl/icon.h)
230238

231239
dnl backlinking support for modules
232240
PACKAGE_LIBS="${PACKAGE_LIBS} -ldl -no-pie"
@@ -271,7 +279,6 @@ function buildAndroid() {
271279
TEST_DIR="src/platform/android"
272280
AC_SUBST(TEST_DIR)
273281
if test $with_library = no; then
274-
(cd src/platform/android/webui && npm run build)
275282
TARGET="Building for Android."
276283
else
277284
TARGET="Building for Android library."
@@ -351,6 +358,14 @@ function buildWeb() {
351358
PACKAGE_LIBS="${PACKAGE_LIBS} -lm -ldl -lpthread -lmicrohttpd"
352359
AC_CHECK_HEADERS([microhttpd.h], [], [AC_MSG_ERROR([microhttpd is not installed])])
353360
fi
361+
362+
AC_CHECK_HEADERS([curl/curl.h], [have_curl_h=yes; break;])
363+
364+
if test "x${have_curl_h}" = "xyes" ; then
365+
AC_DEFINE(USE_LIB_CURL, 1, [use the curl library.])
366+
PACKAGE_LIBS="${PACKAGE_LIBS} -lcurl"
367+
fi
368+
354369
BUILD_SUBDIRS="src/common src/platform/web"
355370
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
356371
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
@@ -385,6 +400,17 @@ function buildTEENSY() {
385400
if test "${have_xxd}" = "no" ; then
386401
AC_MSG_ERROR([xxd command not installed: configure failed.])
387402
fi
403+
AC_CHECK_PROG([ARM_GCC], [arm-none-eabi-gcc], [yes], [no])
404+
AC_CHECK_PROG([ARM_GXX], [arm-none-eabi-g++], [yes], [no])
405+
if test "$ARM_GCC" = "no"; then
406+
AC_MSG_ERROR([arm-none-eabi-gcc not found in PATH. Please install gcc-arm-none-eabi.])
407+
fi
408+
if test "$ARM_GXX" = "no"; then
409+
AC_MSG_ERROR([arm-none-eabi-g++ not found in PATH. Please install g++-arm-none-eabi.])
410+
fi
411+
PKG_CHECK_MODULES([LIBUSB], [libusb], [],
412+
[AC_MSG_ERROR([libusb not found. Please install libusb-dev])]
413+
)
388414
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
389415
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
390416
AC_DEFINE(_MCU, 1, [Micro controller based builds])
@@ -482,7 +508,7 @@ checkProfiling
482508
checkForWindows
483509

484510
CFLAGS="${CFLAGS} -std=gnu11"
485-
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Wno-unused-result"
511+
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Werror -Wno-unused-result"
486512
BUILD_DATE=`date +"%a, %d %b %Y"`
487513
AC_DEFINE_UNQUOTED([BUILD_DATE],["$BUILD_DATE"],[Build date])
488514

6.81 KB
Loading

images/io.github.smallbasic.png

6.81 KB
Loading
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"app-id": "io.github.smallbasic.SmallBASIC",
3+
"runtime": "org.freedesktop.Platform",
4+
"runtime-version": "25.08",
5+
"sdk": "org.freedesktop.Sdk",
6+
"command": "sbasicg",
7+
"build-options": {
8+
"env": {
9+
"MAKEFLAGS": "-j$(nproc) -s"
10+
}
11+
},
12+
"finish-args": [
13+
"--socket=wayland",
14+
"--socket=fallback-x11",
15+
"--socket=pulseaudio",
16+
"--device=dri",
17+
"--share=ipc",
18+
"--env=SBASICPATH=/app/lib/smallbasic/plugins"
19+
],
20+
"cleanup": [
21+
"/include",
22+
"/lib/pkgconfig",
23+
"/lib/cmake",
24+
"/bin/xxd",
25+
"*.a",
26+
"*.la"
27+
],
28+
"modules": [
29+
{
30+
"name": "smallbasic-plugins",
31+
"buildsystem": "simple",
32+
"build-commands": [
33+
"./autogen.sh",
34+
"./configure --prefix=/app",
35+
"make -s",
36+
"mkdir -p ${FLATPAK_DEST}/lib/smallbasic/plugins",
37+
"find . -name '*.so' -exec install -Dm755 {} ${FLATPAK_DEST}/lib/smallbasic/plugins/ \\;"
38+
],
39+
"sources": [
40+
{
41+
"type": "git",
42+
"url": "https://github.com/smallbasic/smallbasic.plugins.git",
43+
"commit": "12_32"
44+
}
45+
]
46+
}, {
47+
"name": "xxd",
48+
"buildsystem": "simple",
49+
"build-commands": [
50+
"cd src/xxd && make CC=gcc CFLAGS='-O2'",
51+
"install -Dm755 src/xxd/xxd /app/bin/xxd"
52+
],
53+
"sources": [
54+
{
55+
"type": "git",
56+
"url": "https://github.com/vim/vim.git",
57+
"tag": "v9.1.0"
58+
}
59+
]
60+
}, {
61+
"name": "SDL3",
62+
"buildsystem": "cmake-ninja",
63+
"config-opts": [
64+
"-DCMAKE_BUILD_TYPE=Release"
65+
],
66+
"sources": [
67+
{
68+
"type": "git",
69+
"url": "https://github.com/libsdl-org/SDL.git",
70+
"tag": "release-3.2.26"
71+
}
72+
]
73+
}, {
74+
"name": "sbasic",
75+
"buildsystem": "autotools",
76+
"config-opts": [
77+
"--prefix=/app"
78+
],
79+
"sources": [
80+
{
81+
"type": "dir",
82+
"path": "."
83+
}
84+
],
85+
"build-commands": [
86+
"make install -s -j$(nproc)"
87+
]
88+
}, {
89+
"name": "sbasicg",
90+
"buildsystem": "autotools",
91+
"autogen": true,
92+
"config-opts": [
93+
"--prefix=/app",
94+
"--enable-sdl",
95+
"--with-flatpak"
96+
],
97+
"sources": [
98+
{
99+
"type": "dir",
100+
"path": "."
101+
}
102+
]
103+
}
104+
]
105+
}

src/common/blib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ bcip_t cmd_push_args(int cmd, bcip_t goto_addr, bcip_t rvid) {
10021002

10031003
prog_ip = ofs; // back to the start of the expression
10041004
// now we are sure, this parameter is not a single variable
1005-
// no 'break' here
1005+
// fallthrough
10061006

10071007
default:
10081008
// default: the parameter is an expression
@@ -1096,7 +1096,7 @@ void cmd_call_unit_udp(int cmd, int udp_tid, bcip_t goto_addr, bcip_t rvid) {
10961096

10971097
prog_ip = ofs; // back to the start of the expression
10981098
// now we are sure, this parameter is not a single variable
1099-
// no 'break' here
1099+
// fallthrough
11001100

11011101
default:
11021102
// default: the parameter is an expression

src/common/blib_func.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,8 @@ void cmd_genfunc(long funcCode, var_t *r) {
25742574
}
25752575
}
25762576
prog_ip = ofs;
2577-
// no 'break' here
2577+
// fallthrough
2578+
25782579
default:
25792580
// default --- expression
25802581
v_init(&arg);
@@ -2646,7 +2647,8 @@ void cmd_genfunc(long funcCode, var_t *r) {
26462647
}
26472648
}
26482649
prog_ip = ofs;
2649-
// no 'break' here
2650+
// fallthrough
2651+
26502652
default:
26512653
// default --- expression
26522654
v_init(&arg);

src/common/brun.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ void exec_setup_predefined_variables() {
288288
}
289289
}
290290
#elif defined(_UnixOS)
291-
if (getenv("HOME")) {
291+
if (getenv("XDG_DATA_HOME")) {
292+
strlcpy(homedir, getenv("XDG_DATA_HOME"), sizeof(homedir));
293+
} else if (getenv("HOME")) {
292294
strlcpy(homedir, getenv("HOME"), sizeof(homedir));
293295
} else {
294296
strcpy(homedir, "/tmp/");
@@ -1641,6 +1643,7 @@ int sbasic_exec(const char *file) {
16411643
opt_show_page = 0;
16421644

16431645
// setup global values
1646+
gsb_err_mod_perm = 0;
16441647
gsb_last_line = gsb_last_error = 0;
16451648
strlcpy(gsb_last_file, file, sizeof(gsb_last_file));
16461649
strcpy(gsb_last_errmsg, "");
@@ -1654,6 +1657,8 @@ int sbasic_exec(const char *file) {
16541657
} else if (!success) { // there was some errors; do not continue
16551658
exec_rq = 0;
16561659
gsb_last_error = 1;
1660+
} else if (gsb_err_mod_perm) {
1661+
exec_rq = 0; // a module was not permitted to run
16571662
}
16581663

16591664
if (exec_rq) { // we will run it

0 commit comments

Comments
 (0)