From a0781061482b8d619f17245628d9374e7ace7b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 6 Jul 2015 12:19:33 +0200 Subject: [PATCH] Compatibility GNU/BSD, fix #20 Changed `sed -r` to `sed -E`. OSX does not support `sed -r` while FreeBSD does. GNU sed seems to support `sed -E` even if it is not in the man page. Changed install command. --- Makefile | 22 +++++++++++----------- README.md | 2 +- scripts/debian.sh | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 5b86194..23d4d00 100644 --- a/Makefile +++ b/Makefile @@ -11,23 +11,23 @@ SED_INSTALL_DIR=$(shell echo "$(INSTALL_DIR)" | sed -e 's/[\/&]/\\&/g') love-release: clean mkdir -p '$(BUILD_DIR)' - longopt=$$(grep "^LONG_OPTIONS" love-release.sh | sed -re 's/LONG_OPTIONS="(.*)"/\1/'); \ + longopt=$$(grep "^LONG_OPTIONS" love-release.sh | sed -Ee 's/LONG_OPTIONS="(.*)"/\1/'); \ for file in scripts/*.sh; do \ - s="$$(grep -E -m 1 "^OPTIONS=['\"]?.*['\"]?" "$$file" | sed -re "s/OPTIONS=['\"]?//" -e "s/['\"]?$$//")"; \ + s="$$(grep -E -m 1 "^OPTIONS=['\"]?.*['\"]?" "$$file" | sed -Ee "s/OPTIONS=['\"]?//" -e "s/['\"]?$$//")"; \ short="$${s}$${short}"; \ l="$$s$$(echo "$$longopt" | sed -e "s/,/,$${s}/g")"; \ - ll="$$(grep -E -m 1 "^LONG_OPTIONS=['\"]?.*['\"]?" "$$file" | sed -re "s/LONG_OPTIONS=['\"]?//" -e "s/['\"]?$$//" -e "s/,/,$${s}/g")"; \ + ll="$$(grep -E -m 1 "^LONG_OPTIONS=['\"]?.*['\"]?" "$$file" | sed -Ee "s/LONG_OPTIONS=['\"]?//" -e "s/['\"]?$$//" -e "s/,/,$${s}/g")"; \ if [[ -n $$ll ]]; then l="$${l},$${s}$${ll}"; fi; \ long="$${l},$${long}"; \ if [[ -n $$shelp ]]; then shelp="$$shelp\n"; fi; \ shelp="$$shelp -$$(grep "init_module" $$file | sed -e 's/init_module //' -e 's/" "/\t/g' -e 's/"//g' | awk -F "\t" '{print($$3," ",$$1)}')"; \ done; \ - sed -re "s/^OPTIONS=(['\"]?)/OPTIONS=\1$$short/" -e "s/^LONG_OPTIONS=(['\"]?)/LONG_OPTIONS=\1$$long/" \ + sed -Ee "s/^OPTIONS=(['\"]?)/OPTIONS=\1$$short/" -e "s/^LONG_OPTIONS=(['\"]?)/LONG_OPTIONS=\1$$long/" \ -e 's/INSTALLED=false/INSTALLED=true/' \ -e "/^EndOfSHelp/ i\\$$shelp" \ -e 's/SCRIPTS_DIR="scripts"/SCRIPTS_DIR="$(SED_INSTALL_DIR)\/scripts"/' love-release.sh > '$(BUILD_DIR)/love-release'; \ - comp="$$(if [[ -n $$long ]]; then echo --$$long | tr -d ':' | sed -e 's/,$$//' -e 's/,/ --/g'; fi)$$(if [[ -n $$short ]]; then echo $$short | sed -r 's/(.)/ -\1/g'; fi) "; \ - sed -re "s/opts=\"(.*)/opts=\"$$comp\1/" completion.sh > '$(BUILD_DIR)/completion.sh' + comp="$$(if [[ -n $$long ]]; then echo --$$long | tr -d ':' | sed -e 's/,$$//' -e 's/,/ --/g'; fi)$$(if [[ -n $$short ]]; then echo $$short | sed -E 's/(.)/ -\1/g'; fi) "; \ + sed -Ee "s/opts=\"(.*)/opts=\"$$comp\1/" completion.sh > '$(BUILD_DIR)/completion.sh' cp love-release.1 '$(BUILD_DIR)/love-release.1' gzip '$(BUILD_DIR)/love-release.1' @@ -35,26 +35,26 @@ install: install -m 0755 '$(BUILD_DIR)/love-release' '$(BINARY_DIR)' install -m 0755 -d '$(INSTALL_DIR)' '$(INSTALL_DIR)/scripts' '$(COMPLETION_DIR)' install -m 0755 scripts/* '$(INSTALL_DIR)/scripts' - install -m 0644 -t '$(INSTALL_DIR)' README.md conf.lua modules.md + install -m 0644 README.md conf.lua modules.md '$(INSTALL_DIR)' install -m 0644 '$(BUILD_DIR)/completion.sh' '$(COMPLETION_DIR)/love-release' install -m 0644 '$(BUILD_DIR)/love-release.1.gz' '$(MANPAGE_DIR)' embedded: clean mkdir -p '$(BUILD_DIR)' - longopt=$$(grep "^LONG_OPTIONS" love-release.sh | sed -re 's/LONG_OPTIONS="(.*)"/\1/'); \ + longopt=$$(grep "^LONG_OPTIONS" love-release.sh | sed -Ee 's/LONG_OPTIONS="(.*)"/\1/'); \ for file in scripts/*.sh; do \ module="$$(basename -s '.sh' "$$file")"; \ content='(source <(cat <<\EndOfModule'$$'\n'"$$(cat $$file)"$$'\n''EndOfModule'$$'\n''))'$$'\n''default_module'$$'\n\n'; \ echo "$$content" >> "$(BUILD_DIR)/tmp"; \ - s="$$(grep -E -m 1 "^OPTIONS=['\"]?.*['\"]?" "$$file" | sed -re "s/OPTIONS=['\"]?//" -e "s/['\"]?$$//")"; \ + s="$$(grep -E -m 1 "^OPTIONS=['\"]?.*['\"]?" "$$file" | sed -Ee "s/OPTIONS=['\"]?//" -e "s/['\"]?$$//")"; \ short="$${s}$${short}"; \ l="$$s$$(echo "$$longopt" | sed -e "s/,/,$${s}/g")"; \ - ll="$$(grep -E -m 1 "^LONG_OPTIONS=['\"]?.*['\"]?" "$$file" | sed -re "s/LONG_OPTIONS=['\"]?//" -e "s/['\"]?$$//" -e "s/,/,$${s}/g")"; \ + ll="$$(grep -E -m 1 "^LONG_OPTIONS=['\"]?.*['\"]?" "$$file" | sed -Ee "s/LONG_OPTIONS=['\"]?//" -e "s/['\"]?$$//" -e "s/,/,$${s}/g")"; \ if [[ -n $$ll ]]; then l="$${l},$${s}$${ll}"; fi; \ long="$${l},$${long}"; \ shelp="$$shelp -$$(grep "init_module" $$file | sed -e 's/init_module //' -e 's/" "/\t/g' -e 's/"//g' | awk -F "\t" '{print($$3," ",$$1)}')"; \ done; \ - sed -re "s/^OPTIONS=(['\"]?)/OPTIONS=\1$$short/" -e "s/^LONG_OPTIONS=(['\"]?)/LONG_OPTIONS=\1$$long/" \ + sed -Ee "s/^OPTIONS=(['\"]?)/OPTIONS=\1$$short/" -e "s/^LONG_OPTIONS=(['\"]?)/LONG_OPTIONS=\1$$long/" \ -e 's/EMBEDDED=false/EMBEDDED=true/' \ -e "/^EndOfSHelp/ i\\$$shelp" \ -e '/include_scripts_here$$/r $(BUILD_DIR)/tmp' love-release.sh > '$(BUILD_DIR)/love-release.sh' diff --git a/README.md b/README.md index d6a7e64..9df12cc 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ `love-release.sh` -- Bash script to generate [LÖVE](https://love2d.org/) game releases ### INSTALLATION -`love-release` relies on `GNU sed`, `GNU getopt` (OSX and BSD user needs to install them), `curl`, `zip` and `unzip`. +`love-release` relies on `GNU getopt` (OSX and BSD user needs to install it), `curl`, `zip` and `unzip`. You need to have `lua` installed to be able to read the configuration. You also need Wine to get icons and installer for Windows, the Debian pakaging utilities for Debian and the Android SDK to build a package for Android. diff --git a/scripts/debian.sh b/scripts/debian.sh index bc78977..6c8cc80 100644 --- a/scripts/debian.sh +++ b/scripts/debian.sh @@ -93,7 +93,7 @@ fi cd "$TEMP" # TODO: There might be a problem here if the filename contains weird characters. -find "usr" -type f -exec md5sum {} \; | sed -r "s/^([0-9a-f]{32} )/\1\//g" > "$TEMP/DEBIAN/md5sums" +find "usr" -type f -exec md5sum {} \; | sed -E "s/^([0-9a-f]{32} )/\1\//g" > "$TEMP/DEBIAN/md5sums" cd "$PROJECT_DIR" fakeroot dpkg-deb -b "$TEMP" "$RELEASE_DIR/$IDENTITY-${GAME_VERSION}_all.deb"