mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Merge pull request #58 from zapashcanon/sh
improve shell scripts and update .gitignore. Thanks @zapashcanon
This commit is contained in:
commit
e1457d5c7a
8 changed files with 93 additions and 73 deletions
|
@ -1,14 +1,15 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# Runs the Clang Formatter
|
# Runs the Clang Formatter
|
||||||
# Return codes:
|
# Return codes:
|
||||||
# - 1 there are files to be formatted
|
# - 1 there are files to be formatted
|
||||||
# - 0 everything looks fine
|
# - 0 everything looks fine
|
||||||
|
|
||||||
set -o errexit
|
set -eu
|
||||||
set -o pipefail
|
|
||||||
set -o nounset
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -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 update
|
||||||
brew install qt5 lmdb clang-format ninja libsodium cmark
|
brew install qt5 lmdb clang-format ninja libsodium cmark
|
||||||
brew upgrade boost cmake icu4c || true
|
brew upgrade boost cmake icu4c || true
|
||||||
|
@ -20,7 +20,7 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||||
|
|
||||||
if [ -z "$QT_VERSION" ]; then
|
if [ -z "$QT_VERSION" ]; then
|
||||||
QT_VERSION="592"
|
QT_VERSION="592"
|
||||||
|
@ -31,16 +31,15 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||||
sudo sh cmake-3.12.2-Linux-x86_64.sh --skip-license --prefix=/usr/local
|
sudo sh cmake-3.12.2-Linux-x86_64.sh --skip-license --prefix=/usr/local
|
||||||
|
|
||||||
mkdir -p build-libsodium
|
mkdir -p build-libsodium
|
||||||
pushd build-libsodium
|
( cd build-libsodium
|
||||||
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz -o libsodium-1.0.16.tar.gz
|
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
|
tar xfz libsodium-1.0.16.tar.gz
|
||||||
cd libsodium-1.0.16/
|
cd libsodium-1.0.16/
|
||||||
./configure && make && make check && sudo make install
|
./configure && make && make check && sudo make install )
|
||||||
popd
|
|
||||||
|
|
||||||
sudo add-apt-repository -y ppa:beineri/opt-qt${QT_VERSION}-trusty
|
sudo add-apt-repository -y ppa:beineri/opt-qt${QT_VERSION}-trusty
|
||||||
sudo apt-get update -qq
|
sudo apt update -qq
|
||||||
sudo apt-get install -qq -y \
|
sudo apt install -qq -y \
|
||||||
qt${QT_PKG}base \
|
qt${QT_PKG}base \
|
||||||
qt${QT_PKG}tools \
|
qt${QT_PKG}tools \
|
||||||
qt${QT_PKG}svg \
|
qt${QT_PKG}svg \
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
set -ex
|
set -eux
|
||||||
|
|
||||||
APP=nheko
|
APP=nheko
|
||||||
DIR=${APP}.AppDir
|
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.
|
# 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.
|
# Copy resources.
|
||||||
cp build/nheko ${DIR}/usr/bin
|
cp build/nheko ${DIR}/usr/bin
|
||||||
|
@ -30,15 +34,22 @@ unset QTDIR
|
||||||
unset QT_PLUGIN_PATH
|
unset QT_PLUGIN_PATH
|
||||||
unset LD_LIBRARY_PATH
|
unset LD_LIBRARY_PATH
|
||||||
|
|
||||||
export ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
export LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH
|
export ARCH
|
||||||
|
LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH
|
||||||
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs
|
for res in ./linuxdeployqt*.AppImage
|
||||||
./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -appimage
|
do
|
||||||
|
linuxdeployqt=$res
|
||||||
|
done
|
||||||
|
|
||||||
|
./"$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
|
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.
|
# commented out for now, as AppImage file appears to already contain the version.
|
||||||
#mv nheko-*x86_64.AppImage nheko-${VERSION}-x86_64.AppImage
|
#mv nheko-*x86_64.AppImage nheko-${VERSION}-x86_64.AppImage
|
||||||
echo "nheko-${VERSION}-x86_64.AppImage"
|
echo "nheko-${VERSION}-x86_64.AppImage"
|
||||||
|
|
|
@ -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
|
# Add Qt binaries to path
|
||||||
PATH=/usr/local/opt/qt/bin/:${PATH}
|
PATH=/usr/local/opt/qt/bin/:${PATH}
|
||||||
|
|
||||||
pushd build
|
( cd build
|
||||||
|
|
||||||
# macdeployqt does not copy symlinks over.
|
# macdeployqt does not copy symlinks over.
|
||||||
# this specifically addresses icu4c issues but nothing else.
|
# this specifically addresses icu4c issues but nothing else.
|
||||||
export ICU_LIB="$(brew --prefix icu4c)/lib"
|
ICU_LIB="$(brew --prefix icu4c)/lib"
|
||||||
|
export ICU_LIB
|
||||||
mkdir -p nheko.app/Contents/Frameworks
|
mkdir -p nheko.app/Contents/Frameworks
|
||||||
find ${ICU_LIB} -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true
|
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)
|
user=$(id -nu)
|
||||||
sudo chown ${user} nheko.dmg
|
sudo chown "${user}" nheko.dmg
|
||||||
mv nheko.dmg ..
|
mv nheko.dmg ..
|
||||||
popd
|
)
|
||||||
|
|
||||||
dmgbuild -s ./.ci/macos/settings.json "Nheko" nheko.dmg
|
dmgbuild -s ./.ci/macos/settings.json "Nheko" nheko.dmg
|
||||||
|
|
||||||
if [ ! -z $VERSION ]; then
|
if [ ! -z "$VERSION" ]; then
|
||||||
mv nheko.dmg nheko-${VERSION}.dmg
|
mv nheko.dmg "nheko-${VERSION}.dmg"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -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 CC=${C_COMPILER}
|
||||||
export CXX=${CXX_COMPILER}
|
export CXX=${CXX_COMPILER}
|
||||||
|
|
||||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/${C_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 --install /usr/bin/g++ g++ "/usr/bin/${CXX_COMPILER}" 10
|
||||||
|
|
||||||
sudo update-alternatives --set gcc "/usr/bin/${C_COMPILER}"
|
sudo update-alternatives --set gcc "/usr/bin/${C_COMPILER}"
|
||||||
sudo update-alternatives --set g++ "/usr/bin/${CXX_COMPILER}"
|
sudo update-alternatives --set g++ "/usr/bin/${CXX_COMPILER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||||
source /opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh || true;
|
# shellcheck disable=SC1090
|
||||||
|
. "/opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh" || true;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5
|
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build & install dependencies
|
# Build & install dependencies
|
||||||
cmake -GNinja -Hdeps -B.deps \
|
cmake -GNinja -Hdeps -B.deps \
|
||||||
-DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST} \
|
-DUSE_BUNDLED_BOOST="${USE_BUNDLED_BOOST}" \
|
||||||
-DUSE_BUNDLED_CMARK=${USE_BUNDLED_CMARK} \
|
-DUSE_BUNDLED_CMARK="${USE_BUNDLED_CMARK}" \
|
||||||
-DUSE_BUNDLED_JSON=${USE_BUNDLED_JSON}
|
-DUSE_BUNDLED_JSON="${USE_BUNDLED_JSON}"
|
||||||
cmake --build .deps
|
cmake --build .deps
|
||||||
|
|
||||||
# Build nheko
|
# Build nheko
|
||||||
|
@ -34,14 +35,14 @@ cmake -GNinja -H. -Bbuild \
|
||||||
-DCMAKE_INSTALL_PREFIX=.deps/usr
|
-DCMAKE_INSTALL_PREFIX=.deps/usr
|
||||||
cmake --build build
|
cmake --build build
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
make lint;
|
make lint;
|
||||||
|
|
||||||
if [ $DEPLOYMENT == 1 ] && [ ! -z $VERSION ] ; then
|
if [ "$DEPLOYMENT" = 1 ] && [ ! -z "$VERSION" ] ; then
|
||||||
make macos-deploy;
|
make macos-deploy;
|
||||||
fi
|
fi
|
||||||
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;
|
make linux-deploy;
|
||||||
fi
|
fi
|
||||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -101,3 +101,6 @@ package.dir
|
||||||
# Dependencies
|
# Dependencies
|
||||||
.third-party
|
.third-party
|
||||||
.deps
|
.deps
|
||||||
|
|
||||||
|
# Archives
|
||||||
|
*.bz2
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash -e
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
PREFIX=$(basename "$(pwd -P)")
|
PREFIX=$(basename "$(pwd -P)")
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
#
|
#
|
||||||
# Manually generate icon set for MacOS.
|
# Manually generate icon set for MacOS.
|
||||||
|
@ -9,17 +11,17 @@ OUTPUT=nheko
|
||||||
|
|
||||||
mkdir ${OUTPUT}.iconset
|
mkdir ${OUTPUT}.iconset
|
||||||
|
|
||||||
sips -z 16 16 ${INPUT} --out ${OUTPUT}.iconset/icon_16x16.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_16x16@2x.png
|
||||||
sips -z 32 32 ${INPUT} --out ${OUTPUT}.iconset/icon_32x32.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 64 64 "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32@2x.png
|
||||||
sips -z 128 128 ${INPUT} --out ${OUTPUT}.iconset/icon_128x128.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_128x128@2x.png
|
||||||
sips -z 256 256 ${INPUT} --out ${OUTPUT}.iconset/icon_256x256.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_256x256@2x.png
|
||||||
sips -z 512 512 ${INPUT} --out ${OUTPUT}.iconset/icon_512x512.png
|
sips -z 512 512 "${INPUT}" --out ${OUTPUT}.iconset/icon_512x512.png
|
||||||
|
|
||||||
cp ${INPUT} ${OUTPUT}.iconset/icon_512x512@2x.png
|
cp "${INPUT}" ${OUTPUT}.iconset/icon_512x512@2x.png
|
||||||
|
|
||||||
iconutil -c icns ${OUTPUT}.iconset
|
iconutil -c icns ${OUTPUT}.iconset
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue