-
-
Save mjstephan/c6204b5a24c19e5bd992091e289043d2 to your computer and use it in GitHub Desktop.
Revisions
-
zirkuswurstikus revised this gist
Jul 15, 2024 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ # Build & install Lua on macOS # We will compile Lua 5.1 because it is compatible with openresty/lapis. # Replace the variables from line 30 ff to install a diffrent version. # See: https://www.lua.org/manual/5.1/ @@ -25,11 +26,11 @@ softwareupdate --install --all ## Create Lua Directory # Where to install lua, luajit, luarocks ..? LUA=~/devop/lua mkdir -p $LUA ## Download and Extract Lua Sources cd /tmp wget https://www.lua.org/ftp/lua-5.1.5.tar.gz # Optional: Check hash @@ -48,7 +49,7 @@ make macosx make test && make install ## Optional: Update environment variables # We place the Lua related variabls in a dedicated file and source it. echo 'export PATH=${LUA}bin:$PATH' >> ${LUA}/.profile echo "export LUA_CPATH=${LUA}lib/lua/5.1/?.so" >> ${LUA}/.profile @@ -77,7 +78,7 @@ tar xvf luarocks-3.9.1.tar.gz cd luarocks-3.9.1/ # Configure and install LuaRocks ./configure --prefix=${LUA} --with-lua=${LUA} --lua-suffix=5.1 --with-lua-include=${LUA}/include make build && make install # Verify LuaRocks installation @@ -86,7 +87,7 @@ luarocks --version ### Build and Install LuaJIT # Create a git folder in the Lua directory to keep things together (optional) mkdir $LUA/git cd $LUA/git @@ -111,7 +112,7 @@ luajit -v echo 'external_deps_dirs = { "/opt/homebrew" }' >> ${LUA}/etc/luarocks/config-5.1.lua ## Install LuaSec rock (optional to test luarocks) # Ensure OpenSSL is installed - for example via Homebrew # brew install openssl # you may adjust the path to libs luarocks --local install luasec \ -
zirkuswurstikus revised this gist
May 28, 2024 . 1 changed file with 18 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,35 @@ # Build & install Lua on macOS # We will compile Lua 5.1 because it is compatible with openresty/lapis. # See: https://www.lua.org/manual/5.1/ # NOTE: # We create a dedicated directory for the Lua stuff to putt all the stuff in. # TIP: # see a recording at https://asciinema.org/a/436ETWqckvdkjrHolTJ2YSzqw ## Tested on ... sysctl -n machdep.cpu.brand_string # Apple M1 sw_vers -productName # macOS sw_vers -productVersion # 14.5 ## Install build tools xcode-select --install # Optional: Update all software softwareupdate --install --all ## Create Lua Directory # Where to install lua, luajit, luarocks ..? LUA=~/devop/lua/ mkdir -p $LUA ## Download and Extract Lua Sources cd /tmp wget https://www.lua.org/ftp/lua-5.1.5.tar.gz # Optional: Check hash @@ -46,7 +47,8 @@ sed -i '' "s#/usr/local#${LUA}/#g" Makefile make macosx make test && make install ## Optional: Update environment variables # We place the Lua related variabls in a dedicated file and sourc it. echo 'export PATH=${LUA}bin:$PATH' >> ${LUA}/.profile echo "export LUA_CPATH=${LUA}lib/lua/5.1/?.so" >> ${LUA}/.profile @@ -65,7 +67,7 @@ lua -v file ${LUA}/bin/lua # Expected Output: ... Mach-O 64-bit executable arm64 ### Build and install LuaRocks cd /tmp wget https://luarocks.org/releases/luarocks-3.9.1.tar.gz @@ -115,3 +117,4 @@ echo 'external_deps_dirs = { "/opt/homebrew" }' >> ${LUA}/etc/luarocks/config-5. luarocks --local install luasec \ OPENSSL_INCDIR=/opt/homebrew/Cellar/openssl@3/3.3.0/include/ \ OPENSSL_LIBDIR=/opt/homebrew/Cellar/openssl@3/3.3.0/lib -
zirkuswurstikus renamed this gist
May 28, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
zirkuswurstikus renamed this gist
May 28, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
zirkuswurstikus revised this gist
May 27, 2024 . No changes.There are no files selected for viewing
-
zirkuswurstikus revised this gist
May 27, 2024 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # Install Lua on macOS # see a recording at https://asciinema.org/a/436ETWqckvdkjrHolTJ2YSzqw # We will compile Lua 5.1 because it is compatible with openresty/lapis. # See: https://www.lua.org/manual/5.4/readme.html -
zirkuswurstikus renamed this gist
May 27, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
zirkuswurstikus created this gist
May 27, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,115 @@ # Install Lua on macOS # We will compile Lua 5.1 because it is compatible with openresty/lapis. # See: https://www.lua.org/manual/5.4/readme.html # NOTE: We create a dedicated directory for the Lua stuff. ## Check CPU Brand sysctl -n machdep.cpu.brand_string # Output: Apple M1 ## Install Build Tools xcode-select --install # Optional: Update all software softwareupdate --install --all ## Create Lua Directory # Where to install lua, luajit, luarocks ... LUA=~/devop/lua/ mkdir -p $LUA cd /tmp ## Download and Extract Lua Sources wget https://www.lua.org/ftp/lua-5.1.5.tar.gz # Optional: Check hash shasum -a 256 lua-5.1.5.tar.gz | grep -q '2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333' \ && echo "Hash matches" || echo "Hash does not match" tar xvf lua-5.1.5.tar.gz cd lua-5.1.5/ ## Modify Makefile to set destination dir sed -i '' "s#/usr/local#${LUA}/#g" Makefile ## Compile and install Lua make macosx make test && make install ## Update environment variables echo 'export PATH=${LUA}bin:$PATH' >> ${LUA}/.profile echo "export LUA_CPATH=${LUA}lib/lua/5.1/?.so" >> ${LUA}/.profile echo "export LUA_PATH=${LUA}share/lua/5.1/?.lua;;" >> ${LUA}/.profile echo "export MANPATH=${LUA}share/man:\$MANPATH" >> ${LUA}/.profile echo 'source ${LUA}/.profile' >> ~/.bashrc echo 'source ${LUA}/.profile' >> ~/.zshrc source ${LUA}/.profile ### Verify Lua Installation which lua lua -v # Expected Output: Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio file ${LUA}/bin/lua # Expected Output: ... Mach-O 64-bit executable arm64 ### Build and Install LuaRocks cd /tmp wget https://luarocks.org/releases/luarocks-3.9.1.tar.gz # Extract and enter the directory tar xvf luarocks-3.9.1.tar.gz cd luarocks-3.9.1/ # Configure and install LuaRocks ./configure --prefix=${LUA} --with-lua=${LUA} --lua-suffix=5.1 --with-lua-include=${LUA}include make build && make install # Verify LuaRocks installation lua -v luarocks --version ### Build and Install LuaJIT # Create a git folder in the Lua directory mkdir $LUA/git cd $LUA/git # Clone the LuaJIT repository git clone https://luajit.org/git/luajit.git cd luajit # Get macOS version and set MACOSX_DEPLOYMENT_TARGET MACOS_VERSION=$(sw_vers -productVersion) MACOSX_DEPLOYMENT_TARGET=${MACOS_VERSION%.*} # Compile and install LuaJIT MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} make MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} make install PREFIX=${LUA} source ${LUA}/.profile luajit -v ### Install LuaSec for Testing # Add external dependencies directory to LuaRocks config echo 'external_deps_dirs = { "/opt/homebrew" }' >> ${LUA}/etc/luarocks/config-5.1.lua ## Install LuaSec rock (optional to test luarocks) # Ensure OpenSSL is installed via Homebrew for example # brew install openssl # you may adjust the path to libs luarocks --local install luasec \ OPENSSL_INCDIR=/opt/homebrew/Cellar/openssl@3/3.3.0/include/ \ OPENSSL_LIBDIR=/opt/homebrew/Cellar/openssl@3/3.3.0/lib