summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Donofry <rubberduckie3554@gmail.com>2019-04-29 15:48:51 -0400
committerGitHub <noreply@github.com>2019-04-29 15:48:51 -0400
commite1457d5c7ae1a7f507ce631c708d94ac24f60011 (patch)
treecdbf798b78024df70262971c6858d1342ea8d019
parentUpdate olm repo to new location. (diff)
parentimprove shell scripts and update .gitignore (diff)
downloadnheko-e1457d5c7ae1a7f507ce631c708d94ac24f60011.tar.xz
Merge pull request #58 from zapashcanon/sh
improve shell scripts and update .gitignore.  Thanks @zapashcanon 
-rwxr-xr-x.ci/format.sh13
-rwxr-xr-x.ci/install.sh25
-rwxr-xr-x.ci/linux/deploy.sh33
-rwxr-xr-x.ci/macos/deploy.sh35
-rwxr-xr-x.ci/script.sh29
-rw-r--r--.gitignore3
-rwxr-xr-xscripts/archive.sh4
-rwxr-xr-xscripts/generate_icns.sh26
8 files changed, 94 insertions, 74 deletions
diff --git a/.ci/format.sh b/.ci/format.sh
index d87bfb66..d3b629c3 100755
--- a/.ci/format.sh
+++ b/.ci/format.sh
@@ -1,14 +1,15 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
 # Runs the Clang Formatter
 # Return codes:
 #  - 1 there are files to be formatted
 #  - 0 everything looks fine
 
-set -o errexit
-set -o pipefail
-set -o nounset
+set -eu
 
-FILES=`find src -type f -type f \( -iname "*.cpp" -o -iname "*.h" \)`
+FILES=$(find src -type f -type f \( -iname "*.cpp" -o -iname "*.h" \))
 
-clang-format -i $FILES && git diff --exit-code
+for f in $FILES
+do
+    clang-format -i "$f" && git diff --exit-code
+done;
diff --git a/.ci/install.sh b/.ci/install.sh
index af935a59..8013df41 100755
--- a/.ci/install.sh
+++ b/.ci/install.sh
@@ -1,8 +1,8 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
-if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+if [ "$TRAVIS_OS_NAME" = "osx" ]; then
     brew update
     brew install qt5 lmdb clang-format ninja libsodium cmark
     brew upgrade boost cmake icu4c || true
@@ -20,7 +20,7 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then
 fi
 
 
-if [ "$TRAVIS_OS_NAME" == "linux" ]; then
+if [ "$TRAVIS_OS_NAME" = "linux" ]; then
 
     if [ -z "$QT_VERSION" ]; then
         QT_VERSION="592"
@@ -31,19 +31,18 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then
     sudo sh cmake-3.12.2-Linux-x86_64.sh  --skip-license  --prefix=/usr/local
 
     mkdir -p build-libsodium
-    pushd build-libsodium
-    curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz -o libsodium-1.0.16.tar.gz
-    tar xfz libsodium-1.0.16.tar.gz 
-    cd libsodium-1.0.16/
-    ./configure && make && make check && sudo make install
-    popd
+    ( cd build-libsodium
+      curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz -o libsodium-1.0.16.tar.gz
+      tar xfz libsodium-1.0.16.tar.gz
+      cd libsodium-1.0.16/
+      ./configure && make && make check && sudo make install )
 
     sudo add-apt-repository -y ppa:beineri/opt-qt${QT_VERSION}-trusty
-    sudo apt-get update -qq
-    sudo apt-get install -qq -y \
+    sudo apt update -qq
+    sudo apt install -qq -y \
         qt${QT_PKG}base \
         qt${QT_PKG}tools \
         qt${QT_PKG}svg \
         qt${QT_PKG}multimedia \
         liblmdb-dev
-fi
\ No newline at end of file
+fi
diff --git a/.ci/linux/deploy.sh b/.ci/linux/deploy.sh
index 0fd23808..b8c1c5e3 100755
--- a/.ci/linux/deploy.sh
+++ b/.ci/linux/deploy.sh
@@ -1,13 +1,17 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
 APP=nheko
 DIR=${APP}.AppDir
-TAG=`git tag -l --points-at HEAD`
+# unused but may be useful...
+#TAG=$(git tag -l --points-at HEAD)
 
 # Set up AppImage structure.
-mkdir -p ${DIR}/usr/{bin,lib,share/pixmaps,share/applications}
+for d in bin lib share/pixmaps share/applications
+do
+    mkdir -p ${DIR}/usr/$d
+done
 
 # Copy resources.
 cp build/nheko ${DIR}/usr/bin
@@ -27,19 +31,26 @@ fi
 chmod a+x linuxdeployqt*.AppImage
 
 unset QTDIR
-unset QT_PLUGIN_PATH 
+unset QT_PLUGIN_PATH
 unset LD_LIBRARY_PATH
 
-export ARCH=$(uname -m)
-export LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH
+ARCH=$(uname -m)
+export ARCH
+LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH
+
+for res in ./linuxdeployqt*.AppImage
+do
+    linuxdeployqt=$res
+done
 
-./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs
-./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -appimage
+./"$linuxdeployqt" ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs
+./"$linuxdeployqt" ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -appimage
 
 chmod +x nheko-*x86_64.AppImage
 
-if [ ! -z $VERSION ]; then
+if [ ! -z "$VERSION" ]; then
     # commented out for now, as AppImage file appears to already contain the version.
     #mv nheko-*x86_64.AppImage nheko-${VERSION}-x86_64.AppImage
     echo "nheko-${VERSION}-x86_64.AppImage"
-fi
\ No newline at end of file
+fi
diff --git a/.ci/macos/deploy.sh b/.ci/macos/deploy.sh
index 79701243..45ed13bc 100755
--- a/.ci/macos/deploy.sh
+++ b/.ci/macos/deploy.sh
@@ -1,29 +1,30 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
-TAG=`git tag -l --points-at HEAD`
+# unused
+#TAG=$(git tag -l --points-at HEAD)
 
 # Add Qt binaries to path
 PATH=/usr/local/opt/qt/bin/:${PATH}
 
-pushd build
+( cd build
+  # macdeployqt does not copy symlinks over.
+  # this specifically addresses icu4c issues but nothing else.
+  ICU_LIB="$(brew --prefix icu4c)/lib"
+  export ICU_LIB
+  mkdir -p nheko.app/Contents/Frameworks
+  find "${ICU_LIB}" -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true
 
-# macdeployqt does not copy symlinks over.
-# this specifically addresses icu4c issues but nothing else.
-export ICU_LIB="$(brew --prefix icu4c)/lib"
-mkdir -p nheko.app/Contents/Frameworks
-find ${ICU_LIB} -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true
+  sudo macdeployqt nheko.app -dmg -always-overwrite
 
-sudo macdeployqt nheko.app -dmg -always-overwrite
-
-user=$(id -nu)
-sudo chown ${user} nheko.dmg
-mv nheko.dmg ..
-popd
+  user=$(id -nu)
+  sudo chown "${user}" nheko.dmg
+  mv nheko.dmg ..
+)
 
 dmgbuild -s ./.ci/macos/settings.json "Nheko" nheko.dmg
 
-if [ ! -z $VERSION ]; then
-    mv nheko.dmg nheko-${VERSION}.dmg
+if [ ! -z "$VERSION" ]; then
+    mv nheko.dmg "nheko-${VERSION}.dmg"
 fi
diff --git a/.ci/script.sh b/.ci/script.sh
index 435f2c27..2d5cc49b 100755
--- a/.ci/script.sh
+++ b/.ci/script.sh
@@ -1,31 +1,32 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
-if [ "$TRAVIS_OS_NAME" == "linux" ]; then
+if [ "$TRAVIS_OS_NAME" = "linux" ]; then
     export CC=${C_COMPILER}
     export CXX=${CXX_COMPILER}
 
-    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/${C_COMPILER} 10
-    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/${CXX_COMPILER} 10
+    sudo update-alternatives --install /usr/bin/gcc gcc "/usr/bin/${C_COMPILER}" 10
+    sudo update-alternatives --install /usr/bin/g++ g++ "/usr/bin/${CXX_COMPILER}" 10
 
     sudo update-alternatives --set gcc "/usr/bin/${C_COMPILER}"
     sudo update-alternatives --set g++ "/usr/bin/${CXX_COMPILER}"
 fi
 
-if [ "$TRAVIS_OS_NAME" == "linux" ]; then
-    source /opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh || true;
+if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+    # shellcheck disable=SC1090
+    . "/opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh" || true;
 fi
 
-if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+if [ "$TRAVIS_OS_NAME" = "osx" ]; then
     export CMAKE_PREFIX_PATH=/usr/local/opt/qt5
 fi
 
 # Build & install dependencies
 cmake -GNinja -Hdeps -B.deps \
-    -DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST} \
-    -DUSE_BUNDLED_CMARK=${USE_BUNDLED_CMARK} \
-    -DUSE_BUNDLED_JSON=${USE_BUNDLED_JSON}
+    -DUSE_BUNDLED_BOOST="${USE_BUNDLED_BOOST}" \
+    -DUSE_BUNDLED_CMARK="${USE_BUNDLED_CMARK}" \
+    -DUSE_BUNDLED_JSON="${USE_BUNDLED_JSON}"
 cmake --build .deps
 
 # Build nheko
@@ -34,14 +35,14 @@ cmake -GNinja -H. -Bbuild \
     -DCMAKE_INSTALL_PREFIX=.deps/usr
 cmake --build build
 
-if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+if [ "$TRAVIS_OS_NAME" = "osx" ]; then
     make lint;
 
-    if [ $DEPLOYMENT == 1 ] && [ ! -z $VERSION ] ; then
+    if [ "$DEPLOYMENT" = 1 ] && [ ! -z "$VERSION" ] ; then
         make macos-deploy;
     fi
 fi
 
-if [ "$TRAVIS_OS_NAME" == "linux" ] && [ $DEPLOYMENT == 1 ] && [ ! -z $VERSION ]; then
+if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$DEPLOYMENT" = 1 ] && [ ! -z "$VERSION" ]; then
     make linux-deploy;
 fi
diff --git a/.gitignore b/.gitignore
index 0b2b05e8..e9c854d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -101,3 +101,6 @@ package.dir
 # Dependencies
 .third-party
 .deps
+
+# Archives
+*.bz2
diff --git a/scripts/archive.sh b/scripts/archive.sh
index 48d913d4..f8b1a82c 100755
--- a/scripts/archive.sh
+++ b/scripts/archive.sh
@@ -1,4 +1,6 @@
-#!/bin/bash -e
+#!/bin/sh
+
+set -eu
 
 PREFIX=$(basename "$(pwd -P)")
 {
diff --git a/scripts/generate_icns.sh b/scripts/generate_icns.sh
index 39d7ac77..98a5e68f 100755
--- a/scripts/generate_icns.sh
+++ b/scripts/generate_icns.sh
@@ -1,4 +1,6 @@
-#!/bin/bash
+#!/bin/sh
+
+set -eu
 
 #
 # Manually generate icon set for MacOS.
@@ -9,17 +11,17 @@ OUTPUT=nheko
 
 mkdir ${OUTPUT}.iconset
 
-sips -z 16 16     ${INPUT} --out ${OUTPUT}.iconset/icon_16x16.png
-sips -z 32 32     ${INPUT} --out ${OUTPUT}.iconset/icon_16x16@2x.png
-sips -z 32 32     ${INPUT} --out ${OUTPUT}.iconset/icon_32x32.png
-sips -z 64 64     ${INPUT} --out ${OUTPUT}.iconset/icon_32x32@2x.png
-sips -z 128 128   ${INPUT} --out ${OUTPUT}.iconset/icon_128x128.png
-sips -z 256 256   ${INPUT} --out ${OUTPUT}.iconset/icon_128x128@2x.png
-sips -z 256 256   ${INPUT} --out ${OUTPUT}.iconset/icon_256x256.png
-sips -z 512 512   ${INPUT} --out ${OUTPUT}.iconset/icon_256x256@2x.png
-sips -z 512 512   ${INPUT} --out ${OUTPUT}.iconset/icon_512x512.png
-
-cp ${INPUT} ${OUTPUT}.iconset/icon_512x512@2x.png
+sips -z 16 16     "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16.png
+sips -z 32 32     "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16@2x.png
+sips -z 32 32     "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32.png
+sips -z 64 64     "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32@2x.png
+sips -z 128 128   "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128.png
+sips -z 256 256   "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128@2x.png
+sips -z 256 256   "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256.png
+sips -z 512 512   "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256@2x.png
+sips -z 512 512   "${INPUT}" --out ${OUTPUT}.iconset/icon_512x512.png
+
+cp "${INPUT}" ${OUTPUT}.iconset/icon_512x512@2x.png
 
 iconutil -c icns ${OUTPUT}.iconset