diff --git a/Makefile b/Makefile index 0db217c..86853b6 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ # LuPI2 Makefile # Default compiler settings. -PREFIX?=musl- +PREFIX?=musl -CC = $(PREFIX)gcc +CC = $(PREFIX)-gcc CFLAGS?=-O2 -std=c99 -LDFLAGS+= -static +LDFLAGS+= -static -Ldependencies/lib-$(PREFIX) # Project specific stuff BUILD = bin/ @@ -13,7 +13,7 @@ SOURCE = src/c CORELUA = src/lua/core RESOURCES = resources -LIBS=-lm +LIBS=-lm -lcrypto -lssl INCLUDES=-I$(SOURCE) -Isrc/c/lib/lua -Iinclude diff --git a/README.md b/README.md index 9f577c3..0041c80 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,21 @@ Second attempt at Lua based operating system, primarily aimed at RaspberryPi, bu fact that GNU/Linux + python solution isn't allays the best for people that haven't been programming ever, and Lua in one of the simplest, most intuitive languages. It has only 6 types, very simple syntax, yet supports many advanced mechanisms. -Running +Build ----- 1. Clone this repository -2. Get musl libc(with musl-gcc wrapper) -2.5 Get `xxd` utility(usually packaged with vim) -3. Execute `make build` -4. You will need to put some OS to `root` directory where you run the binary. For now you can get plan9k at http://cloud.magik6k.net/index.php/s/7jPRAU037dzt8Ga/download +2. Get musl libc (with musl-gcc wrapper), or compile musl cross compiler(like arm-linux-musleabihf) +3. Get `xxd` utility (usually packaged with vim) +4. Build dependencies using scripts/dependencies.sh script +5. Execute `make build` +6. You will need to put some OS to `root` directory where you run the binary. For now you can get plan9k at https://cloud.magik6k.net/index.php/s/7jPRAU037dzt8Ga/download + +In case of problems poke me/someone at #lupi on Freenode Idea ----- Design of system APIs is heavily influenced by [OpenComputers](https://github.com/MightyPirates/OpenComputers) minecraft mod. Some Lua code parts are -actually copied from there(all of the code is under the MIT License). Main advantage of the API is that it's event/component based, which provides great +actually copied from there (all of the code is under the MIT License). Main advantage of the API is that it's event/component based, which provides great level of abstraction. Custom components can be created and used with very little effort, being event-based simplifies code further, providing one unified queue for events instead of multiple ways of handling them. ```lua diff --git a/scripts/dependencies.sh b/scripts/dependencies.sh new file mode 100755 index 0000000..19d024c --- /dev/null +++ b/scripts/dependencies.sh @@ -0,0 +1,53 @@ +#!/bin/bash +#TOOL=arm-musl-linuxeabihf +TOOL=x86_64-unknown-linux-gnu +OPENSSL_TARGET=linux-generic32 +OUT=$TOOL +# TODO: more targets / host target / musl target from host + +if [ $# -lt 1 ] +then + echo "Usage : $0 [arm32-musl|x86_64|x86_64-musl]" + exit +fi + +case "$1" in + arm32-musl ) + TOOL=arm-linux-musleabihf + OUT=$TOOL + OPENSSL_TARGET=linux-generic32 + ;; + x86_64 ) + TOOL=x86_64-unknown-linux-gnu + OUT=$TOOL + OPENSSL_TARGET=linux-generic64 + ;; + musl ) + TOOL=x86_64-unknown-linux-gnu + OUT=musl + OPENSSL_TARGET=linux-generic64 + ;; + *) echo "Invalid target!" ; exit 1 + ;; +esac + +mkdir -p dependencies + +rm -rf dependencies/lib-$OUT +mkdir -p dependencies/lib-$OUT + +cd dependencies +git clone git://git.openssl.org/openssl.git +cd openssl + +#./Configure +cd .. +rm -rf openssl-build +mkdir openssl-build +cd openssl-build +../openssl/Configure $OPENSSL_TARGET --unified no-asm -DOPENSSL_NO_HEARTBEATS --openssldir=$(cd ../lib-$OUT; pwd) no-shared +make libcrypto.a -j8 CC=$TOOL-gcc RANLIB=$TOOL-ranlib LD=$TOOL-ld MAKEDEPPROG=$TOOL-gcc PROCESSOR=ARM +make libssl.a -j8 CC=$TOOL-gcc RANLIB=$TOOL-ranlib LD=$TOOL-ld MAKEDEPPROG=$TOOL-gcc PROCESSOR=ARM + +cp libcrypto.a ../lib-$OUT +cp libssl.a ../lib-$OUT