Browse Source

bugfixes + new OS X detection & homebrew based install of ttfautohint build dependency (including all ttfautohint build dependencies) on OS X

Chris Simpkins 7 years ago
parent
commit
df41182e49
1 changed files with 47 additions and 22 deletions
  1. 47 22
      build.sh

+ 47 - 22
build.sh

@@ -23,52 +23,77 @@ if [ $# -gt 1 ]
 elif [ "$1" = "--install-dependencies" ]
 elif [ "$1" = "--install-dependencies" ]
 	then
 	then
 		# fontmake
 		# fontmake
-		pip install fontmake
-		# fontTools
-		pip install fonttools
-		# ttfautohint v1.6 (must be pinned to v1.6 and above)
-		curl -L https://sourceforge.net/projects/freetype/files/ttfautohint/1.6/ttfautohint-1.6.tar.gz/download -o ttfautohint.tar.gz
-		tar -xvzf ttfautohint.tar.gz
-		ttfautohint-1.6/configure
-		sudo ttfautohint-1.6/make && sudo ttfautohint-1.6/make install
-		if [ -f "ttfautohint-1.6.tar.gz" ]
-			then
-			    rm ttfautohint-1.6.tar.gz
-		fi
-		if [ -d "ttfautohint-1.6"]
-			then
-			    rm -rf ttfautohint-1.6
-		fi
+		pip install --upgrade fontmake
+		# fontTools (installed with fontmake at this time. leave this as dependency check as python scripts for fixes require it should fontTools eliminate dep)
+		pip install --upgrade fonttools
+		# ttfautohint v1.6 (must be pinned to v1.6 and above for Hack instruction sets)
+        # begin with OS X check for platform specific ttfautohint install using Homebrew, install from source on other platforms
+        platformstr=$(uname)
+        if [ $platformstr = "Darwin" ]; then
+            # test for homebrew install
+            which homebrew
+            if [ $? -ne 0 ]
+                then
+                    echo "Please manually install Homebrew (https://brew.sh/) before the execution of this script with the --install-dependencies flag on the OS X platform." 1>&2
+                    exit 1
+            fi
+
+            # install Homebrew release of ttfautohint (this installs all dependencies necessary for build)
+            #    use --upgrade flag to confirm latest version installed as need 1.6+
+            brew install --upgrade ttfautohint
+            if [ $? -ne 0 ]
+                then
+                    echo "Unable to install ttfautohint with Homebrew.  Please attempt to install this dependency manually and repeat this script without the --install-dependencies flag." 1>&2
+                    exit 1
+            fi
+
+        else
+            curl -L https://sourceforge.net/projects/freetype/files/ttfautohint/1.6/ttfautohint-1.6.tar.gz/download -o ttfautohint.tar.gz
+            tar -xvzf ttfautohint.tar.gz
+            ttfautohint-1.6/configure --with-qt=no
+            ttfautohint-1.6/make && sudo ttfautohint-1.6/make install
+            if [ -f "ttfautohint-1.6.tar.gz" ]
+                then
+                    rm ttfautohint-1.6.tar.gz
+            fi
+            if [ -d "ttfautohint-1.6" ]
+                then
+                    rm -rf ttfautohint-1.6
+            fi
+        fi
 
 
 		# confirm installs
 		# confirm installs
-		installflag = 0
+		installflag=0
+        # fontmake installed
 		which fontmake
 		which fontmake
 		if [ $? -ne 0 ]
 		if [ $? -ne 0 ]
 			then
 			then
 			    echo "Unable to install fontmake with 'pip install fontmake'.  Please attempt manual install and repeat build without the --install-dependencies flag." 1>&2
 			    echo "Unable to install fontmake with 'pip install fontmake'.  Please attempt manual install and repeat build without the --install-dependencies flag." 1>&2
-			    $installflag = 1
+			    $installflag=1
 		fi
 		fi
 
 
+        # fontTools python library can be imported
 		python -c "import fontTools"
 		python -c "import fontTools"
 		if [ $? -ne 0 ]
 		if [ $? -ne 0 ]
 			then
 			then
 			    echo "Unable to install fontTools with 'pip install fonttools'.  Please attempt manual install and repeat build without the --install-dependencies flag." 1>&2
 			    echo "Unable to install fontTools with 'pip install fonttools'.  Please attempt manual install and repeat build without the --install-dependencies flag." 1>&2
-			    $installflag = 1
+			    $installflag=1
 		fi
 		fi
 
 
+        # ttfautohint installed
 		which ttfautohint
 		which ttfautohint
 		if [ $? -ne 0 ]
 		if [ $? -ne 0 ]
 			then
 			then
 			    echo "Unable to install ttfautohint from source.  Please attempt manual install and repeat build without the --install-dependencies flag." 1>&2
 			    echo "Unable to install ttfautohint from source.  Please attempt manual install and repeat build without the --install-dependencies flag." 1>&2
-			    $installflag = 1
+			    $installflag=1
 		fi
 		fi
 
 
-		# if any of the dependency installs failed, exit and do not attempt build
+		# if any of the dependency installs failed, exit and do not attempt build, notify user
 		if [ $installflag -eq 1 ]
 		if [ $installflag -eq 1 ]
 			then
 			then
 			    echo "Build canceled." 1>&2
 			    echo "Build canceled." 1>&2
 			    exit 1
 			    exit 1
-	    fi
+        fi
 fi
 fi
 
 
 # Desktop ttf font build
 # Desktop ttf font build