Improve dependency building a bit

This commit is contained in:
Łukasz Magiera 2016-02-23 22:05:42 +01:00
parent ec722bf06a
commit 9c7fbac07b
4 changed files with 22 additions and 15 deletions

View File

@ -1,7 +1,7 @@
# LuPI2 Makefile
# Default compiler settings.
PREFIX?=musl
PREFIX?=x86_64-linux-musl
CC = $(PREFIX)-gcc
CFLAGS?=-O2 -std=c99

View File

@ -6,9 +6,9 @@ intuitive languages. It has only 6 types, very simple syntax, yet supports many
Build
-----
1. Clone this repository
2. Get musl libc (with musl-gcc wrapper), or compile musl cross compiler(like arm-linux-musleabihf)
2. Get musl cross compiler(like arm-linux-musleabihf), simplest way is to use [musl-cross](https://github.com/GregorR/musl-cross)
3. Get `xxd` utility (usually packaged with vim)
4. Build dependencies using scripts/dependencies.sh script
4. Build dependencies using scripts/dependencies.sh script for your platform(s)
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

View File

@ -1,32 +1,39 @@
#!/bin/bash
#TOOL=arm-musl-linuxeabihf
TOOL=x86_64-unknown-linux-gnu
OPENSSL_TARGET=linux-generic32
TOOL=x86_64-linux-musl
OPENSSL_TARGET=linux-generic64
OUT=$TOOL
# TODO: more targets / host target / musl target from host
# TODO: more targets / host target
if [ $# -lt 1 ]
then
echo "Usage : $0 [arm32-musl|x86_64|musl]"
echo "Usage : $0 [all|arm32|x86_64|i486]"
exit
fi
case "$1" in
arm32-musl )
all )
TARGETS=(arm32 i486 x86_64)
for i in ${TARGETS[@]}; do
./$0 $i
done
;;
arm32 )
TOOL=arm-linux-musleabihf
OUT=$TOOL
OPENSSL_TARGET=linux-generic32
;;
i486 )
TOOL=i486-linux-musl
OUT=$TOOL
OPENSSL_TARGET=linux-generic32
;;
x86_64 )
TOOL=x86_64-unknown-linux-gnu
TOOL=x86_64-linux-musl
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

View File

@ -51,7 +51,7 @@ gpio.register = function ()
checkArg(1, pin, "number")
checkArg(2, pin, "boolean", "number", "nil")
pin = tostring(math.floor(pin))
value = (value == true or value > 0) and "1" or "0"
value = (value == true or (type(value) == "number" and value & 1 == 1) ) and "1" or "0"
if not fexists("/sys/class/gpio/gpio" .. pin) then
return false, "Set pin mode first"
end