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 # LuPI2 Makefile
# Default compiler settings. # Default compiler settings.
PREFIX?=musl PREFIX?=x86_64-linux-musl
CC = $(PREFIX)-gcc CC = $(PREFIX)-gcc
CFLAGS?=-O2 -std=c99 CFLAGS?=-O2 -std=c99

View File

@ -6,9 +6,9 @@ intuitive languages. It has only 6 types, very simple syntax, yet supports many
Build Build
----- -----
1. Clone this repository 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) 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` 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 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 #!/bin/bash
#TOOL=arm-musl-linuxeabihf #TOOL=arm-musl-linuxeabihf
TOOL=x86_64-unknown-linux-gnu TOOL=x86_64-linux-musl
OPENSSL_TARGET=linux-generic32 OPENSSL_TARGET=linux-generic64
OUT=$TOOL OUT=$TOOL
# TODO: more targets / host target / musl target from host # TODO: more targets / host target
if [ $# -lt 1 ] if [ $# -lt 1 ]
then then
echo "Usage : $0 [arm32-musl|x86_64|musl]" echo "Usage : $0 [all|arm32|x86_64|i486]"
exit exit
fi fi
case "$1" in case "$1" in
arm32-musl ) all )
TARGETS=(arm32 i486 x86_64)
for i in ${TARGETS[@]}; do
./$0 $i
done
;;
arm32 )
TOOL=arm-linux-musleabihf TOOL=arm-linux-musleabihf
OUT=$TOOL OUT=$TOOL
OPENSSL_TARGET=linux-generic32 OPENSSL_TARGET=linux-generic32
;; ;;
i486 )
TOOL=i486-linux-musl
OUT=$TOOL
OPENSSL_TARGET=linux-generic32
;;
x86_64 ) x86_64 )
TOOL=x86_64-unknown-linux-gnu TOOL=x86_64-linux-musl
OUT=$TOOL OUT=$TOOL
OPENSSL_TARGET=linux-generic64 OPENSSL_TARGET=linux-generic64
;; ;;
musl )
TOOL=x86_64-unknown-linux-gnu
OUT=musl
OPENSSL_TARGET=linux-generic64
;;
*) echo "Invalid target!" ; exit 1 *) echo "Invalid target!" ; exit 1
;; ;;
esac esac

View File

@ -51,7 +51,7 @@ gpio.register = function ()
checkArg(1, pin, "number") checkArg(1, pin, "number")
checkArg(2, pin, "boolean", "number", "nil") checkArg(2, pin, "boolean", "number", "nil")
pin = tostring(math.floor(pin)) 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 if not fexists("/sys/class/gpio/gpio" .. pin) then
return false, "Set pin mode first" return false, "Set pin mode first"
end end