Skip to content

Instantly share code, notes, and snippets.

@tfwio
Last active August 29, 2015 14:07
Show Gist options
  • Save tfwio/83b2b499d5827f0d83bc to your computer and use it in GitHub Desktop.
Save tfwio/83b2b499d5827f0d83bc to your computer and use it in GitHub Desktop.

requires msys+mingw-w64(>= 4.8.0)+curl+git

CURRENT OF 2014 November

  • git sha1-revision: 65cb3326e30ef8a67eb1d4411ec563e91be6e9ae

tested using

  • MinGW from win-builds (using their download-tool)---both x86 and x64 tool-sets were tested.
  • win-builds-i686-w64-mingw32-4.8.2 (32bit here) --- 4.8.0, 4.9.1, 4.9.2, posix-sjlj posix-dwarf/dw2 were tested. win32-threading models aren't supported by this patch.
  • if attempting to try some other tool-chain (via an installer) make sure libgcc_s.a is available to the compiler-system. If the library is missing, your binary will depend on some dlls, or the build might fail.

TODO: If you don't have msys+mingw-w64, and just want the quickest possible solution...

If you have MSYS with one of the compilers mentioned allread configured

  1. fulfill requirements: MSYS + MinGW-w64 + GIT
  2. Load up your bash shell
    • you might want to place a command script in your MSYS directory and type: msys.bat -mintty (mintty is a much better terminal then windows command shell)
  3. create and/or navigate to a desired build directory
  4. copy/paste and execute the following snipit
    • this will create a sub-directory named font-compression-tools from git, patch and build.
    • binaries will be in the font-compression-tools directory.

x64 or x86

curl -L https://gist.github.com/tfwio/83b2b499d5827f0d83bc/raw/0c0a037ce025c87bcbc379485e3417b795e1467f/get-woff2.sh -o get-woff2
get-woff2

# ^ additional LF

this script is nearly obsolete: working on another script that compiles more font tools here

# use at your own risk.
# this script is released to the public domain without restriction.
# the font-compression-reference project constitutes its own copyright
# and licensing information.
brotli/enc/write_bits.h | 1 -
shared.mk | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/brotli/enc/write_bits.h b/brotli/enc/write_bits.h
index cf6f53e..95b29db 100644
--- a/brotli/enc/write_bits.h
+++ b/brotli/enc/write_bits.h
@@ -21,7 +21,6 @@
#if defined(OS_MACOSX)
#include <machine/endian.h>
#else
- #include <endian.h>
#endif
#include <stdint.h>
#include <stdio.h>
diff --git a/shared.mk b/shared.mk
index 15dca18..b9781e8 100644
--- a/shared.mk
+++ b/shared.mk
@@ -1,10 +1,10 @@
OS := $(shell uname)
-IDIRS=-I../brotli/dec/ -I../brotli/enc/ -I../
+IDIRS=-I../brotli/dec/ -I../brotli/enc/ -I../ -I/mingw/include/sys
-GFLAGS=-no-canonical-prefixes -fno-omit-frame-pointer -m64
+GFLAGS=-Wl,-s -no-canonical-prefixes -fno-omit-frame-pointer -D_POSIX_THREAD_SAFE_FUNCTIONS
-CPP = g++
-LFLAGS =
+CPP = g++
+LFLAGS =-static -L/mingw/lib
CPPFLAGS = -c $(IDIRS) -std=c++0x $(GFLAGS)
ifeq ($(OS), Darwin)
#=============================================================
#!/bin/sh
#======================================================================
# use at your own risk.
# this script is released to the public domain without restriction.
# the font-compression-reference project constitutes its own copyright
# and licensing information.
#======================================================================
HEREHERE=${PWD}
REPO_URL=https://code.google.com/p/font-compression-reference
REPO_SHA1=65cb3326e30ef8a67eb1d4411ec563e91be6e9ae
REPO_NAME=font-compression-reference
DIFF_FILE=get-woff2.diff
GIST_REV=83b2b499d5827f0d83bc/raw/8cf1fcd87e21411aabe02cddd935f44ec823e4eb
GIST_FILE=https://gist.githubusercontent.com/tfwio/${GIST_REV}/${DIFF_FILE}
function do_get ()
{
cd ${HEREHERE}
# clean (for rerun)
if [[ -d "${REPO_NAME}" ]] ; then rm -Rf ${REPO_NAME} ; fi
git clone ${REPO_URL} ${REPO_NAME}
# git
cd ${REPO_NAME}
git checkout ${REPO_SHA1}
cd ${HEREHERE}/${REPO_NAME}
# patch
curl -L ${GIST_FILE} -o${DIFF_FILE}
git apply ${DIFF_FILE}
# build
cd woff2 ; make ; mv *.exe ..
}
do_get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment