Skip to content

Instantly share code, notes, and snippets.

@atomotic
Created May 3, 2016 09:28
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 atomotic/81f07f880e0d09915aea8d33d81d70bb to your computer and use it in GitHub Desktop.
Save atomotic/81f07f880e0d09915aea8d33d81d70bb to your computer and use it in GitHub Desktop.
install wget-lua on osx
brew install lua5.1
curl http://warriorhq.archiveteam.org/downloads/wget-lua/wget-1.14.lua.LATEST.tar.bz2 | tar -xj --strip-components=1
sed -i -e s=usr/include/lua5.1=usr/local/include/lua5.1=g configure.ac
./configure
make
cp src/wget /usr/local/bin/wget-lua
wget-lua --help|grep lua
GNU Wget 1.14.lua.20130523-9a5c, a non-interactive network retriever.
Usage: wget-lua [OPTION]... [URL]...
--lua-script=FILE load the Lua script from FILE.
@nightpool
Copy link

nightpool commented Jan 28, 2017

brew install lua5.1 should be changed to brew install lua51 due to homebrew renaming packages

@notpeter
Copy link

I created a Homebrew formula so now this can be fully automated with:

brew install wget-lua 

Just pasta this formula here: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/wget-lua

class WgetLua < Formula
  desc "Modern wget with Lua hooks"
  homepage "https://github.com/ArchiveTeam/wget-lua"
  url "http://warriorhq.archiveteam.org/downloads/wget-lua/wget-1.14.lua.20160530-955376b.tar.gz"
  sha256 "f101783f757d0216df8115765ab9adf9ee9555d8411efe5b9010154b2e7511f7"
  version "1.14.lua.20160530-955376b"

  depends_on "pkg-config" => :build
  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "xz" => :build

  depends_on "gnutls"
  depends_on "libidn2"
  depends_on "gettext"
  depends_on "pcre"
  depends_on "lua@5.1"

  def install
    inreplace "configure", "usr/include/lua5.1", "usr/local/include/lua5.1"
    inreplace "configure.ac", "usr/include/lua5.1", "usr/local/include/lua5.1"
    # matching timestamps prevents unnecessary running of aclocal/autoreconf
    system "touch", "-r", "cfg.mk", "configure", "configure.ac"

    system "./configure", "--prefix=#{prefix}",
                          "--sysconfdir=#{etc}",
                          "--with-ssl=gnutls",
                          "--with-libgnutls-prefix=#{Formula["gnutls"].opt_prefix}",
                          # Work around a gnulib issue with macOS Catalina
                          "gl_cv_func_ftello_works=yes"
    system "make"
    # Allow wget and wget-lua to co-exist.
    mv "src/wget", "src/wget-lua"
    bin.install "src/wget-lua"
  end

  test do
    system bin/"wget-lua", "-O", "/dev/null", "https://google.com"
  end
end

@chosak
Copy link

chosak commented Sep 26, 2023

Thank you for this gist! For anyone coming here in 2023, creating the formula file alone wasn't sufficient; I had to run brew create ... per the Formula Cookbook.

Additionally, since my Homebrew installation is somewhere other than /usr/local/include, I needed to change the two inreplace lines to refer to "#{HOMEBREW_PREFIX}/include/lua-5.1" instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment