Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap script #3

Merged
merged 8 commits into from
Nov 21, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 11 additions & 36 deletions tools/arch.sh
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ set -e
# A PosIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.

valid_formats=( "std" "node" "qpm" )
valid_formats=( "std" "node" "qpm" )
# Initialize our own variables:
format="std" # or qpm, node
show_arch=false
@@ -17,24 +17,8 @@ case "$OSTYPE" in
*) echo "unknown: $OSTYPE" ; exit 1;
esac


echo_std() {
if [[ "$show_arch" = true ]]; then
echo "$arch"
fi
if [[ "$show_os" = true ]]; then
echo "$os"
fi
}

echo_qpm() {
arch="386"
if [[ "$show_arch" = true ]]; then
echo "$arch"
fi
if [[ "$show_os" = true ]]; then
echo "$os"
fi
}

echo_node() {
@@ -43,13 +27,6 @@ echo_node() {
i686) arch="x86";;
*) echo "could not parse uname -m output: $arcg" ; exit 1;
esac

if [[ "$show_arch" = true ]]; then
echo "$arch"
fi
if [[ "$show_os" = true ]]; then
echo "$os"
fi
}
while getopts "aof:" opt; do
case "$opt" in
@@ -67,17 +44,15 @@ shift $((OPTIND-1))
[ "$1" = "--" ] && shift

case "$format" in
std)
echo_std
exit
;;
qpm)
echo_qpm
exit
;;
node)
echo_node
exit
;;
std);;
qpm) echo_qpm;;
node) echo_node;;
*) echo "illegal format vale: $format. (valid: ${valid_formats[@]}))" ; exit 1;
esac

if [[ "$show_arch" = true ]]; then
echo "$arch"
fi
if [[ "$show_os" = true ]]; then
echo "$os"
fi
21 changes: 21 additions & 0 deletions tools/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -2,8 +2,11 @@
set -e
PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.."

OS="$($PROJECT_PATH/tools/arch.sh -f node -o)"
echo "download node..."
NODE_CMD=$("$PROJECT_PATH/tools/downloadNode.sh")
NPM_CMD="$(dirname "$NODE_CMD")/npm"
echo "download qpm..."
QPM_CMD=$("$PROJECT_PATH/tools/downloadQpm.sh")

pushd . > /dev/null
@@ -12,10 +15,28 @@ pushd . > /dev/null

for i in $PROJECT_PATH/example/* ; do
cd "$i"
echo "npm install $i"
"$NPM_CMD" install
done

cd "$PROJECT_PATH/src/node_path"
"$NPM_CMD" install

if [ "$OS" = "linux" ]; then
if [ ! -d "$PROJECT_PATH/tmp/linuxdeployqt-src" ] ; then
git clone "https://github.com/probonopd/linuxdeployqt" "$PROJECT_PATH/tmp/linuxdeployqt-src"
fi
if [ ! -d "$PROJECT_PATH/tmp/linuxdeployqt-build" ] ; then
mkdir "$PROJECT_PATH/tmp/linuxdeployqt-build"
cd "$PROJECT_PATH/tmp/linuxdeployqt-build"
qmake "../linuxdeployqt-src"
make
fi

APPIMG_CMD="$PROJECT_PATH/tmp/appimagetool"
if [ ! -f "$APPIMG_CMD" ] ; then
curl -L -o "$APPIMG_CMD" "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x "$APPIMG_CMD"
fi
fi
popd > /dev/null
35 changes: 15 additions & 20 deletions tools/deploy_linux.sh
Original file line number Diff line number Diff line change
@@ -2,28 +2,23 @@

PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../"
TARGET_APP=$1
NODE_CMD=$2
TARGET_PATH=$(dirname "$TARGET_APP")
QT_PATH="/home/dodo/Qt5.7.0aa/5.7/gcc_64"
DEPLOY_CMD="$PROJECT_PATH/tmp/linuxdeployqt-build/linuxdeployqt/linuxdeployqt"
TMP_PATH="$PROJECT_PATH/tmp"

linuxdeployqt $TARGET_APP --compiler-runtime --qmldir=$PROJECT_PATH/src/qml -bundle-non-qt-libs
cat << EOF > "$TARGET_PATH/quark.desktop"
[Desktop Entry]
Type=Application
Name=Quark
Exec=AppRun %F
Icon=default
Comment=Edit this default file
Terminal=true
EOF

: <<'END'
mkdir -p "$TARGET_PATH/platforms"
cp "$QT_PATH/plugins/platforms/libqxcb.so" "$TARGET_PATH/platforms/libqxcb.so"
cp "$PROJECT_PATH/quark.svg" "$TARGET_PATH/default.svg"

PATH="$TMP_PATH:$PATH" "$DEPLOY_CMD" $TARGET_APP -qmldir=$PROJECT_PATH/src/qml -bundle-non-qt-libs -no-strip

libs=( "libQt5DBus.so.5" )
#libs=( "libQt5DBus.so.5" "libQt5XcbQpa.so.5" "libicudata.so.56" "libicuuc.so.56" "libicui18n.so.56" "libQt5Core.so.5" "libQt5Gui.so.5" "libQt5Qml.so.5" "libQt5Network.so.5" "libQt5Widgets.so.5" )
for lib in ${libs[*]}
do
cp "$QT_PATH/lib/$lib" "$TARGET_PATH/$lib"
done


qmlPlugins=( "QtQuick" "QtQuick.2" "QtQml" )
for qml in ${qmlPlugins[*]}
do
cp -r "$QT_PATH/qml/$qml" "$TARGET_PATH/$qml"
done
END
# we need to run this two times...
PATH="$TMP_PATH:$PATH" "$DEPLOY_CMD" $TARGET_APP -appimage -qmldir=$PROJECT_PATH/src/qml -bundle-non-qt-libs -no-strip
2 changes: 1 addition & 1 deletion tools/downloadNode.sh
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ BASE_PATH="$PROJECT_PATH/tmp/node-$NODE_VERSION-$OS-$ARCH"
pushd . > /dev/null
mkdir -p "$BASE_PATH"

if [ "$OS" == "$win" ]; then
if [ "$OS" == "win" ]; then
URL="$BASE_URL/win-$ARCH/node.exe"
NODE_CMD="$BASE_PATH/node.exe"