Browse Source

Improve dependency building a bit

libevent
Łukasz Magiera 6 years ago
parent
commit
9c7fbac07b
  1. 2
      Makefile
  2. 4
      README.md
  3. 29
      scripts/dependencies.sh
  4. 2
      src/lua/core/gpio.lua

2
Makefile

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

4
README.md

@ -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

29
scripts/dependencies.sh

@ -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
;;
x86_64 )
TOOL=x86_64-unknown-linux-gnu
i486 )
TOOL=i486-linux-musl
OUT=$TOOL
OPENSSL_TARGET=linux-generic64
OPENSSL_TARGET=linux-generic32
;;
musl )
TOOL=x86_64-unknown-linux-gnu
OUT=musl
x86_64 )
TOOL=x86_64-linux-musl
OUT=$TOOL
OPENSSL_TARGET=linux-generic64
;;
*) echo "Invalid target!" ; exit 1
;;
esac

2
src/lua/core/gpio.lua

@ -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

Loading…
Cancel
Save