-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
101 lines (86 loc) · 3.19 KB
/
build.sh
File metadata and controls
101 lines (86 loc) · 3.19 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
97
98
99
100
101
#!/bin/bash
set -e # Exit on any error
APP_NAME="wallpy"
VERSION="1.0.1"
ARCH="amd64"
AUTHOR="Jayant Navrange"
EMAIL="vu.vcareforu@gmail.com"
URL="https://github.com/jayantur13/wallpy"
LICENSE_TYPE="MIT"
RELEASE_DIR="release"
# Clean previous builds
echo "🧹 Cleaning old build artifacts..."
rm -rf dist build *.deb *.rpm AppDir Wallpy.AppImage *.spec "$RELEASE_DIR"
# Set PYTHONPATH to include potential locations of 'gi'
export PYTHONPATH="/usr/lib/python3/dist-packages:/usr/lib/python3/site-packages:$PYTHONPATH"
# 1. Create PyInstaller executable
if ! command -v pyinstaller &> /dev/null; then
echo "❌ PyInstaller not found. Install it with: pip install pyinstaller"
exit 1
fi
echo "📦 Building executable with PyInstaller..."
pyinstaller --hidden-import=gi.repository.Gtk main.py --onefile --name $APP_NAME --log-level DEBUG
# 2. Prepare AppDir for AppImage
echo "📂 Preparing AppDir for AppImage..."
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
cp dist/$APP_NAME AppDir/usr/bin/$APP_NAME
cp wallpy.desktop AppDir/usr/share/applications/
cp assets/wallpy.png AppDir/usr/share/icons/hicolor/256x256/apps/
cp assets/wallpy.png AppDir/wallpy.png
cp wallpy.desktop AppDir/wallpy.desktop # ✅ REQUIRED FOR AppImage
# Make binary executable
chmod +x AppDir/usr/bin/$APP_NAME
# Required for AppImage: AppRun entry point
ln -sf usr/bin/$APP_NAME AppDir/AppRun
chmod +x AppDir/AppRun
# 3. Build AppImage
echo "🖼️ Creating AppImage..."
if ! command -v appimagetool &> /dev/null; then
echo "❌ appimagetool not found. Please install it first."
exit 1
fi
appimagetool AppDir Wallpy.AppImage
if ! command -v fpm &> /dev/null; then
echo "❌ fpm not found. Please install it with: gem install --no-document fpm"
exit 1
fi
# 4. Build .deb
echo "🧩 Creating .deb package..."
fpm -s dir -t deb \
-n $APP_NAME \
-v $VERSION \
--license "$LICENSE_TYPE" \
--maintainer "$AUTHOR <$EMAIL>" \
--vendor "$AUTHOR" \
--url "$URL" \
--architecture $ARCH \
--category "utility" \
--description "Wallpy is a GTK-based wallpaper changer that updates your desktop background at intervals." \
--after-install postinstall.sh \
dist/$APP_NAME=/usr/bin/$APP_NAME \
wallpy.desktop=/usr/share/applications/wallpy.desktop \
assets/wallpy.png=/usr/share/icons/hicolor/256x256/apps/wallpy.png
# 5. Build .rpm
echo "📦 Creating .rpm package..."
fpm -s dir -t rpm \
-n $APP_NAME \
-v $VERSION \
--license "$LICENSE_TYPE" \
--maintainer "$AUTHOR <$EMAIL>" \
--vendor "$AUTHOR" \
--url "$URL" \
--architecture $ARCH \
--category "utility" \
--description "Wallpy is a GTK-based wallpaper changer that updates your desktop background at intervals." \
--after-install postinstall.sh \
dist/$APP_NAME=/usr/bin/$APP_NAME \
wallpy.desktop=/usr/share/applications/wallpy.desktop \
assets/wallpy.png=/usr/share/icons/hicolor/256x256/apps/wallpy.png
# 6. Move output to release directory
echo "📁 Organizing release files..."
mkdir -p "$RELEASE_DIR"
mv *.deb *.rpm Wallpy.AppImage "$RELEASE_DIR/"
echo "✅ All packages built and moved to $RELEASE_DIR/:"
ls -lh "$RELEASE_DIR"