-
-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·96 lines (84 loc) · 3.24 KB
/
build.sh
File metadata and controls
executable file
·96 lines (84 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
set -e
APP_NAME="PyMacroRecord"
APP_ID="io.github.LOUDO56.PyMacroRecord"
ARCH=$(uname -m)
APPDIR="${APP_NAME}.AppDir"
APPIMAGETOOL_URL="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage"
APPIMAGETOOL="./appimagetool.AppImage"
VERSION=$(python3 -c "import re; print(re.search(r'\"([\d.]+)\"', open('src/utils/version.py').read()).group(1))")
UPDATE_INFO="gh-releases-zsync|LOUDO56|PyMacroRecord|latest|PyMacroRecord-*${ARCH}.AppImage.zsync"
echo ">>> Building version ${VERSION} with cx_Freeze..."
python setup_cx.py build
BUILD_DIR=$(find build -maxdepth 1 -name "exe.*" | head -1)
echo ">>> Preparing AppDir..."
rm -rf "${APPDIR}"
mkdir -p "${APPDIR}/usr/bin"
cp -r "${BUILD_DIR}/." "${APPDIR}/usr/bin/"
mkdir -p "${APPDIR}/usr/share/icons/hicolor/256x256/apps"
convert "src/assets/logo.ico" -thumbnail 256x256 \
"${APPDIR}/usr/share/icons/hicolor/256x256/apps/${APP_ID}.png" 2>/dev/null \
|| cp "src/assets/logo.ico" "${APPDIR}/usr/share/icons/hicolor/256x256/apps/${APP_ID}.png"
cp "${APPDIR}/usr/share/icons/hicolor/256x256/apps/${APP_ID}.png" "${APPDIR}/${APP_ID}.png"
DESKTOP_CONTENT="[Desktop Entry]
Name=${APP_NAME}
Exec=${APP_NAME}
Icon=${APP_ID}
Type=Application
Categories=Utility;
X-AppImage-Version=${VERSION}"
mkdir -p "${APPDIR}/usr/share/applications"
echo "${DESKTOP_CONTENT}" > "${APPDIR}/usr/share/applications/${APP_ID}.desktop"
echo "${DESKTOP_CONTENT}" > "${APPDIR}/${APP_ID}.desktop"
mkdir -p "${APPDIR}/usr/share/metainfo"
DATE=$(date +%Y-%m-%d)
cat > "${APPDIR}/usr/share/metainfo/${APP_ID}.appdata.xml" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>${APP_ID}</id>
<name>${APP_NAME}</name>
<summary>Free macro recorder for Linux and Windows</summary>
<metadata_license>MIT</metadata_license>
<project_license>GPL-3.0</project_license>
<developer id="io.github.LOUDO56">
<name>LOUDO56</name>
</developer>
<launchable type="desktop-id">${APP_ID}.desktop</launchable>
<description>
<p>PyMacroRecord is a free macro recorder. Record mouse and keyboard actions and replay them.</p>
</description>
<url type="homepage">https://github.com/LOUDO56/PyMacroRecord</url>
<releases>
<release version="${VERSION}" date="${DATE}"/>
</releases>
<content_rating type="oars-1.1"/>
<supports>
<control>pointing</control>
<control>keyboard</control>
</supports>
</component>
EOF
cat > "${APPDIR}/AppRun" <<'EOF'
#!/usr/bin/env bash
HERE="$(dirname "$(readlink -f "$0")")"
export LD_LIBRARY_PATH="${HERE}/usr/bin/lib:${HERE}/usr/bin:${LD_LIBRARY_PATH}"
unset WAYLAND_DISPLAY
export DISPLAY="${DISPLAY:-:0}"
export GDK_BACKEND=x11
exec "${HERE}/usr/bin/PyMacroRecord" "$@"
EOF
chmod +x "${APPDIR}/AppRun"
if [ ! -f "${APPIMAGETOOL}" ]; then
echo ">>> Downloading appimagetool..."
curl -Lo "${APPIMAGETOOL}" "${APPIMAGETOOL_URL}"
chmod +x "${APPIMAGETOOL}"
fi
echo ">>> Creating AppImage..."
ARCH="${ARCH}" "${APPIMAGETOOL}" --no-appstream -u "${UPDATE_INFO}" \
"${APPDIR}" "${APP_NAME}-${VERSION}-${ARCH}.AppImage"
if command -v zsyncmake &>/dev/null; then
echo ">>> Generating zsync..."
zsyncmake "${APP_NAME}-${VERSION}-${ARCH}.AppImage"
fi
echo ""
echo "Done: ${APP_NAME}-${VERSION}-${ARCH}.AppImage"