Skip to content

Instantly share code, notes, and snippets.

@juniorz
Last active March 18, 2016 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juniorz/3e0456fa61ad4509895b to your computer and use it in GitHub Desktop.
Save juniorz/3e0456fa61ad4509895b to your computer and use it in GitHub Desktop.
Building lua on WD My Cloud EX2

Building dependencies

ncurses

$ cd Open_Source_packages
$ source source.me
$ tar -xzvf ncurses-5.7.tar.gz
$ cd ncurses-5.7
$ ./xbuild.sh build
$ ./xbuild.sh install

readline

$ cd Open_Source_packages
$ source source.me
$ tar -xzvf readline-6.2.tar.gz
$ cd readline-6.2
$ ./xbuild.sh build
$ ./xbuild.sh install

Building lua

$ cd Open_Source_packages
$ source source.me
$ curl http://www.lua.org/ftp/lua-5.3.2.tar.gz | tar -xzv
$ cd lua-5.3.2
$ curl https://gist.githubusercontent.com/juniorz/3e0456fa61ad4509895b/raw/xbuild.sh -O
$ chmod +x ./xbuild.sh
$ ./xbuild.sh build

Now copy src/lua and src/luac to your device.

Troubleshooting

If you see source: not found errors whle running ./xbuild.sh, edit the file and change the shebang to #!/bin/bash.

#!/bin/bash
unset CFLAGS
unset LDFLAGS
unset LIBS
source ../xcp.sh
TMPINST=$(readlink -f $PWD/../_xinstall/${PROJECT_NAME})
xbuild()
{
if [ ! -e ${TMPINST}/lib/libreadline.so ]; then
echo "We need the readline library to complete build."
exit 1
fi
if [ ! -e ${TMPINST}/lib/libncurses.so ]; then
echo "We need the ncurses library to complete build."
exit 1
fi
make linux CC=$CC \
MYCFLAGS="-I${TMPINST}/include" \
MYLDFLAGS="-L${TMPINST}/lib -Wl,-rpath,${TMPINST}/lib"
}
xinstall()
{
make install INSTALL_TOP=$TMPINST
}
xclean()
{
make clean
}
if [ "$1" = "build" ]; then
xbuild
elif [ "$1" = "install" ]; then
xinstall
elif [ "$1" = "clean" ]; then
xclean
else
echo "Usage: xbuild.sh {build|install|clean}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment