How To: compile Gargoyle on Mac OS X

Want to share your OpenWrt / Gargoyle knowledge? Implemented a new feature? Let us know here.

Moderator: Moderators

Post Reply
BashfulBladder
Moderator
Posts: 250
Joined: Thu Jan 17, 2013 11:43 pm

How To: compile Gargoyle on Mac OS X

Post by BashfulBladder »

This is a streamlined version of this OpenWRT How To. Tested on Mac OS X 10.6.8 so your 10.x may have other issues (you may need git). Expect a full build to take about an hour.
------------------------------------------------------------------
1. Get the build environment. You'll need Xcode installed & macports. Then in Terminal.app:

Code: Select all

sudo port -v selfupdate
and

Code: Select all

sudo port -v install coreutils asciidoc binutils bzip2 fastjar flex getopt gtk2 intltool jikes zlib openssl p5-extutils-makemaker python26 rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurses bash
Some of these are probably no longer needed, but its pretty painless since port will get binaries for most of these. You only have to do this once.

2. Optional: install Node & UglifyJS for Gargoyle's javascript compression. If you are going to compile Gargoyle a few times, this just saves Gargoyle having to fetch & install Node; UglifyJS is pretty quick.

Code: Select all

sudo port -v install nodejs npm
You may have to close a terminal window & reopen it the first time after installing npm for it to be available.

Code: Select all

sudo npm install -g uglify-js@1 
UglifyJS2 has some issue when it tries to mangle variables (shorten var some_absurdly_long_variable_name to var s) when I tried - TypeError: Cannot call method 'walk' of undefined - so UglifyJS1 (installed via the @1 switch above) mangles automagically.

3. The build scripts use features of utilities which are not present in the relative antiques that Apple provides. You will need to issue this command in each terminal session - it isn't permanent:

Code: Select all

export PATH=/opt/local/libexec/gnubin:$PATH
4. Set up a case sensitive disk image onto which Gargoyle/OpenWrt/Linux will be downloaded & compiled. This will create a 10GB disk image. Ammend TARGET_HARD_DRIVE to your system:

Code: Select all

hdiutil create /Volumes/TARGET_HARD_DRIVE/Gargoyle.sparsebundle -type SPARSEBUNDLE -size 10g -fs 'JHFS+X' -volname Gargoyle_source -layout NONE -attach
5. Get Gargoyle from the git repository:

Code: Select all

cd /Volumes/Gargoyle_source && git clone git://gargoyle-router.com/gargoyle.git
5 & 1/2. Currently, disktype-9 needs to be patched (passed onto OpenWrt)
Download & extract this patch file:
MacPatchFile-disktype.zip
(991 Bytes) Downloaded 415 times

Code: Select all

cp ~/Desktop/03-disktype-MacMakefile.patch /Volumes/Gargoyle_source/gargoyle/package/disktype/patches
5 & 3/4. Currently, some gargoyle libraries need to be patched - bugreport
Download & extract this patch file:
MacPatchFile-GargoyleLibs.zip
(1.38 KiB) Downloaded 382 times

Code: Select all

cd /Volumes/Gargoyle_source/gargoyle && patch -p0 -i ~/Desktop/GargoyleLibs.patch
6. Compile. This will compile for the ar71xx platform with the usb_large profile:

Code: Select all

cd /Volumes/Gargoyle_source/gargoyle && make V=99 ar71xx.usb_large

I compared a Linux Mint 14 image with a Mac OS X image. They didn't match. I compared a single small .ipk file. They didn't match. It seems an .ipk file is 2 tar.gzip files - these files have timestamps. The timestamps alone will throw off any comparison, but I also found size discrepancies between a Linux&Mac build arising from (probably) deflate optimizations. At the end of it all, I have successfully flashed an image onto my TP-Link WRT3600 router using a Mac compiled image.

2013-Mar01 updated steps to expand $PATH to gnubin
2013-Mar10 (optional) Node & Uglify installed globally
2013-May23 updated GargoyleLibs.patch
TP-Link WDR3600 v1.1 running 1.5.10+ L10n-English (Built 20130922 - OpenWrt r38093)
TP-Link WDR4300 running 1.5.10+ i18n-English (Built 20131010 - OpenWrt r38286)

https://github.com/BashfulBladder/gargoyle-plugins/wiki

Post Reply