From 460f54eef156c93d323403516c48fb2eb5579a86 Mon Sep 17 00:00:00 2001 From: Alexander Griffith Date: Wed, 8 Apr 2020 21:56:53 -0400 Subject: [PATCH] - Added -n option to AppRun (closes #3) - Bumped love version to 11.3 - Updated Fennel to current master branch b2d2155 --- appimage/build.sh | 114 +++++++++++++++++++++++----------------------- conf.lua | 2 +- lib/fennel.lua | 24 +++++++--- love-release.sh | 8 ++-- makefile | 7 +-- 5 files changed, 84 insertions(+), 71 deletions(-) diff --git a/appimage/build.sh b/appimage/build.sh index 9e19703..e7bcdb0 100755 --- a/appimage/build.sh +++ b/appimage/build.sh @@ -6,8 +6,8 @@ CURRENT_APPIMAGEKIT_RELEASE=9 ARCH="$(uname -m)" if [[ $# -lt 1 ]]; then - echo "Usage: $0 " - exit 0 + echo "Usage: $0 " + exit 0 fi VERSION="$1" @@ -16,78 +16,78 @@ LOVEFILE="$2" LOVE_TAR_URL=https://bitbucket.org/rude/love/downloads/love-${VERSION}-linux-${ARCH}.tar.gz LOVE_TAR=${HOME}/.cache/love-release/love/love-${VERSION}-${ARCH}.tar.gz if ! test -f ${LOVE_TAR}; then - echo "No tarball found for $VERSION in $LOVE_TAR" - exit 1 + echo "No tarball found for $VERSION in $LOVE_TAR" + exit 1 fi download_if_needed() { - if ! test -f "$1"; then - if ! curl -L -o "$1" "https://github.com/AppImage/AppImageKit/releases/download/${CURRENT_APPIMAGEKIT_RELEASE}/$1"; then - echo "Failed to download appimagetool" - echo "Please supply it manually" - exit 1 - fi - chmod +x "$1" - fi + if ! test -f "$1"; then + if ! curl -L -o "$1" "https://github.com/AppImage/AppImageKit/releases/download/${CURRENT_APPIMAGEKIT_RELEASE}/$1"; then + echo "Failed to download appimagetool" + echo "Please supply it manually" + exit 1 + fi + chmod +x "$1" + fi } main() { - download_if_needed appimagetool-${ARCH}.AppImage - download_if_needed AppRun-${ARCH} + download_if_needed appimagetool-${ARCH}.AppImage + download_if_needed AppRun-${ARCH} - # Extract the tarball build into a folder - rm -rf love-prepared - mkdir love-prepared - tar xf ${LOVE_TAR} -C love-prepared --strip-components=1 + # Extract the tarball build into a folder + rm -rf love-prepared + mkdir love-prepared + tar xf ${LOVE_TAR} -C love-prepared --strip-components=1 - cd love-prepared + cd love-prepared - # Add our small wrapper script (yay, more wrappers), and AppRun - cp ../wrapper usr/bin/wrapper-love - cp ../AppRun-${ARCH} AppRun + # Add our small wrapper script (yay, more wrappers), and AppRun + cp ../wrapper usr/bin/wrapper-love + cp ../AppRun-${ARCH} AppRun - local desktopfile="love.desktop" - local icon="love" - local target="love-${VERSION}" + local desktopfile="love.desktop" + local icon="love" + local target="love-${VERSION}" - if test -f ../../game.desktop.in; then - desktopfile="game.desktop" - cp ../../game.desktop.in . - fi - if test -f ../../game.svg; then - icon="game" - cp ../../game.svg . - fi - if test -f ${LOVEFILE}; then - target="game" - cat usr/bin/love ${LOVEFILE} > usr/bin/love-fused - mv usr/bin/love-fused usr/bin/love - chmod +x usr/bin/love + if test -f ../../game.desktop.in; then + desktopfile="game.desktop" + cp ../../game.desktop.in . + fi + if test -f ../../game.svg; then + icon="game" + cp ../../game.svg . + fi + if test -f ${LOVEFILE}; then + target="game" + cat usr/bin/love ${LOVEFILE} > usr/bin/love-fused + mv usr/bin/love-fused usr/bin/love + chmod +x usr/bin/love else - echo "Love file ${LOVEFILE} not found" - fi + echo "Love file ${LOVEFILE} not found" + fi - # Add our desktop file - sed -e 's/%BINARY%/wrapper-love/' -e "s/%ICON%/${icon}/" "${desktopfile}.in" > "$desktopfile" - rm "${desktopfile}.in" + # Add our desktop file + sed -e 's/%BINARY%/wrapper-love/' -e "s/%ICON%/${icon}/" "${desktopfile}.in" > "$desktopfile" + rm "${desktopfile}.in" - # Add a DirIcon - cp "${icon}.svg" .DirIcon + # Add a DirIcon + cp "${icon}.svg" .DirIcon - # Clean up - if test -f ../../game.desktop.in; then - rm love.desktop.in - fi - if test -f ../../game.svg; then - rm love.svg - fi + # Clean up + if test -f ../../game.desktop.in; then + rm love.desktop.in + fi + if test -f ../../game.svg; then + rm love.svg + fi - # Now build the final AppImage - cd .. + # Now build the final AppImage + cd .. - # Work around missing FUSE/docker - ./appimagetool-${ARCH}.AppImage --appimage-extract - ./squashfs-root/AppRun love-prepared "${target}-${ARCH}.AppImage" + # Work around missing FUSE/docker + ./appimagetool-${ARCH}.AppImage --appimage-extract + ./squashfs-root/AppRun love-prepared "${target}-${ARCH}.AppImage" } main "$@" diff --git a/conf.lua b/conf.lua index 16386c9..e34c72f 100644 --- a/conf.lua +++ b/conf.lua @@ -6,5 +6,5 @@ love.conf = function(t) t.window.width = 720 t.window.height = 450 t.window.vsync = false - t.version = "11.2" + t.version = "11.3" end diff --git a/lib/fennel.lua b/lib/fennel.lua index 6663866..747aaea 100644 --- a/lib/fennel.lua +++ b/lib/fennel.lua @@ -1403,8 +1403,11 @@ SPECIALS["fn"] = function(ast, scope, parent) local isLocalFn local docstring fScope.vararg = false + local multi = fnName and isMultiSym(fnName[1]) + assertCompile(not multi or not multi.multiSymMethodCall, + "malformed function name: " .. tostring(fnName), ast) if fnName and fnName[1] ~= 'nil' then - isLocalFn = not isMultiSym(fnName[1]) + isLocalFn = not multi if isLocalFn then fnName = declareLocal(fnName, {}, scope, ast) else @@ -1473,8 +1476,8 @@ SPECIALS["fn"] = function(ast, scope, parent) :gsub('"', '\\"') .. '"') end local metaStr = ('require("%s").metadata'):format(rootOptions.moduleName or "fennel") - emit(parent, string.format('%s:setall(%s, %s)', metaStr, - fnName, table.concat(metaFields, ', '))) + emit(parent, string.format('pcall(function() %s:setall(%s, %s) end)', + metaStr, fnName, table.concat(metaFields, ', '))) end checkUnused(fScope, ast) @@ -2017,7 +2020,7 @@ docSpecial("length", {"x"}, "Returns the length of a table or string.") SPECIALS["#"] = SPECIALS["length"] -- Save current macro scope -local macroCurrentScope = GLOBAL_SCOPE +local macroCurrentScope = nil -- Covert a macro function to a special form local function macroToSpecial(mac) @@ -2523,15 +2526,22 @@ local function makeCompilerEnv(ast, scope, parent) list = list, sym = sym, unpack = unpack, - gensym = function() return sym(gensym(macroCurrentScope)) end, + gensym = function() return sym(gensym(macroCurrentScope or scope)) end, ["list?"] = isList, ["multi-sym?"] = isMultiSym, ["sym?"] = isSym, ["table?"] = isTable, ["sequence?"] = isSequence, ["varg?"] = isVarg, - ["get-scope"] = function() return macroCurrentScope end, + ["get-scope"] = function() + if io and io.stderr then + io.stderr: + write(("-- %s:%s get-scope is deprecated and will be removed\n"): + format(ast.filename, ast.line)) + end + return macroCurrentScope end, ["in-scope?"] = function(symbol) + assertCompile(macroCurrentScope, "must call in-scope? from macro", ast) return macroCurrentScope.manglings[tostring(symbol)] end }, { __index = _ENV or _G }) @@ -2617,7 +2627,7 @@ SPECIALS['include'] = function(ast, scope, parent, opts) emit(tempChunk, subChunk, ast) -- if lua, simply emit the setting of package.preload if not isFennel then - emit(tempChunk, target .. ' = ' .. target .. ' or function()\n' .. s .. 'end', ast) + emit(tempChunk, target .. ' = ' .. target .. ' or function()\n' .. s .. '\nend', ast) end -- Splice tempChunk to begining of rootChunk for i, v in ipairs(tempChunk) do diff --git a/love-release.sh b/love-release.sh index b10828d..cfbf71f 100755 --- a/love-release.sh +++ b/love-release.sh @@ -1,8 +1,10 @@ -#!/usr/local/Cellar/bash/4.4.23/bin/bash -## #!/usr/bin/env bash +#!/usr/bin/env bash + +## For users on macos +## #!/usr/local/Cellar/bash/4.4.23/bin/bash # LÖVE version -LOVE_DEF_VERSION=0.11.2 +LOVE_DEF_VERSION=0.11.3 diff --git a/makefile b/makefile index c620ebd..99d9316 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,9 @@ VERSION=0.1.0 +LOVE_VERSION=11.3 NAME=change-me ITCH_ACCOUNT=change-me-too URL=https://gitlab.com/alexjgriffith/min-love2d-fennel -AUTHOR="Alexander Griffith" +AUTHOR="Your Name" DESCRIPTION="Minimal setup for trying out Phil Hagelberg's fennel/love game design process." LIBS := $(wildcard lib/*) @@ -33,10 +34,10 @@ love: $(LOVEFILE) REL=$(PWD)/love-release.sh # https://p.hagelb.org/love-release.sh FLAGS=-a "$(AUTHOR)" --description $(DESCRIPTION) \ - --love 11.2 --url $(URL) --version $(VERSION) --lovefile $(LOVEFILE) + --love $(LOVE_VERSION) --url $(URL) --version $(VERSION) --lovefile $(LOVEFILE) releases/$(NAME)-$(VERSION)-x86_64.AppImage: $(LOVEFILE) - cd appimage && ./build.sh 11.1 $(PWD)/$(LOVEFILE) + cd appimage && ./build.sh $(LOVE_VERSION) $(PWD)/$(LOVEFILE) mv appimage/game-x86_64.AppImage $@ releases/$(NAME)-$(VERSION)-macos.zip: $(LOVEFILE)