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.
This commit is contained in:
Antonin Décimo
2015-07-06 12:19:33 +02:00
parent d4291daf92
commit a078106148
3 changed files with 13 additions and 13 deletions

View File

@@ -11,23 +11,23 @@ SED_INSTALL_DIR=$(shell echo "$(INSTALL_DIR)" | sed -e 's/[\/&]/\\&/g')
love-release: clean love-release: clean
mkdir -p '$(BUILD_DIR)' 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 \ 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}"; \ short="$${s}$${short}"; \
l="$$s$$(echo "$$longopt" | sed -e "s/,/,$${s}/g")"; \ 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; \ if [[ -n $$ll ]]; then l="$${l},$${s}$${ll}"; fi; \
long="$${l},$${long}"; \ long="$${l},$${long}"; \
if [[ -n $$shelp ]]; then shelp="$$shelp\n"; fi; \ 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)}')"; \ 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; \ 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 's/INSTALLED=false/INSTALLED=true/' \
-e "/^EndOfSHelp/ i\\$$shelp" \ -e "/^EndOfSHelp/ i\\$$shelp" \
-e 's/SCRIPTS_DIR="scripts"/SCRIPTS_DIR="$(SED_INSTALL_DIR)\/scripts"/' love-release.sh > '$(BUILD_DIR)/love-release'; \ -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) "; \ 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 -re "s/opts=\"(.*)/opts=\"$$comp\1/" completion.sh > '$(BUILD_DIR)/completion.sh' sed -Ee "s/opts=\"(.*)/opts=\"$$comp\1/" completion.sh > '$(BUILD_DIR)/completion.sh'
cp love-release.1 '$(BUILD_DIR)/love-release.1' cp love-release.1 '$(BUILD_DIR)/love-release.1'
gzip '$(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 '$(BUILD_DIR)/love-release' '$(BINARY_DIR)'
install -m 0755 -d '$(INSTALL_DIR)' '$(INSTALL_DIR)/scripts' '$(COMPLETION_DIR)' install -m 0755 -d '$(INSTALL_DIR)' '$(INSTALL_DIR)/scripts' '$(COMPLETION_DIR)'
install -m 0755 scripts/* '$(INSTALL_DIR)/scripts' 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)/completion.sh' '$(COMPLETION_DIR)/love-release'
install -m 0644 '$(BUILD_DIR)/love-release.1.gz' '$(MANPAGE_DIR)' install -m 0644 '$(BUILD_DIR)/love-release.1.gz' '$(MANPAGE_DIR)'
embedded: clean embedded: clean
mkdir -p '$(BUILD_DIR)' 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 \ for file in scripts/*.sh; do \
module="$$(basename -s '.sh' "$$file")"; \ module="$$(basename -s '.sh' "$$file")"; \
content='(source <(cat <<\EndOfModule'$$'\n'"$$(cat $$file)"$$'\n''EndOfModule'$$'\n''))'$$'\n''default_module'$$'\n\n'; \ content='(source <(cat <<\EndOfModule'$$'\n'"$$(cat $$file)"$$'\n''EndOfModule'$$'\n''))'$$'\n''default_module'$$'\n\n'; \
echo "$$content" >> "$(BUILD_DIR)/tmp"; \ 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}"; \ short="$${s}$${short}"; \
l="$$s$$(echo "$$longopt" | sed -e "s/,/,$${s}/g")"; \ 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; \ if [[ -n $$ll ]]; then l="$${l},$${s}$${ll}"; fi; \
long="$${l},$${long}"; \ 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)}')"; \ 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; \ 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 's/EMBEDDED=false/EMBEDDED=true/' \
-e "/^EndOfSHelp/ i\\$$shelp" \ -e "/^EndOfSHelp/ i\\$$shelp" \
-e '/include_scripts_here$$/r $(BUILD_DIR)/tmp' love-release.sh > '$(BUILD_DIR)/love-release.sh' -e '/include_scripts_here$$/r $(BUILD_DIR)/tmp' love-release.sh > '$(BUILD_DIR)/love-release.sh'

View File

@@ -2,7 +2,7 @@
`love-release.sh` -- Bash script to generate [LÖVE](https://love2d.org/) game releases `love-release.sh` -- Bash script to generate [LÖVE](https://love2d.org/) game releases
### INSTALLATION ### 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 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. 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.

View File

@@ -93,7 +93,7 @@ fi
cd "$TEMP" cd "$TEMP"
# TODO: There might be a problem here if the filename contains weird characters. # 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" cd "$PROJECT_DIR"
fakeroot dpkg-deb -b "$TEMP" "$RELEASE_DIR/$IDENTITY-${GAME_VERSION}_all.deb" fakeroot dpkg-deb -b "$TEMP" "$RELEASE_DIR/$IDENTITY-${GAME_VERSION}_all.deb"