derle.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. if [ -z $MPS_PATH ];then
  3. MPS_PATH="/usr/milis/mps"
  4. fi
  5. if [ ! -z $1 ];then
  6. MPS_PATH="$1"
  7. fi
  8. if [ ! -d $MPS_PATH ];then
  9. echo "$MPS_PATH dizini mevcut değil!"
  10. exit 1
  11. fi
  12. # detect lua version
  13. LUA_VERSION="$(echo "print(_VERSION)" | lua | cut -d' ' -f2)"
  14. cd $MPS_PATH/src
  15. # lua kütüphanelerinin derlenip-yüklenmesi
  16. # 0 temizlik
  17. ext_libdir="ext${LUA_VERSION}"
  18. [ -d $MPS_PATH/lua/${ext_libdir} ] && mv $MPS_PATH/lua/${ext_libdir} $MPS_PATH/lua/${ext_libdir}.old
  19. mkdir -p $MPS_PATH/lua/${ext_libdir}
  20. # 1- luafilesystem
  21. cd luafilesystem && make clean && make -f makefile${LUA_VERSION} && cp -rf src/*.so $MPS_PATH/lua/${ext_libdir}/ && make clean
  22. cd -
  23. # 2- luasocket
  24. cd luasocket && make clean && MYCFLAGS=$CFLAGS MYLDFLAGS=$LDFLAGS make LUAV=${LUA_VERSION} linux
  25. mkdir /tmp/pkg.socket
  26. make DESTDIR=/tmp/pkg.socket LUAV=${LUA_VERSION} prefix=/usr install-unix
  27. cp -rf /tmp/pkg.socket/usr/lib/lua/${LUA_VERSION}/* $MPS_PATH/lua/${ext_libdir}/
  28. cp -rf /tmp/pkg.socket/usr/share/lua/${LUA_VERSION}/* $MPS_PATH/lua/${ext_libdir}/
  29. rm -rf /tmp/pkg.socket
  30. make clean
  31. cd -
  32. # 3- lua-sec ssl support
  33. cd luasec && make clean && make linux DEFS="-DWITH_LUASOCKET -DOPENSSL_NO_SSL3"
  34. mkdir /tmp/pkg.sec
  35. make LUACPATH="/tmp/pkg.sec/usr/lib/lua/${LUA_VERSION}" LUAPATH="/tmp/pkg.sec/usr/share/lua/${LUA_VERSION}" install
  36. cp -rf /tmp/pkg.sec/usr/lib/lua/${LUA_VERSION}/* $MPS_PATH/lua/${ext_libdir}/
  37. cp -rf /tmp/pkg.sec/usr/share/lua/${LUA_VERSION}/* $MPS_PATH/lua/${ext_libdir}/
  38. rm -rf /tmp/pkg.sec
  39. make clean
  40. cd -
  41. # 4 strip shared objects
  42. find $MPS_PATH -name '*.so' | xargs -I {} strip {}
  43. # 5 temizlik
  44. rm -rf $MPS_PATH/lua/${ext_libdir}.old
  45. # exe
  46. chmod +x $MPS_PATH/bin/mps*.lua