diff options
Diffstat (limited to 'init.sh')
-rwxr-xr-x | init.sh | 112 |
1 files changed, 65 insertions, 47 deletions
@@ -32,13 +32,15 @@ else if [[ "$1" == "-h" ]] || [[ "$1" == "-help" ]] || [[ "$1" == "--help" ]]; then echo "usage: $0 [options]" >&2 echo "options:" >&2 - echo " -clean Start from scratch" >&2 + echo " -clean Start from scratch" >&2 + echo " -h, -help Show help and exit" >&2 exit 1 fi clean=false if [[ "$1" == "-clean" ]]; then clean=true + shift fi platform=osx @@ -362,59 +364,75 @@ else # ———————————————————————————————————————————————————————————————————————————————————————————————— # $BUILD_DIR/etc/generated.make - master_styles=( \ - Thin \ - ThinItalic \ - Regular \ - Italic \ - Black \ - BlackItalic \ - ) - derived_styles=( \ - "Light : Thin Regular" \ - "LightItalic : ThinItalic Italic" \ - "ExtraLight : Thin Regular" \ - "ExtraLightItalic : ThinItalic Italic" \ - "Medium : Regular Black" \ - "MediumItalic : Italic BlackItalic" \ - "SemiBold : Regular Black" \ - "SemiBoldItalic : Italic BlackItalic" \ - "Bold : Regular Black" \ - "BoldItalic : Italic BlackItalic" \ - "ExtraBold : Regular Black" \ - "ExtraBoldItalic : Italic BlackItalic" \ - ) - web_formats=( woff woff2 ) # Disabled/unused: eot - - mkdir -p "$BUILD_DIR/etc" - GEN_MAKE_FILE=$BUILD_DIR/etc/generated.make - # Warning about UFOs moving from src to build/ufo - for f in src/Inter-*.ufo; do - if [ -f "$f" ]; then - echo "" >&2 - echo "--------------------------- WARNING ----------------------------" >&2 - echo "" >&2 - echo " UFO files have moved from ./src to ./build/ufo" >&2 - echo "" >&2 - echo "If you are working with a UFO workflow, please manually move" >&2 - echo "your UFO source files from ./src to ./build/ufo." >&2 - echo "" >&2 - echo "If you are working in a Glyphps workflow, then simply remove" >&2 - echo "the UFO files in ./src to silence this warning." >&2 - echo "" >&2 - echo "----------------------------------------------------------------" >&2 - echo "" >&2 + GEN_MAKE_FILE=$BUILD_DIR/etc/generated.make + INIT_FILE_HASH= ; if [ -d .git ]; then INIT_FILE_HASH=$(git hash-object -w init.sh); fi + GENERATE_MAKE_FILE=false + if $clean || [[ ! -f "$GEN_MAKE_FILE" ]]; then + GENERATE_MAKE_FILE=true + else + # check to see if stored hash of init.sh is the same as the current init.sh + GEN_MAKE_FILE_LINE1=$(head -n 1 "$GEN_MAKE_FILE") + if [[ "$GEN_MAKE_FILE_LINE1" != "#$INIT_FILE_HASH" ]]; then + # the makefile was generated by a different version of init.sh + GENERATE_MAKE_FILE=true fi - break - done + fi # Generate BUILD_DIR/etc/generated.make - if $clean || [[ ! -f "$GEN_MAKE_FILE" ]] || [[ "$0" -nt "$GEN_MAKE_FILE" ]]; then + if $GENERATE_MAKE_FILE; then + + # Warning about UFOs moving from src to build/ufo + for f in src/Inter-*.ufo; do + if [ -f "$f" ]; then + echo "" >&2 + echo "--------------------------- WARNING ----------------------------" >&2 + echo "" >&2 + echo " UFO files have moved from ./src to ./build/ufo" >&2 + echo "" >&2 + echo "If you are working with a UFO workflow, please manually move" >&2 + echo "your UFO source files from ./src to ./build/ufo." >&2 + echo "" >&2 + echo "If you are working in a Glyphps workflow, then simply remove" >&2 + echo "the UFO files in ./src to silence this warning." >&2 + echo "" >&2 + echo "----------------------------------------------------------------" >&2 + echo "" >&2 + fi + break + done + echo "Generating '$GEN_MAKE_FILE'" - echo "# Generated by init.sh -- do not modify manually" > "$GEN_MAKE_FILE" + echo "#$INIT_FILE_HASH" > "$GEN_MAKE_FILE" + echo "# Generated by init.sh -- do not modify manually" >> "$GEN_MAKE_FILE" echo "" >> "$GEN_MAKE_FILE" + master_styles=( \ + Thin \ + ThinItalic \ + Regular \ + Italic \ + Black \ + BlackItalic \ + ) + derived_styles=( \ + "Light : Thin Regular" \ + "LightItalic : ThinItalic Italic" \ + "ExtraLight : Thin Regular" \ + "ExtraLightItalic : ThinItalic Italic" \ + "Medium : Regular Black" \ + "MediumItalic : Italic BlackItalic" \ + "SemiBold : Regular Black" \ + "SemiBoldItalic : Italic BlackItalic" \ + "Bold : Regular Black" \ + "BoldItalic : Italic BlackItalic" \ + "ExtraBold : Regular Black" \ + "ExtraBoldItalic : Italic BlackItalic" \ + ) + web_formats=( woff woff2 ) + + mkdir -p "$BUILD_DIR/etc" + all_styles=() instance_styles=() |