[ZeroBrane Studio] Re: Zerobrane studio on Raspberry Pi4

  • From: Milind Gupta <milind.gupta@xxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Sat, 30 Jan 2021 15:18:08 -0800

Hi Paul,
        So I did not change any version numbers in the build-linx.sh
script. I have attached the script that I used. Which is basically the
original script the the change to LexLpeg URL.
         I see that it pulls the latest code from github. I will try to get
the 3.1.4 version of wxwidgets and try with that.

Thanks,
Milind


On Sat, Jan 30, 2021 at 2:35 PM Paul K <paul@xxxxxxxxxxxxx> wrote:

Hi Milind,

You seem to be using a mix of wxWidgets and wxlua versions that may
not work together. If you are using build scripts from ZBS, then the
version of wxlua used there should be 3.0.0.8, but according to the
error message, it seems to be a later one.

You either need to use the exact versions that the build scripts
include OR use the latest wxwidgets (3.1.5 from the master branch) and
the latest wxlua (the current master branch). The latest version of
wxlua should always work with previous wxwidgets releases (for
example, 3.1.4), but it may not always work with the current version,
as the master branch of wxwidgets may include changes that haven't yet
been reflected in the current version of wxlua.

If this still doesn't help, please include the detailed information
about wxwidgets and wxlua versions (and commit hashes if you are using
their repositories, as the currently reported version of wxwidgets
hasn't been tagged yet, so its content may change).

I had to update the url to download LexLpeg the old url was not found.

Good catch; I'll update it to
https://github.com/orbitalquark/scintillua/archive/scintillua_3.6.5-1.zip.
Thanks!

Paul.

On Sat, Jan 30, 2021 at 1:57 PM Milind Gupta <milind.gupta@xxxxxxxxx>
wrote:

A little more information:

I had to update the url to download LexLpeg the old url was not found.
Also the above error is while compiling wxlua.
I ran the build script as:

sudo ./build-linux.sh all 5.3

Thanks,
Milind

On Sat, Jan 30, 2021 at 1:54 PM Milind Gupta <milind.gupta@xxxxxxxxx>
wrote:

Hi Paul, Dinabandhu,
           Reviving this old thread. I tried compiling Zerobrane on
RPi4. I am having problems compiling wxWidgets. I got the following error
when running the script:

[ 15%] Building CXX object
modules/luamodule/CMakeFiles/wxLuaModule.dir/__/wxbind/src/wxadv_bind.cpp.o

/home/pi/Downloads/ZeroBraneStudio-1.90/build/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp:
In function ‘int wxLua_wxAuiToolBar_DestroyTool(lua_State*)’:

/home/pi/Downloads/ZeroBraneStudio-1.90/build/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp:2311:27:
error: ‘class wxAuiToolBar’ has no member named ‘DestroyTool’; did you mean
‘Destroy’?
     bool returns = (self->DestroyTool(toolId));
                           ^~~~~~~~~~~
                           Destroy

/home/pi/Downloads/ZeroBraneStudio-1.90/build/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp:
In function ‘int wxLua_wxAuiToolBar_DestroyToolByIndex(lua_State*)’:

/home/pi/Downloads/ZeroBraneStudio-1.90/build/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp:2329:27:
error: ‘class wxAuiToolBar’ has no member named ‘DestroyToolByIndex’; did
you mean ‘FindToolByIndex’?
     bool returns = (self->DestroyToolByIndex(idx));
                           ^~~~~~~~~~~~~~~~~~
                           FindToolByIndex

Is there some version different that may be causing this? I am using
the latest Zerobranestudio package. Which version were you able to compile
previously?

Thanks,
Milind


On Tue, Oct 13, 2020 at 8:02 AM Paul K <paul@xxxxxxxxxxxxx> wrote:

If I want to run zbstudio on another RPi, should I copy the whole
directory there or is there a minimal subset that I need to copy?

You'd need to copy all the folders except build/ and t/. If you want
the absolute minimum, then only keep files listed in zbstudio/MANIFEST
and zbstudio/MANIFEST-bin-linux.

Paul.

On Mon, Oct 12, 2020 at 11:35 PM Dinabandhu Mitra <
dinu.mitra@xxxxxxxxx> wrote:

Hi,

I could successfully build and run zbstudio using the scripts.
Thanks a lot. If I want to run zbstudio on another RPi, should I copy the
whole directory there or is there a minimal subset that I need to copy?

Thanks & Regards,
Dinabandhu

On Tue, Oct 13, 2020 at 8:25 AM Dinabandhu Mitra <
dinu.mitra@xxxxxxxxx> wrote:

Thanks Paul, I will give it a try.

Dinabandhu

On Sun, Oct 11, 2020 at 10:30 AM Paul K <paul@xxxxxxxxxxxxx> wrote:

There is no binary available, but you should be able to compile one
using the build scripts provided in the build/ folder of the
repository (`./build-linux.sh all` should work).

Paul.

On Sat, Oct 10, 2020 at 9:53 PM Dinabandhu Mitra <
dinu.mitra@xxxxxxxxx> wrote:

Hi,

I wanted to run zerobrane studio on Raspberry Pi 4 running
Raspbian OS.I could not find a ARM binary for linux. Is there a way for me
run Zerobrane on RPi?




#!/bin/bash

# exit if the command line is empty
if [ $# -eq 0 ]; then
  echo "Usage: $0 LIBRARY..."
  exit 0
fi

case "$(uname -m)" in
        x86_64)
                FPIC="-fpic"
                ARCH="x64"
                ;;
        armv7l)
                FPIC="-fpic"
                ARCH="armhf"
                ;;
        aarch64)
                FPIC="-fpic"
                ARCH="aarch64"
                ;;
        *)
                FPIC=""
                ARCH="x86"
                ;;
esac

# binary directory
BIN_DIR="$(dirname "$PWD")/bin/linux/$ARCH"

# temporary installation directory for dependencies
INSTALL_DIR="$PWD/deps"

# number of parallel jobs used for building
MAKEFLAGS="-j4"

# flags for manual building with gcc
BUILD_FLAGS="-Os -shared -s -I $INSTALL_DIR/include -L $INSTALL_DIR/lib $FPIC"

# paths configuration
WXWIDGETS_BASENAME="wxWidgets"
WXWIDGETS_URL="https://github.com/pkulchenko/wxWidgets.git";

WXLUA_BASENAME="wxlua"
WXLUA_URL="https://github.com/pkulchenko/wxlua.git";

LUASOCKET_BASENAME="luasocket-3.0-rc1"
LUASOCKET_FILENAME="v3.0-rc1.zip"
LUASOCKET_URL="https://github.com/diegonehab/luasocket/archive/$LUASOCKET_FILENAME";

OPENSSL_BASENAME="openssl-1.1.1d"
OPENSSL_FILENAME="$OPENSSL_BASENAME.tar.gz"
OPENSSL_URL="http://www.openssl.org/source/$OPENSSL_FILENAME";

LUASEC_BASENAME="luasec-0.9"
LUASEC_FILENAME="v0.9.zip"
LUASEC_URL="https://github.com/brunoos/luasec/archive/$LUASEC_FILENAME";

LFS_BASENAME="v_1_6_3"
LFS_FILENAME="$LFS_BASENAME.tar.gz"
LFS_URL="https://github.com/keplerproject/luafilesystem/archive/$LFS_FILENAME";

LPEG_BASENAME="lpeg-1.0.0"
LPEG_FILENAME="$LPEG_BASENAME.tar.gz"
LPEG_URL="http://www.inf.puc-rio.br/~roberto/lpeg/$LPEG_FILENAME";

LEXLPEG_BASENAME="scintillua_3.6.5-1"
LEXLPEG_FILENAME="$LEXLPEG_BASENAME.zip"
LEXLPEG_URL="https://github.com/orbitalquark/scintillua/archive/$LEXLPEG_FILENAME";

WXWIDGETSDEBUG="--disable-debug"
WXLUABUILD="MinSizeRel"

# iterate through the command line arguments
for ARG in "$@"; do
  case $ARG in
  5.2)
    BUILD_LUA=true
    BUILD_52=true
    ;;
  5.3)
    BUILD_LUA=true
    BUILD_53=true
    BUILD_FLAGS="$BUILD_FLAGS -DLUA_COMPAT_APIINTCASTS"
    ;;
  5.4)
    BUILD_LUA=true
    BUILD_54=true
    BUILD_FLAGS="$BUILD_FLAGS -DLUA_COMPAT_APIINTCASTS"
    ;;
  jit)
    BUILD_LUA=true
    BUILD_JIT=true
    ;;
  wxwidgets)
    BUILD_WXWIDGETS=true
    ;;
  lua)
    BUILD_LUA=true
    ;;
  wxlua)
    BUILD_WXLUA=true
    ;;
  luasec)
    BUILD_LUASEC=true
    ;;
  luasocket)
    BUILD_LUASOCKET=true
    ;;
  lfs)
    BUILD_LFS=true
    ;;
  lpeg)
    BUILD_LPEG=true
    ;;
  lexlpeg)
    BUILD_LEXLPEG=true
    ;;
  debug)
    WXWIDGETSDEBUG="--enable-debug=max --enable-debug_gdb"
    WXLUABUILD="Debug"
    DEBUGBUILD=true
    ;;
  all)
    BUILD_WXWIDGETS=true
    BUILD_LUA=true
    BUILD_WXLUA=true
    BUILD_LUASOCKET=true
    BUILD_LUASEC=true
    BUILD_LFS=true
    BUILD_LPEG=true
    BUILD_LEXLPEG=true
    ;;
  *)
    echo "Error: invalid argument $ARG"
    exit 1
    ;;
  esac
done

# check for g++
if [ ! "$(which g++)" ]; then
  echo "Error: g++ isn't found. Please install GNU C++ compiler."
  exit 1
fi

# check for cmake
if [ ! "$(which cmake)" ]; then
  echo "Error: cmake isn't found. Please install CMake and add it to PATH."
  exit 1
fi

# check for git
if [ ! "$(which git)" ]; then
  echo "Error: git isn't found. Please install console GIT client."
  exit 1
fi

# check for wget
if [ ! "$(which wget)" ]; then
  echo "Error: wget isn't found. Please install GNU Wget."
  exit 1
fi

# create the installation directory
mkdir -p "$INSTALL_DIR" || { echo "Error: cannot create directory 
$INSTALL_DIR"; exit 1; }

LUAV="51"
LUAS=""
LUA_BASENAME="lua-5.1.5"

if [ $BUILD_52 ]; then
  LUAV="52"
  LUAS=$LUAV
  LUA_BASENAME="lua-5.2.4"
fi

LUA_FILENAME="$LUA_BASENAME.tar.gz"
LUA_URL="http://www.lua.org/ftp/$LUA_FILENAME";

if [ $BUILD_53 ]; then
  LUAV="53"
  LUAS=$LUAV
  LUA_BASENAME="lua-5.3.1"
  LUA_FILENAME="$LUA_BASENAME.tar.gz"
  LUA_URL="http://www.lua.org/ftp/$LUA_FILENAME";
fi

if [ $BUILD_54 ]; then
  LUAV="54"
  LUAS=$LUAV
  LUA_BASENAME="lua-5.4.0-work1"
  LUA_FILENAME="$LUA_BASENAME.tar.gz"
  LUA_URL="http://www.lua.org/work/$LUA_FILENAME";
  LUA_COMPAT="MYCFLAGS=-DLUA_COMPAT_MODULE"
fi

if [ $BUILD_JIT ]; then
  LUA_BASENAME="luajit"
  LUA_URL="https://github.com/pkulchenko/luajit.git";
fi

# build Lua
if [ $BUILD_LUA ]; then
  if [ $BUILD_JIT ]; then
    git clone "$LUA_URL" "$LUA_BASENAME"
    (cd "$LUA_BASENAME"; git checkout v2.0.4)
  else
    wget -c "$LUA_URL" -O "$LUA_FILENAME" || { echo "Error: failed to download 
Lua"; exit 1; }
    tar -xzf "$LUA_FILENAME"
  fi
  cd "$LUA_BASENAME"

  if [ $BUILD_JIT ]; then
    make CCOPT="-DLUAJIT_ENABLE_LUA52COMPAT" || { echo "Error: failed to build 
Lua"; exit 1; }
    make install PREFIX="$INSTALL_DIR"
    cp "$INSTALL_DIR"/bin/luajit "$INSTALL_DIR/bin/lua"
    # don't copy luajit includes as the libraries should be compiled using Lua 
headers
  else
    # use POSIX as it has minimum dependencies (no readline and no ncurses 
required)
    # LUA_USE_DLOPEN is required for loading libraries
    (cd src; make all MYCFLAGS="$FPIC -DLUA_USE_POSIX -DLUA_USE_DLOPEN" 
MYLIBS="-Wl,-E -ldl") || { echo "Error: failed to build Lua"; exit 1; }
    make install INSTALL_TOP="$INSTALL_DIR"
  fi
  cp "$INSTALL_DIR/bin/lua" "$INSTALL_DIR/bin/lua$LUAV"
  [ $DEBUGBUILD ] || strip --strip-unneeded "$INSTALL_DIR/bin/lua$LUAV"

  cd ..
  rm -rf "$LUA_FILENAME" "$LUA_BASENAME"
fi

# build lexlpeg
if [ $BUILD_LEXLPEG ]; then
  # need wxwidgets/Scintilla and lua files
  git clone "$WXWIDGETS_URL" "$WXWIDGETS_BASENAME" || { echo "Error: failed to 
get wxWidgets"; exit 1; }
  wget --no-check-certificate -c "$LEXLPEG_URL" -O "$LEXLPEG_FILENAME" || { 
echo "Error: failed to download LexLPeg"; exit 1; }
  unzip "$LEXLPEG_FILENAME"
  cd "scintillua-$LEXLPEG_BASENAME"

  # replace loading lpeg with os and debug as they are needed for debugging;
  # loading lpeg is not needed as it will be loaded from the Lua module.
  sed -i 's/luaopen_lpeg, "lpeg"/luaopen_os, LUA_OSLIBNAME); 
l_openlib(luaopen_debug, LUA_DBLIBNAME/' LexLPeg.cxx

  mkdir -p "$INSTALL_DIR/lib/lua/$LUAV/"
  g++ $BUILD_FLAGS -o "$INSTALL_DIR/lib/lua/$LUAV/lexlpeg.so" \
    "-I../$WXWIDGETS_BASENAME/src/stc/scintilla/include" 
"-I../$WXWIDGETS_BASENAME/src/stc/scintilla/lexlib/" \
    -DSCI_LEXER -DLPEG_LEXER -DLPEG_LEXER_EXTERNAL \
    LexLPeg.cxx 
../$WXWIDGETS_BASENAME/src/stc/scintilla/lexlib/{PropSetSimple.cxx,WordList.cxx,LexerModule.cxx,LexerSimple.cxx,LexerBase.cxx,Accessor.cxx}

  [ -f "$INSTALL_DIR/lib/lua/$LUAV/lexlpeg.so" ] || { echo "Error: LexLPeg.so 
isn't found"; exit 1; }
  [ $DEBUGBUILD ] || strip --strip-unneeded 
"$INSTALL_DIR/lib/lua/$LUAV/lexlpeg.so"

  cd ..
  rm -rf "$LEXLPEG_BASENAME" "$LEXLPEG_FILENAME"
  # don't delete wxwidgets, if it's requested to be built
  [ $BUILD_WXWIDGETS ] || rm -rf "$WXWIDGETS_BASENAME"
fi

# build wxWidgets
if [ $BUILD_WXWIDGETS ]; then
   # don't clone again, as it's already cloned for lexlpeg
  [ $BUILD_LEXLPEG ] || git clone "$WXWIDGETS_URL" "$WXWIDGETS_BASENAME" || { 
echo "Error: failed to get wxWidgets"; exit 1; }
  cd "$WXWIDGETS_BASENAME"

  # checkout the version that was used in wxwidgets upgrade to 3.1.x
  git checkout master

  # refresh wxwidgets submodules
  git submodule update --init --recursive

  ./configure --prefix="$INSTALL_DIR" $WXWIDGETSDEBUG --disable-shared 
--enable-unicode \
    --enable-compat30 \
    --enable-privatefonts \
    --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin 
--with-expat=builtin \
    --with-zlib=builtin --disable-richtext --with-gtk=3 \
    CFLAGS="-Os -fPIC" CXXFLAGS="-Os -fPIC"

  PATTERN="defined( __WXGTK__)"
  if [ ! "$(sed -n "/$PATTERN/{N;/$PATTERN\n static/p;}" src/aui/tabart.cpp)" 
]; then
    echo "Incorrect pattern for a fix in tabart.cpp."
    exit 1
  fi
  REPLACEMENT='0\
 static'
  sed -i "/$PATTERN/{N;s/$PATTERN\n static/$REPLACEMENT/;}" src/aui/tabart.cpp

  make $MAKEFLAGS || { echo "Error: failed to build wxWidgets"; exit 1; }
  make install
  cd ..
  rm -rf "$WXWIDGETS_BASENAME"
fi

# build wxLua
if [ $BUILD_WXLUA ]; then
  git clone "$WXLUA_URL" "$WXLUA_BASENAME" || { echo "Error: failed to get 
wxlua"; exit 1; }
  cd "$WXLUA_BASENAME/wxLua"

  git checkout master

  cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
    -DCMAKE_BUILD_TYPE=$WXLUABUILD -DBUILD_SHARED_LIBS=FALSE \
    -DCMAKE_SKIP_RPATH=TRUE \
    -DwxWidgets_CONFIG_EXECUTABLE="$INSTALL_DIR/bin/wx-config" \
    -DwxWidgets_COMPONENTS="xrc;xml;stc;gl;html;aui;adv;core;net;base" \
    -DwxLuaBind_COMPONENTS="xrc;xml;stc;gl;html;aui;adv;core;net;base" \
    -DwxLua_LUA_LIBRARY_USE_BUILTIN=FALSE \
    -DwxLua_LUA_INCLUDE_DIR="$INSTALL_DIR/include" 
-DwxLua_LUA_LIBRARY="$INSTALL_DIR/lib/liblua.a" .
  (cd modules/luamodule; make $MAKEFLAGS) || { echo "Error: failed to build 
wxLua"; exit 1; }
  (cd modules/luamodule; make install)
  [ -f "$INSTALL_DIR/lib/libwx.so" ] || { echo "Error: libwx.so isn't found"; 
exit 1; }
  [ $DEBUGBUILD ] || strip --strip-unneeded "$INSTALL_DIR/lib/libwx.so"
  cd ../..
  rm -rf "$WXLUA_BASENAME"
fi

# build LuaSocket
if [ $BUILD_LUASOCKET ]; then
  wget --no-check-certificate -c "$LUASOCKET_URL" -O "$LUASOCKET_FILENAME" || { 
echo "Error: failed to download LuaSocket"; exit 1; }
  unzip "$LUASOCKET_FILENAME"
  cd "$LUASOCKET_BASENAME"
  mkdir -p "$INSTALL_DIR/lib/lua/$LUAV/"{mime,socket}
  gcc $BUILD_FLAGS -o "$INSTALL_DIR/lib/lua/$LUAV/mime/core.so" src/mime.c \
    || { echo "Error: failed to build LuaSocket"; exit 1; }
  gcc $BUILD_FLAGS -o "$INSTALL_DIR/lib/lua/$LUAV/socket/core.so" \
    
src/{auxiliar.c,buffer.c,except.c,inet.c,io.c,luasocket.c,options.c,select.c,tcp.c,timeout.c,udp.c,usocket.c}
 \
    || { echo "Error: failed to build LuaSocket"; exit 1; }
  mkdir -p "$INSTALL_DIR/share/lua/$LUAV/socket"
  cp src/{headers.lua,ftp.lua,http.lua,smtp.lua,tp.lua,url.lua} 
"$INSTALL_DIR/share/lua/$LUAV/socket"
  cp src/{ltn12.lua,mime.lua,socket.lua} "$INSTALL_DIR/share/lua/$LUAV"
  [ -f "$INSTALL_DIR/lib/lua/$LUAV/mime/core.so" ] || { echo "Error: 
mime/core.so isn't found"; exit 1; }
  [ -f "$INSTALL_DIR/lib/lua/$LUAV/socket/core.so" ] || { echo "Error: 
socket/core.so isn't found"; exit 1; }
  [ $DEBUGBUILD ] || strip --strip-unneeded 
"$INSTALL_DIR/bin/lua/$LUAV/socket/core.so" 
"$INSTALL_DIR/bin/lua/$LUAV/mime/core.so"
  cd ..
  rm -rf "$LUASOCKET_FILENAME" "$LUASOCKET_BASENAME"
fi

# build lfs
if [ $BUILD_LFS ]; then
  wget --no-check-certificate -c "$LFS_URL" -O "$LFS_FILENAME" || { echo 
"Error: failed to download lfs"; exit 1; }
  tar -xzf "$LFS_FILENAME"
  mv "luafilesystem-$LFS_BASENAME" "$LFS_BASENAME"
  cd "$LFS_BASENAME/src"
  mkdir -p "$INSTALL_DIR/lib/lua/$LUAV/"
  gcc $BUILD_FLAGS -o "$INSTALL_DIR/lib/lua/$LUAV/lfs.so" lfs.c \
    || { echo "Error: failed to build lfs"; exit 1; }
  [ -f "$INSTALL_DIR/lib/lua/$LUAV/lfs.so" ] || { echo "Error: lfs.so isn't 
found"; exit 1; }
  [ $DEBUGBUILD ] || strip --strip-unneeded "$INSTALL_DIR/bin/lua/$LUAV/lfs.so"
  cd ../..
  rm -rf "$LFS_FILENAME" "$LFS_BASENAME"
fi

# build lpeg
if [ $BUILD_LPEG ]; then
  wget --no-check-certificate -c "$LPEG_URL" -O "$LPEG_FILENAME" || { echo 
"Error: failed to download lpeg"; exit 1; }
  tar -xzf "$LPEG_FILENAME"
  cd "$LPEG_BASENAME"
  mkdir -p "$INSTALL_DIR/lib/lua/$LUAV/"
  gcc $BUILD_FLAGS -o "$INSTALL_DIR/lib/lua/$LUAV/lpeg.so" lptree.c lpvm.c 
lpcap.c lpcode.c lpprint.c \
    || { echo "Error: failed to build lpeg"; exit 1; }
  [ -f "$INSTALL_DIR/lib/lua/$LUAV/lpeg.so" ] || { echo "Error: lpeg.so isn't 
found"; exit 1; }
  [ $DEBUGBUILD ] || strip --strip-unneeded "$INSTALL_DIR/bin/lua/$LUAV/lpeg.so"
  cd ..
  rm -rf "$LPEG_FILENAME" "$LPEG_BASENAME"
fi

# build LuaSec
if [ $BUILD_LUASEC ]; then
  # build openSSL
  wget --no-check-certificate -c "$OPENSSL_URL" -O "$OPENSSL_FILENAME" || { 
echo "Error: failed to download OpenSSL"; exit 1; }
  tar -xzf "$OPENSSL_FILENAME"
  cd "$OPENSSL_BASENAME"
  ./config shared

  make depend
  make
  make install_sw INSTALLTOP="$INSTALL_DIR"
  [ $DEBUGBUILD ] || strip --strip-unneeded "$INSTALL_DIR/lib/libcrypto.so" 
"$INSTALL_DIR/lib/libssl.so"
  cd ..
  rm -rf "$OPENSSL_FILENAME" "$OPENSSL_BASENAME"

  # build LuaSec
  wget --no-check-certificate -c "$LUASEC_URL" -O "$LUASEC_FILENAME" || { echo 
"Error: failed to download LuaSec"; exit 1; }
  unzip "$LUASEC_FILENAME"
  cd "$LUASEC_BASENAME"
  mkdir -p "$INSTALL_DIR/lib/lua/$LUAV/"
  gcc $BUILD_FLAGS -o "$INSTALL_DIR/lib/lua/$LUAV/ssl.so" \
    src/luasocket/{timeout.c,buffer.c,io.c,usocket.c} 
src/{config.c,options.c,context.c,ec.c,x509.c,ssl.c} -Isrc \
    -Wl,-rpath,'$ORIGIN' -Wl,-rpath,'$ORIGIN/..' \
    -lssl -lcrypto \
    || { echo "Error: failed to build LuaSec"; exit 1; }
  mkdir -p "$INSTALL_DIR/share/lua/$LUAV/"
  cp src/ssl.lua "$INSTALL_DIR/share/lua/$LUAV/"
  mkdir -p "$INSTALL_DIR/share/lua/$LUAV/ssl"
  cp src/https.lua "$INSTALL_DIR/share/lua/$LUAV/ssl/"
  [ -f "$INSTALL_DIR/lib/lua/$LUAV/ssl.so" ] || { echo "Error: ssl.so isn't 
found"; exit 1; }
  [ $DEBUGBUILD ] || strip --strip-unneeded "$INSTALL_DIR/lib/lua/$LUAV/ssl.so"
  cd ..
  rm -rf "$LUASEC_FILENAME" "$LUASEC_BASENAME"
fi

# now copy the compiled dependencies to ZBS binary directory
mkdir -p "$BIN_DIR" || { echo "Error: cannot create directory $BIN_DIR"; exit 
1; }
[ $BUILD_LUA ] && cp "$INSTALL_DIR/bin/lua$LUAS" "$BIN_DIR"
[ $BUILD_WXLUA ] && cp "$INSTALL_DIR/lib/libwx.so" "$BIN_DIR/clibs"
[ $BUILD_LFS ] && cp "$INSTALL_DIR/lib/lua/$LUAV/lfs.so" "$BIN_DIR/clibs$LUAS"
[ $BUILD_LPEG ] && cp "$INSTALL_DIR/lib/lua/$LUAV/lpeg.so" "$BIN_DIR/clibs$LUAS"
[ $BUILD_LEXLPEG ] && cp "$INSTALL_DIR/lib/lua/$LUAV/lexlpeg.so" 
"$BIN_DIR/clibs$LUAS"

if [ $BUILD_LUASOCKET ]; then
  mkdir -p "$BIN_DIR/clibs$LUAS/"{mime,socket}
  cp "$INSTALL_DIR/lib/lua/$LUAV/mime/core.so" "$BIN_DIR/clibs$LUAS/mime"
  cp "$INSTALL_DIR/lib/lua/$LUAV/socket/core.so" "$BIN_DIR/clibs$LUAS/socket"
fi

if [ $BUILD_LUASEC ]; then
  cp "$INSTALL_DIR/lib/libcrypto.so" "$BIN_DIR/libcrypto.so.1.1"
  cp "$INSTALL_DIR/lib/libssl.so" "$BIN_DIR/libssl.so.1.1"
  cp "$INSTALL_DIR/lib/lua/$LUAV/ssl.so" "$BIN_DIR/clibs$LUAS"
  cp "$INSTALL_DIR/share/lua/$LUAV/ssl.lua" ../lualibs
  cp "$INSTALL_DIR/share/lua/$LUAV/ssl/https.lua" ../lualibs/ssl
fi

echo "*** Build has been successfully completed ***"
exit 0

Other related posts: