diff --git a/contrib/android/make_apk b/contrib/android/make_apk index 345222a0c..c3d70b98b 100755 --- a/contrib/android/make_apk +++ b/contrib/android/make_apk @@ -25,17 +25,10 @@ popd # update locale info "preparing electrum-locale." ( - cd "$CONTRIB"/deterministic-build/electrum-locale - if ! which msgfmt > /dev/null 2>&1; then - fail "Please install gettext" - fi + LOCALE="$PROJECT_ROOT/electrum/locale/" # we want the binary to have only compiled (.mo) locale files; not source (.po) files - rm -rf "$PROJECT_ROOT/electrum/locale/" - for i in ./locale/*; do - dir="$PROJECT_ROOT/electrum/$i/LC_MESSAGES" - mkdir -p $dir - msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true - done + rm -rf "$LOCALE" + "$CONTRIB/build_locale.sh" "$CONTRIB/deterministic-build/electrum-locale/locale/" "$LOCALE" ) pushd "$CONTRIB_ANDROID" diff --git a/contrib/build-linux/appimage/make_appimage.sh b/contrib/build-linux/appimage/make_appimage.sh index be86bc26b..0fcc5329d 100755 --- a/contrib/build-linux/appimage/make_appimage.sh +++ b/contrib/build-linux/appimage/make_appimage.sh @@ -93,18 +93,10 @@ info "preparing electrum-locale." cd "$PROJECT_ROOT" git submodule update --init - pushd "$CONTRIB"/deterministic-build/electrum-locale - if ! which msgfmt > /dev/null 2>&1; then - fail "Please install gettext" - fi + LOCALE="$PROJECT_ROOT/electrum/locale/" # we want the binary to have only compiled (.mo) locale files; not source (.po) files - rm -rf "$PROJECT_ROOT/electrum/locale/" - for i in ./locale/*; do - dir="$PROJECT_ROOT/electrum/$i/LC_MESSAGES" - mkdir -p $dir - msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true - done - popd + rm -rf "$LOCALE" + "$CONTRIB/build_locale.sh" "$CONTRIB/deterministic-build/electrum-locale/locale/" "$LOCALE" ) diff --git a/contrib/build-linux/sdist/make_sdist.sh b/contrib/build-linux/sdist/make_sdist.sh index 03b872910..ca004fcac 100755 --- a/contrib/build-linux/sdist/make_sdist.sh +++ b/contrib/build-linux/sdist/make_sdist.sh @@ -33,7 +33,7 @@ git submodule update --init rm -rf "$LOCALE" cp -r "$CONTRIB/deterministic-build/electrum-locale/locale/" "$LOCALE/" if ([ "$OMIT_UNCLEAN_FILES" != 1 ]); then - "$CONTRIB/build_locale.sh" "$LOCALE" + "$CONTRIB/build_locale.sh" "$LOCALE" "$LOCALE" fi ) diff --git a/contrib/build-wine/build-electrum-git.sh b/contrib/build-wine/build-electrum-git.sh index b4e64115a..4b69669c4 100755 --- a/contrib/build-wine/build-electrum-git.sh +++ b/contrib/build-wine/build-electrum-git.sh @@ -18,18 +18,10 @@ info "Last commit: $VERSION" # Load electrum-locale for this release git submodule update --init -pushd ./contrib/deterministic-build/electrum-locale -if ! which msgfmt > /dev/null 2>&1; then - fail "Please install gettext" -fi +LOCALE="$WINEPREFIX/drive_c/electrum/electrum/locale/" # we want the binary to have only compiled (.mo) locale files; not source (.po) files -rm -rf "$WINEPREFIX/drive_c/electrum/electrum/locale/" -for i in ./locale/*; do - dir="$WINEPREFIX/drive_c/electrum/electrum/$i/LC_MESSAGES" - mkdir -p $dir - msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true -done -popd +rm -rf "$LOCALE" +"$CONTRIB/build_locale.sh" "$CONTRIB/deterministic-build/electrum-locale/locale/" "$LOCALE" find -exec touch -h -d '2000-11-11T11:11:11+00:00' {} + popd diff --git a/contrib/build_locale.sh b/contrib/build_locale.sh index d3157cafc..425066754 100755 --- a/contrib/build_locale.sh +++ b/contrib/build_locale.sh @@ -1,7 +1,10 @@ #!/bin/bash -if [ ! -d "$1" ]; then - echo "usage: $0 path/to/locale" +set -e + +if [[ ! -d "$1" || -z "$2" ]]; then + echo "usage: $0 locale_source_dir locale_dest_dir" + echo " The dirs can match, to build in place." exit 1 fi @@ -10,7 +13,11 @@ if ! which msgfmt > /dev/null 2>&1; then exit 1 fi -for i in "$1/"*; do - mkdir -p "$i/LC_MESSAGES" - (msgfmt --output-file="$i/LC_MESSAGES/electrum.mo" "$i/electrum.po" || true) +cd "$1" +mkdir -p "$2" + +for i in *; do + dir="$2/$i/LC_MESSAGES" + mkdir -p "$dir" + (msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true) done diff --git a/contrib/osx/make_osx b/contrib/osx/make_osx index 60e7c5cf6..7651c9107 100755 --- a/contrib/osx/make_osx +++ b/contrib/osx/make_osx @@ -175,14 +175,10 @@ info "generating locale" brew install gettext brew link --force gettext fi - cd "$CONTRIB"/deterministic-build/electrum-locale + LOCALE="$PROJECT_ROOT/electrum/locale/" # we want the binary to have only compiled (.mo) locale files; not source (.po) files - rm -rf "$PROJECT_ROOT/electrum/locale/" - for i in ./locale/*; do - dir="$PROJECT_ROOT/electrum/$i/LC_MESSAGES" - mkdir -p "$dir" - msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true - done + rm -rf "$LOCALE" + "$CONTRIB/build_locale.sh" "$CONTRIB/deterministic-build/electrum-locale/locale/" "$LOCALE" ) || fail "failed generating locale"