-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from stdgregwar/solarus-deps
Solarus deps
- Loading branch information
Showing
8 changed files
with
549 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pkgname=glm | ||
pkgver=0.9.9 | ||
pkgrel=1 | ||
pkgdesc="OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications." | ||
arch=('mips') | ||
url="https://glm.g-truc.net/" | ||
license=('MIT') | ||
depends=() | ||
makedepends=() | ||
optdepends=() | ||
provides=() | ||
source=( | ||
"git+https://github.com/g-truc/glm#tag=0.9.9.8" | ||
) | ||
|
||
sha256sums=( | ||
"SKIP" | ||
) | ||
|
||
package() { | ||
cd glm | ||
|
||
mkdir -m 755 -p "$pkgdir/psp/include/glm" | ||
cp -vr glm/* "$pkgdir/psp/include/glm" | ||
|
||
mkdir -m 755 -p "$pkgdir/psp/share/licenses/$pkgname" | ||
install -m 644 copying.txt "$pkgdir/psp/share/licenses/$pkgname" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
pkgname=libmodplug | ||
pkgver=0.8.8.5 | ||
pkgrel=1 | ||
pkgdesc="libmodplug - the library which was part of the Modplug-xmms project" | ||
arch=('mips') | ||
url="http://modplug-xmms.sf.net/" | ||
license=('public domain') | ||
depends=() | ||
makedepends=() | ||
optdepends=() | ||
provides=() | ||
source=( | ||
"git+https://github.com/Konstanty/libmodplug#commit=d7ba5efd5816696fba668a23194940f796d62b95" | ||
) | ||
sha256sums=( | ||
"SKIP" | ||
) | ||
|
||
build() { | ||
cd libmodplug | ||
mkdir pspbuild | ||
cd pspbuild | ||
psp-cmake .. -DCMAKE_INSTALL_PREFIX=${pkgdir}/psp | ||
make | ||
} | ||
|
||
package() { | ||
cd libmodplug | ||
make install -C pspbuild | ||
mkdir -m 755 -p "$pkgdir/psp/share/licenses/$pkgname" | ||
install -m 644 COPYING "$pkgdir/psp/share/licenses/$pkgname" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
pkgname=lua51 | ||
pkgver=5.1.5 | ||
pkgrel=1 | ||
pkgdesc="Lua programming language for PSP" | ||
arch=('mips') | ||
url="https://lua.org" | ||
license=('MIT') | ||
depends=() | ||
makedepends=() | ||
optdepends=() | ||
source=( | ||
"https://www.lua.org/ftp/lua-5.1.5.tar.gz" | ||
"psp.patch") | ||
sha256sums=( | ||
'2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333' | ||
'SKIP') | ||
|
||
prepare() { | ||
tar -xzf lua-5.1.5.tar.gz | ||
cd lua-5.1.5 | ||
patch -p1 < ../psp.patch | ||
} | ||
|
||
build() { | ||
cd lua-5.1.5 | ||
make -f Makefile.psp | ||
} | ||
|
||
package() { | ||
cd lua-5.1.5 | ||
make -f Makefile.psp PSPDIR="${pkgdir}/psp" install | ||
|
||
mkdir -m 755 -p "$pkgdir/psp/share/licenses/$pkgname" | ||
install -m 644 doc/readme.html "$pkgdir/psp/share/licenses/$pkgname" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,262 @@ | ||
diff --git a/Makefile.psp b/Makefile.psp | ||
new file mode 100644 | ||
index 0000000..1408562 | ||
--- /dev/null | ||
+++ b/Makefile.psp | ||
@@ -0,0 +1,31 @@ | ||
+LUA = . | ||
+ | ||
+PSPSDK = $(shell psp-config --pspsdk-path) | ||
+PSPDIR = $(shell psp-config --psp-prefix) | ||
+ | ||
+CFLAGS = -O2 -G0 -I$(LUA)/include | ||
+ | ||
+# CORE_O= src/lapi.o src/lcode.o src/lctype.o src/ldebug.o src/ldo.o src/ldump.o\ | ||
+# src/lfunc.o src/lgc.o src/llex.o src/lmem.o src/lobject.o\ | ||
+# src/lopcodes.o src/lparser.o src/lstate.o src/lstring.o src/ltable.o \ | ||
+# src/ltm.o src/lundump.o src/lvm.o src/lzio.o | ||
+# LIB_O= src/lauxlib.o src/lbaselib.o src/lbitlib.o src/lcorolib.o src/ldblib.o\ | ||
+# src/liolib.o src/lmathlib.o src/loslib.o src/lstrlib.o src/ltablib.o\ | ||
+# src/loadlib.o src/linit.o | ||
+CORE_O= src/lapi.o src/lcode.o src/ldebug.o src/ldo.o src/ldump.o src/lfunc.o src/lgc.o src/llex.o src/lmem.o \ | ||
+ src/lobject.o src/lopcodes.o src/lparser.o src/lstate.o src/lstring.o src/ltable.o src/ltm.o \ | ||
+ src/lundump.o src/lvm.o src/lzio.o | ||
+LIB_O= src/lauxlib.o src/lbaselib.o src/ldblib.o src/liolib.o src/lmathlib.o src/loslib.o src/ltablib.o \ | ||
+ src/lstrlib.o src/loadlib.o src/linit.o | ||
+ | ||
+BASE_O= $(CORE_O) $(LIB_O) | ||
+ | ||
+OBJS = $(BASE_O) | ||
+TARGET_LIB = liblua51.a | ||
+ | ||
+include $(PSPSDK)/lib/build.mak | ||
+ | ||
+install: all | ||
+ mkdir -p $(PSPDIR)/include/lua51 $(PSPDIR)/lib | ||
+ cp src/lua.h src/luaconf.h src/lualib.h src/lauxlib.h src/lua.hpp $(PSPDIR)/include/lua51 | ||
+ cp *.a $(PSPDIR)/lib | ||
diff --git a/src/lmathlib.c b/src/lmathlib.c | ||
index 441fbf7..b500436 100644 | ||
--- a/src/lmathlib.c | ||
+++ b/src/lmathlib.c | ||
@@ -22,107 +22,129 @@ | ||
#define RADIANS_PER_DEGREE (PI/180.0) | ||
|
||
|
||
+/* macro 'l_tg' allows the addition of an 'l' or 'f' to all math operations */ | ||
+#define LUA_COMPAT_LOG10 | ||
+ | ||
+#if !defined(l_tg) | ||
+#define l_tg(x) (x##f) | ||
+#endif | ||
+ | ||
+ | ||
|
||
static int math_abs (lua_State *L) { | ||
- lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(fabs)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_sin (lua_State *L) { | ||
- lua_pushnumber(L, sin(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(sin)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_sinh (lua_State *L) { | ||
- lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(sinh)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_cos (lua_State *L) { | ||
- lua_pushnumber(L, cos(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(cos)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_cosh (lua_State *L) { | ||
- lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(cosh)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_tan (lua_State *L) { | ||
- lua_pushnumber(L, tan(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(tan)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_tanh (lua_State *L) { | ||
- lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(tanh)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_asin (lua_State *L) { | ||
- lua_pushnumber(L, asin(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(asin)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_acos (lua_State *L) { | ||
- lua_pushnumber(L, acos(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(acos)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_atan (lua_State *L) { | ||
- lua_pushnumber(L, atan(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(atan)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_atan2 (lua_State *L) { | ||
- lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); | ||
+ lua_pushnumber(L, l_tg(atan2)(luaL_checknumber(L, 1), | ||
+ luaL_checknumber(L, 2))); | ||
return 1; | ||
} | ||
|
||
static int math_ceil (lua_State *L) { | ||
- lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(ceil)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_floor (lua_State *L) { | ||
- lua_pushnumber(L, floor(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(floor)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_fmod (lua_State *L) { | ||
- lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); | ||
+ lua_pushnumber(L, l_tg(fmod)(luaL_checknumber(L, 1), | ||
+ luaL_checknumber(L, 2))); | ||
return 1; | ||
} | ||
|
||
static int math_modf (lua_State *L) { | ||
- double ip; | ||
- double fp = modf(luaL_checknumber(L, 1), &ip); | ||
+ lua_Number ip; | ||
+ lua_Number fp = l_tg(modf)(luaL_checknumber(L, 1), &ip); | ||
lua_pushnumber(L, ip); | ||
lua_pushnumber(L, fp); | ||
return 2; | ||
} | ||
|
||
static int math_sqrt (lua_State *L) { | ||
- lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(sqrt)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
static int math_pow (lua_State *L) { | ||
- lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); | ||
+ lua_pushnumber(L, l_tg(pow)(luaL_checknumber(L, 1), | ||
+ luaL_checknumber(L, 2))); | ||
return 1; | ||
} | ||
|
||
static int math_log (lua_State *L) { | ||
- lua_pushnumber(L, log(luaL_checknumber(L, 1))); | ||
+ lua_Number x = luaL_checknumber(L, 1); | ||
+ lua_Number res; | ||
+ if (lua_isnoneornil(L, 2)) | ||
+ res = l_tg(log)(x); | ||
+ else { | ||
+ lua_Number base = luaL_checknumber(L, 2); | ||
+ if (base == 10.0) res = l_tg(log10)(x); | ||
+ else res = l_tg(log)(x)/l_tg(log)(base); | ||
+ } | ||
+ lua_pushnumber(L, res); | ||
return 1; | ||
} | ||
|
||
+#if defined(LUA_COMPAT_LOG10) | ||
static int math_log10 (lua_State *L) { | ||
- lua_pushnumber(L, log10(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(log10)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
+#endif | ||
|
||
static int math_exp (lua_State *L) { | ||
- lua_pushnumber(L, exp(luaL_checknumber(L, 1))); | ||
+ lua_pushnumber(L, l_tg(exp)(luaL_checknumber(L, 1))); | ||
return 1; | ||
} | ||
|
||
@@ -138,18 +160,17 @@ static int math_rad (lua_State *L) { | ||
|
||
static int math_frexp (lua_State *L) { | ||
int e; | ||
- lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); | ||
+ lua_pushnumber(L, l_tg(frexp)(luaL_checknumber(L, 1), &e)); | ||
lua_pushinteger(L, e); | ||
return 2; | ||
} | ||
|
||
static int math_ldexp (lua_State *L) { | ||
- lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); | ||
+ lua_pushnumber(L, l_tg(ldexp)(luaL_checknumber(L, 1), | ||
+ luaL_checkint(L, 2))); | ||
return 1; | ||
} | ||
|
||
- | ||
- | ||
static int math_min (lua_State *L) { | ||
int n = lua_gettop(L); /* number of arguments */ | ||
lua_Number dmin = luaL_checknumber(L, 1); | ||
diff --git a/src/lobject.c b/src/lobject.c | ||
index 4ff5073..b2f0220 100644 | ||
--- a/src/lobject.c | ||
+++ b/src/lobject.c | ||
@@ -136,7 +136,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | ||
break; | ||
} | ||
case 'f': { | ||
- setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); | ||
+ setnvalue(L->top, cast_num(va_arg(argp, double))); | ||
incr_top(L); | ||
break; | ||
} | ||
diff --git a/src/lua.hpp b/src/lua.hpp | ||
new file mode 100644 | ||
index 0000000..ec417f5 | ||
--- /dev/null | ||
+++ b/src/lua.hpp | ||
@@ -0,0 +1,9 @@ | ||
+// lua.hpp | ||
+// Lua header files for C++ | ||
+// <<extern "C">> not supplied automatically because Lua also compiles as C++ | ||
+ | ||
+extern "C" { | ||
+#include "lua.h" | ||
+#include "lualib.h" | ||
+#include "lauxlib.h" | ||
+} | ||
diff --git a/src/luaconf.h b/src/luaconf.h | ||
index e2cb261..3b0c9d8 100644 | ||
--- a/src/luaconf.h | ||
+++ b/src/luaconf.h | ||
@@ -502,13 +502,13 @@ | ||
*/ | ||
|
||
#define LUA_NUMBER_DOUBLE | ||
-#define LUA_NUMBER double | ||
+#define LUA_NUMBER float | ||
|
||
/* | ||
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' | ||
@* over a number. | ||
*/ | ||
-#define LUAI_UACNUMBER double | ||
+#define LUAI_UACNUMBER float | ||
|
||
|
||
/* |
Oops, something went wrong.