forked from chkboom/mx-datetime
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·98 lines (80 loc) · 2.13 KB
/
build.sh
File metadata and controls
executable file
·98 lines (80 loc) · 2.13 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
#!/bin/bash
# Build script - see below for command information.
set -e
ARCH_BUILD=false
ARGS=()
for arg in "$@"; do
case "$arg" in
--arch)
ARCH_BUILD=true
;;
*)
ARGS+=("$arg")
;;
esac
done
set -- "${ARGS[@]}"
if [ "$ARCH_BUILD" = true ]; then
echo "Building Arch Linux package..."
if ! command -v makepkg &> /dev/null; then
echo "Error: makepkg not found. Please install base-devel package."
exit 1
fi
ARCH_VERSION=$(git describe --tags --abbrev=0 2>/dev/null)
if [ -z "$ARCH_VERSION" ]; then
echo "Error: no git tags found; cannot determine version for Arch build."
exit 1
fi
echo "Using version ${ARCH_VERSION} from latest git tag"
ARCH_BUILDDIR=$(mktemp -d -p "$PWD" archpkgbuild.XXXXXX)
trap 'rm -rf "$ARCH_BUILDDIR"' EXIT
rm -rf pkg *.pkg.tar.zst
PKG_DEST_DIR="$PWD/build"
mkdir -p "$PKG_DEST_DIR"
BUILDDIR="$ARCH_BUILDDIR" PKGDEST="$PKG_DEST_DIR" PKGVER="$ARCH_VERSION" makepkg -f
echo "Cleaning makepkg artifacts..."
rm -rf pkg
echo "Arch Linux package build completed!"
echo "Package: $(ls "$PKG_DEST_DIR"/*.pkg.tar.zst 2>/dev/null || echo 'not found')"
echo "Binary available at: build/mx-datetime"
exit 0
fi
case "${1:-all}" in
clean)
echo "Performing ultimate clean..."
rm -rf _build_
;;
configure)
echo "Configuring project..."
cmake --preset default
;;
make-clean)
echo "Cleaning build artifacts..."
cmake --build --preset default --target clean
;;
make)
echo "Building project..."
cmake --build --preset default
;;
all)
echo "Configuring and building project..."
cmake --workflow --preset default
;;
fresh)
echo "Fresh build (clean first, then configure and build)..."
cmake --workflow --preset default --fresh
;;
*)
echo "Usage: $0 [command]"
echo "Commands:"
echo " clean - Ultimate clean (rm -rf build)"
echo " configure - Configure only"
echo " make-clean - Clean build artifacts only"
echo " make - Build only"
echo " all - Configure and build (default)"
echo " fresh - Clean first then configure and build"
echo "Options:"
echo " --arch - Build Arch Linux package"
exit 1
;;
esac