Skip to content

Commit 64fecdc

Browse files
authored
Merge pull request #272 from mnsanghvi/issue-271-support-freebsd
Issue 217 support freebsd
2 parents 3ed6f08 + 2557b1a commit 64fecdc

File tree

11 files changed

+148
-23
lines changed

11 files changed

+148
-23
lines changed

.gitignore

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# SmallBasic build related
2+
# ------------------------
3+
# SmallBasic dynamically generates a lot of files when
4+
# built from source. This list should help declutter the
5+
# `git status` output
6+
Makefile
7+
Makefile.in
8+
INSTALL
9+
README
10+
.dirstamp
11+
build_kwp
12+
*.sbu
13+
acinclude.m4
14+
aclocal.m4
15+
autom4te.cache
16+
compile
17+
config.guess
18+
config.h
19+
config.h.in
20+
config.status
21+
config.sub
22+
configure
23+
depcomp
24+
install-sh
25+
missing
26+
*.dat
27+
src/common/libsb_common.a
28+
src/platform/console/sbasic
29+
src/ui/kwp.h
30+
stamp-h1
31+
tsave.txt
32+
Test-Results
33+
34+
# C/C++/Obj-C
35+
# -----------
36+
*.o
37+
*.deps
38+
39+
# Gradle
40+
# ------
41+
.gradle/*
42+
**/build/*
43+
/buildSrc/build
44+
/subprojects/*/build
45+
/subprojects/docs/src/samples/*/*/build
46+
/subprojects/internal-android-performance-testing/build-android-libs
47+
48+
# Maven
49+
# -----
50+
**/target/*
51+
52+
# IDEA
53+
# ----
54+
.idea
55+
.shelf
56+
/*.iml
57+
/*.ipr
58+
/*.iws
59+
/buildSrc/*.iml
60+
/buildSrc/*.ipr
61+
/buildSrc/*.iws
62+
/buildSrc/out
63+
/out
64+
/subprojects/*/*.iml
65+
/subprojects/*/out
66+
67+
# Eclipse
68+
# -------
69+
*.classpath
70+
*.project
71+
*.settings
72+
/bin
73+
/subprojects/*/bin
74+
atlassian-ide-plugin.xml
75+
76+
# NetBeans
77+
# --------
78+
.nb-gradle
79+
.nb-gradle-properties
80+
81+
# Vim
82+
# ---
83+
*.sw[op]
84+
85+
# Emacs
86+
# -----
87+
*~
88+
89+
# Textmate
90+
# --------
91+
.textmate
92+
93+
# Sublime Text
94+
# ------------
95+
*.sublime-*
96+
97+
# jEnv
98+
# ----
99+
.java-version
100+
101+
# OS X
102+
# ----
103+
.DS_Store
104+
105+
# HPROF
106+
# -----
107+
*.hprof
108+
109+
# Work dirs
110+
# ---------
111+
/incoming-distributions
112+
/intTestHomeDir
113+
114+
# Logs
115+
# ----
116+
/*.log
117+
118+
# oh-my-zsh gradle plugin
119+
.gradletasknamecache

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ Gary A. Clark clarkg@fireserve.net gac
44
Bob Riess riessb@usa.net bob
55
Earle F. Philhower III earle@ziplabel.com efp
66
Laurent Poujoulat lpoujoulat@wanadoo.fr lap
7+
Mehul Sanghvi mehul.sanghvi@gmail.com mnsanghvi
78

89

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2026-02-26 (12.33)
2+
COMMON: Fix build for FreeBSD
3+
14
2026-01-23 (12.33)
25
SDL: Fix issue with flatpak release
36

autogen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env sh
22

33
# This file is part of SmallBASIC
44
#

configure.ac

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ AC_ARG_ENABLE(teensy,
5858
[ac_build_teensy="yes"],
5959
[ac_build_teensy="no"])
6060

61-
function checkForWindows() {
61+
checkForWindows() {
6262
win32=no
6363
case "${host_os}" in
6464
*mingw* | pw32* | cygwin*)
@@ -72,7 +72,7 @@ function checkForWindows() {
7272
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
7373
}
7474

75-
function checkDebugMode() {
75+
checkDebugMode() {
7676
AC_MSG_CHECKING([if debug mode is enabled])
7777
AC_ARG_WITH(debug,
7878
[ --with-debug Build the debug version default=no],
@@ -90,7 +90,7 @@ function checkDebugMode() {
9090
AC_SUBST(CFLAGS)
9191
}
9292

93-
function checkProfiling() {
93+
checkProfiling() {
9494
AC_MSG_CHECKING([if profile generate is enabled])
9595
AC_ARG_WITH(profile-generate,
9696
[ --with-profile-generate Build the profile generate default=no],
@@ -116,7 +116,7 @@ function checkProfiling() {
116116
fi
117117
}
118118

119-
function checkPCRE() {
119+
checkPCRE() {
120120
AC_CHECK_PROG(have_pcre, pcre-config, [yes], [no])
121121

122122
dnl supported under linux only for now
@@ -143,7 +143,7 @@ function checkPCRE() {
143143
fi
144144
}
145145

146-
function checkTermios() {
146+
checkTermios() {
147147
AC_CHECK_HEADERS([termios.h], [have_termios_h=yes; break;])
148148

149149
case "${host_os}" in
@@ -164,11 +164,11 @@ function checkTermios() {
164164
fi
165165
}
166166

167-
function defaultConditionals() {
167+
defaultConditionals() {
168168
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
169169
}
170170

171-
function buildSDL() {
171+
buildSDL() {
172172
TARGET="Building SDL version."
173173
defaultConditionals
174174

@@ -259,7 +259,7 @@ function buildSDL() {
259259
(cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/sdl/main_bas.h)
260260
}
261261

262-
function buildAndroid() {
262+
buildAndroid() {
263263
defaultConditionals
264264

265265
AC_MSG_CHECKING([if library mode is enabled])
@@ -286,7 +286,7 @@ function buildAndroid() {
286286
fi
287287
}
288288

289-
function buildConsole() {
289+
buildConsole() {
290290
win32=no
291291
case "${host_os}" in
292292
*mingw* | pw32* | cygwin*)
@@ -345,7 +345,7 @@ function buildConsole() {
345345
AC_SUBST(BUILD_SUBDIRS)
346346
}
347347

348-
function buildWeb() {
348+
buildWeb() {
349349
if test $host_os = 'mingw32'; then
350350
TARGET="Building Ming32 Web server version."
351351
AC_DEFINE(__MINGW32__, 1, [as above])
@@ -375,7 +375,7 @@ function buildWeb() {
375375
AC_SUBST(BUILD_SUBDIRS)
376376
}
377377

378-
function buildEmscripten() {
378+
buildEmscripten() {
379379
TARGET="Building Emscripten version."
380380
BUILD_SUBDIRS="src/common src/platform/emcc"
381381
AC_CHECK_PROG(have_xxd, xxd, [yes], [no])
@@ -393,7 +393,7 @@ function buildEmscripten() {
393393
(cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/emcc/main_bas.h)
394394
}
395395

396-
function buildTEENSY() {
396+
buildTEENSY() {
397397
TARGET="Building teensy version."
398398
BUILD_SUBDIRS="src/platform/teensy"
399399
AC_CHECK_PROG(have_xxd, xxd, [yes], [no])
@@ -422,7 +422,7 @@ function buildTEENSY() {
422422
(cd src/platform/teensy && xxd -i main.bas > src/main_bas.h)
423423
}
424424

425-
function buildFLTK() {
425+
buildFLTK() {
426426
TARGET="Building FLTK version."
427427

428428
dnl Checks for FLTK 1.x
@@ -480,7 +480,7 @@ function buildFLTK() {
480480
AC_SUBST(desktopentrydir)
481481

482482
dnl generate kwp.h
483-
(cd src/platform/fltk && g++ -o build_kwp build_kwp.cxx && ./build_kwp)
483+
(cd src/platform/fltk && ${CXX} -o build_kwp build_kwp.cxx && ./build_kwp)
484484
}
485485

486486
if test x$ac_build_sdl = xyes; then
@@ -499,7 +499,7 @@ else
499499
buildConsole
500500
fi
501501

502-
(cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
502+
(cd documentation && ${CXX} -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
503503

504504
checkPCRE
505505
checkTermios
@@ -512,7 +512,8 @@ PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Werror -Wno-unused-result"
512512
BUILD_DATE=`date +"%a, %d %b %Y"`
513513
AC_DEFINE_UNQUOTED([BUILD_DATE],["$BUILD_DATE"],[Build date])
514514

515-
SB_DWORD_VER=`awk -F "." '{printf "0x%02d%02d%02d", $1,$2,$3}' <<< ${PACKAGE_VERSION}`
515+
SB_DWORD_VER=$(printf '%s' "$PACKAGE_VERSION" | awk -F. '{printf "0x%02d%02d%02d", $1,$2,$3}')
516+
516517
AC_DEFINE_UNQUOTED([SB_DWORD_VER],[$SB_DWORD_VER],[SB_DWORD_VER])
517518

518519
AC_SUBST(PACKAGE_CFLAGS)

samples/distro-examples/tests/all.bas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inva=[1,-1,1;2,-1,2;3,2,-1]
1515
def expression(x) = x * 0.1
1616
DATA 1,"a"
1717

18-
print "ACCESS:" +IFF(ACCESS ("/etc/hostname") != 0, "<> 0", "0")
18+
print "ACCESS:" +IFF(ACCESS ("/etc/hosts") != 0, "<> 0", "0")
1919
print "APPEND:"; : APPEND c, "1", "2", "3", "4": PRINT c
2020
print "ARC:" ':ARC [STEP] x,y,r,astart,aend [,aspect [,color]] [COLOR color]
2121
print "AT:" ':AT x, y
@@ -147,7 +147,7 @@ print "FIX:" + FIX (x)
147147
print "FLOOR:" + FLOOR (x)
148148
print "FORMAT:" + FORMAT ("XXXX", 9999)
149149
print "FRAC:" + FRAC (x)
150-
print "FRE:" '+ FRE (x)
150+
print "FRE:" + FRE (1000)
151151
print "FREEFILE:" + FREEFILE
152152
print "HEX:" + HEX (x)
153153
print "IFF:" + IFF (1+1==2, "1+1=2", "1+1<>2")

samples/distro-examples/tests/output/all.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ FIX:13
130130
FLOOR:12
131131
FORMAT:XXXX
132132
FRAC:0.3
133-
FRE:
133+
FRE:0
134134
FREEFILE:1
135135
HEX:C
136136
IFF:1+1=2

src/common/blib_func.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ var_int_t cmd_fre(var_int_t arg) {
682682
r = 0x120000;
683683
break;
684684
}
685-
#elif defined(_UnixOS) && !defined(__MACH__)
685+
#elif defined(_UnixOS) && !defined(__MACH__) && !defined(__FreeBSD__)
686686
// assumes first two items are total + free
687687
#define I_MEM_TOTAL 0
688688
#define I_MEM_FREE 1

src/common/inet2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static int inetlib_init = 0;
2020
#else
2121
#include <arpa/inet.h>
2222
#include <sys/ioctl.h>
23+
#include <sys/socket.h>
2324
#include <netdb.h>
2425
#include <netinet/in.h>
2526
#include <signal.h>

src/platform/console/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ UNIT_TESTS=array break byref eval-test iifs matrices metaa ongoto \
3939

4040
test: ${bin_PROGRAMS}
4141
@for utest in $(UNIT_TESTS); do \
42-
./${bin_PROGRAMS} ${TEST_DIR}/$${utest}.bas > test.out; \
42+
./${bin_PROGRAMS} ${TEST_DIR}/$${utest}.bas > test.out || true; \
4343
if cmp -s test.out ${TEST_DIR}/output/$${utest}.out; then \
4444
echo $${utest} ✓; \
4545
else \

0 commit comments

Comments
 (0)