-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·815 lines (662 loc) · 26.9 KB
/
install.sh
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
#!/bin/bash
# Outputs to logfile and the screen ./install.sh --rebuild 2>&1 | tee -a install.log
rebuild=false
rebuild_only=("Dependencies")
# Exit script on any error
set -e
check_and_clone_repo() {
local dir_name=$1
local git_url=$2
if [ ! -d "$dir_name" ]; then
echo "Directory $dir_name not found. Cloning repository..."
git clone "$git_url"
else
echo "Directory $dir_name already exists. Skipping clone."
fi
}
# Function to install dependencies on Arch
Dependencies() {
distro_id=$(lsb_release -si)
echo
echo "#######################################"
echo "# Installing required dependencies... #"
echo "#######################################"
echo
if [ "$distro_id" = "EndeavourOS" ] || [ "$distro_id" = "Arch" ]; then
echo "######################################"
echo "# Building for EndeavorOS or Arch... #"
echo "######################################"
echo
paru -S --needed --noconfirm --sudoloop gdb ninja gcc glaze cmake meson qt6 libzip polkit-qt6 libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite pugixml xorg-xinput libxrender pixman wayland-protocols cairo pango seatd libxkbcommon xcb-util-wm xorg-xwayland libinput libliftoff libdisplay-info cpio tomlplusplus xcb-util-errors
fi
if [ "$distro_id" = "openSUSE" ]; then
echo "#######################################"
echo "# Building for openSUSE Tumbleweed... #"
echo "#######################################"
echo
sudo zypper dup --non-interactive --no-recommends
sudo zypper install --non-interactive --no-recommends gcc-c++ ninja file-devel git meson cmake pugixml-devel librsvg-devel libzip-devel xcb-util-devel "pkgconfig(cairo)" "pkgconfig(egl)" "pkgconfig(gbm)" "pkgconfig(gl)" "pkgconfig(glesv2)" "pkgconfig(libdrm)" "pkgconfig(libinput)" "pkgconfig(libseat)" "pkgconfig(libudev)" "pkgconfig(pango)" "pkgconfig(pangocairo)" "pkgconfig(pixman-1)" "pkgconfig(vulkan)" "pkgconfig(wayland-client)" "pkgconfig(wayland-protocols)" "pkgconfig(wayland-scanner)" "pkgconfig(wayland-server)" "pkgconfig(xcb)" "pkgconfig(xcb-icccm)" "pkgconfig(xcb-renderutil)" "pkgconfig(xkbcommon)" "pkgconfig(xwayland)" "pkgconfig(xcb-errors)" glslang-devel Mesa-libGLESv3-devel tomlplusplus-devel
fi
if [ "$distro_id" = "Ubuntu" ]; then
echo "###########################"
echo "# Building for Ubuntu... #"
echo "###########################"
echo
sudo apt-get install -y meson wget build-essential ninja-build cmake-extras cmake gettext gettext-base fontconfig libfontconfig-dev libffi-dev libxml2-dev libdrm-dev libxkbcommon-x11-dev libxkbregistry-dev libxkbcommon-dev libpixman-1-dev libudev-dev libseat-dev seatd libxcb-dri3-dev libegl-dev libgles2 libegl1-mesa-dev glslang-tools libinput-bin libinput-dev libxcb-composite0-dev libavutil-dev libavcodec-dev libavformat-dev libxcb-ewmh2 libxcb-ewmh-dev libxcb-present-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-res0-dev libxcb-xinput-dev libtomlplusplus3
fi
}
hyprutils() {
check_and_clone_repo "hyprutils" "https://github.com/hyprwm/hyprutils.git"
echo
echo "#######################################"
echo "# Processing repository: hyprutils... #"
echo "#######################################"
echo
cd "hyprutils"
# Pull the latest changes
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Reconfigure if a build directory exists
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring..."
rm -rf build
fi
# Configure, build, and install
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install build
cd ..
}
hyprland-protocols() {
check_and_clone_repo "hyprland-protocols" "https://github.com/hyprwm/hyprland-protocols.git"
echo
echo "################################################"
echo "# Processing repository: hyprland-protocols... #"
echo "################################################"
echo
cd "hyprland-protocols"
# Pull the latest changes
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Reconfigure if a build directory exists
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring..."
rm -rf build
fi
# Configure, build, and install
meson subprojects update --reset
meson setup build
ninja -C build
sudo ninja -C build install
cd ..
}
hyprland-qtutils() {
check_and_clone_repo "hyprland-qtutils" "https://github.com/hyprwm/hyprland-qtutils.git"
echo
echo "##############################################"
echo "# Processing repository: hyprland-qtutils... #"
echo "##############################################"
echo
cd "hyprland-qtutils"
# Pull the latest changes
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Reconfigure if a build directory exists
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring..."
rm -rf build
fi
# Configure, build, and install
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install build
cd ..
}
hyprland-qt-support() {
check_and_clone_repo "hyprland-qt-support" "https://github.com/hyprwm/hyprland-qt-support.git"
echo
echo "#################################################"
echo "# Processing repository: hyprland-qt-support... #"
echo "#################################################"
echo
cd "hyprland-qt-support"
# Pull the latest changes
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Reconfigure if a build directory exists
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring..."
rm -rf build
fi
# Configure, build, and install
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINSTALL_QML_PREFIX=/lib/qt6/qml -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
sudo cmake --install build
cd ..
}
hyprwayland-scanner() {
echo
echo "#################################################"
echo "# Processing repository: hyprwayland-scanner... #"
echo "#################################################"
echo
check_and_clone_repo "hyprwayland-scanner" "https://github.com/hyprwm/hyprwayland-scanner.git"
cd "hyprwayland-scanner"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
if [ -d "build" ]; then
echo "Guess, what? there's an existing build directory, reconfiguring"
rm -rf build
fi
cmake -DCMAKE_INSTALL_PREFIX=/usr -B build
cmake --build build -j "$(nproc)"
sudo cmake --install build
cd ..
}
# Function to pull, build, and install aquamarine
aquamarine() {
echo
echo "########################################"
echo "# Processing repository: aquamarine... #"
echo "########################################"
echo
check_and_clone_repo "aquamarine" "https://github.com/hyprwm/aquamarine.git"
cd "aquamarine"
# Pull the latest changes
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Reconfigure if a build directory exists
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring..."
rm -rf build
fi
# Configure, build, and install
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install ./build
cd ..
}
# Function to pull, build, and install hyprlang
hyprlang() {
echo
echo "######################################"
echo "# Processing repository: hyprlang... #"
echo "######################################"
echo
check_and_clone_repo "hyprlang" "https://github.com/hyprwm/hyprlang.git"
cd "hyprlang"
# Pull the latest changes
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Reconfigure if a build directory exists
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring..."
rm -rf build
fi
# Configure, build, and install
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install ./build
cd ..
}
# Function to pull, build, and install hyprcursor
hyprcursor() {
echo
echo "########################################"
echo "# Processing repository: hyprcursor... #"
echo "########################################"
echo
check_and_clone_repo "hyprcursor" "https://github.com/hyprwm/hyprcursor.git"
cd "hyprcursor"
# Pull the latest changes
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Reconfigure if a build directory exists
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring..."
rm -rf build
fi
# Configure, build, and install
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install ./build
cd ..
}
Hyprshot() {
echo
echo "######################################"
echo "# Processing repository: hyprshot... #"
echo "######################################"
echo
check_and_clone_repo "Hyprshot" "https://github.com/Gustash/Hyprshot.git"
cd "Hyprshot"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
cd ..
# Check if the symbolic link already exists
echo "Copying Hyprshot to ~/.local/bin"
cp -i "$(pwd)/Hyprshot/hyprshot" "$HOME/.local/bin/hyprshot"
echo "Changing permissions to executable"
chmod +x "$HOME/.local/bin/hyprshot"
echo "Succesfully installed Hyprshot"
echo
}
hyprgraphics() {
echo
echo "##########################################"
echo "# Processing repository: hyprgraphics... #"
echo "##########################################"
echo
check_and_clone_repo "hyprgraphics" "https://github.com/hyprwm/hyprgraphics.git"
cd "hyprgraphics"
# Pull changes from the repository
output=$(git pull)
# Check if rebuild is necessary
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Check if build directory exists, then clean it up
if [ -d "build" ]; then
echo "Found existing build directory, cleaning up..."
rm -rf build
echo "Build directory removed. Reconfiguring..."
fi
# Configure and build the project using CMake
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
echo "You're at the make command"
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
# Install the built project
sudo cmake --install ./build
# Return to the previous directory
cd ..
}
Hyprland() {
echo
echo "######################################"
echo "# Processing repository: hyprland... #"
echo "######################################"
echo
check_and_clone_repo "Hyprland" "https://github.com/hyprwm/Hyprland.git"
cd "Hyprland"
output=$(git pull)
echo $output
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
git submodule update --init
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring...."
rm -rf build
fi
#configure, build, and install
make all && sudo make install
cd ..
}
hypridle() {
echo
echo "######################################"
echo "# Processing repository: hypridle... #"
echo "######################################"
echo
check_and_clone_repo "hypridle" "https://github.com/hyprwm/hypridle.git"
cd "hypridle"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring...."
rm -rf build
fi
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install build
cd ..
}
hyprlock() {
echo
echo "#####################################"
echo "# Processing repository: hyprlock... "
echo "#####################################"
echo
check_and_clone_repo "hyprlock" "https://github.com/hyprwm/hyprlock.git"
cd "hyprlock"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring...."
rm -rf build
fi
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install build
cd ..
}
hyprpicker() {
echo
echo "########################################"
echo "# Processing repository: hyprpicker... #"
echo "########################################"
echo
check_and_clone_repo "hyprpicker" "https://github.com/hyprwm/hyprpicker.git"
cd "hyprpicker"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring...."
rm -rf build
fi
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install ./build
cd ..
}
hyprpolkitagent() {
echo
echo "#############################################"
echo "# Processing repository: hyprpolkitagent... #"
echo "#############################################"
echo
check_and_clone_repo "hyprpolkitagent" "https://github.com/hyprwm/hyprpolkitagent.git"
cd "hyprpolkitagent"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring...."
rm -rf build
fi
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
sudo cmake --install ./build
cd ..
}
hyprpaper() {
echo
echo "#######################################"
echo "# Processing repository: hyprpaper... #"
echo "#######################################"
echo
check_and_clone_repo "hyprpaper" "https://github.com/hyprwm/hyprpaper.git"
cd "hyprpaper"
# Pull changes from the repository
output=$(git pull)
# Check if rebuild is necessary
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Check if build directory exists, then clean it up
if [ -d "build" ]; then
echo "Found existing build directory, cleaning up..."
rm -rf build
echo "Build directory removed. Reconfiguring..."
fi
# Configure and build the project using CMake
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
# Install the built project
sudo cmake --install ./build
# Return to the previous directory
cd ..
}
hyprsunset() {
echo
echo "#######################################"
echo "# Processing repository: hyprsunset... #"
echo "#######################################"
echo
check_and_clone_repo "hyprsunset" "https://github.com/hyprwm/hyprsunset.git"
cd "hyprsunset"
# Pull changes from the repository
output=$(git pull)
# Check if rebuild is necessary
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Check if build directory exists, then clean it up
if [ -d "build" ]; then
echo "Found existing build directory, cleaning up..."
rm -rf build
echo "Build directory removed. Reconfiguring..."
fi
# Configure and build the project using CMake
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
# Install the built project
sudo cmake --install ./build
# Return to the previous directory
cd ..
}
xdg-desktop-portal-hyprland() {
echo
echo "######################################"
echo "# Processing repository: XDG BLAH... #"
echo "######################################"
echo
check_and_clone_repo "xdg-desktop-portal-hyprland" "https://github.com/hyprwm/xdg-desktop-portal-hyprland.git"
cd "xdg-desktop-portal-hyprland"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring...."
rm -rf build
echo "Build directory removed. Reconfiguring..."
fi
cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DCMAKE_INSTALL_PREFIX=/usr -B build
cmake --build build
sudo cmake --install build
cd ..
}
hyprsysteminfo() {
echo
echo "############################################"
echo "# Processing repository: HyprSystemInfo... #"
echo "############################################"
echo
check_and_clone_repo "hyprsysteminfo" "https://github.com/hyprwm/hyprsysteminfo.git"
cd "hyprsysteminfo"
output=$(git pull)
# Check if rebuild is necessary
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
# Check if build directory exists, then clean it up
if [ -d "build" ]; then
echo "Found existing build directory, cleaning up..."
rm -rf build
echo "Build directory removed. Reconfiguring..."
fi
# Configure and build the project using CMake
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target hyprsysteminfo -j"$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
# Install the built project
sudo cmake --install ./build
# Return to the previous directory
cd ..
}
sdbus-cpp() {
echo
echo "###########################################"
echo "# Processing repository: sdbus-cpp 2.0... #"
echo "###########################################"
echo
check_and_clone_repo "sdbus-cpp" "https://github.com/Kistler-Group/sdbus-cpp.git"
cd "sdbus-cpp"
output=$(git pull)
if [ "$rebuild" = false ]; then
if [[ "$output" == *"Already up to date."* && -d "build" ]]; then
echo "Repository is already up to date. Skipping build and install."
cd ..
return # Exit the function early
fi
fi
if [ -d "build" ]; then
echo "Found existing build directory, reconfiguring...."
rm -rf build
fi
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release ${OTHER_CONFIG_FLAGS}
cmake --build .
sudo cmake --build . --target install
cd ../../
# Check the user's current shell and append to the appropriate RC file if not already present
if [[ "$SHELL" == */bash ]]; then
grep -qxF 'export CMAKE_PREFIX_PATH="/usr/local:$CMAKE_PREFIX_PATH"' ~/.bashrc || echo 'export CMAKE_PREFIX_PATH="/usr/local:$CMAKE_PREFIX_PATH"' >>~/.bashrc
grep -qxF 'export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"' ~/.bashrc || echo 'export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"' >>~/.bashrc
elif [[ "$SHELL" == */zsh ]]; then
grep -qxF 'export CMAKE_PREFIX_PATH="/usr/local:$CMAKE_PREFIX_PATH"' ~/.zshrc || echo 'export CMAKE_PREFIX_PATH="/usr/local:$CMAKE_PREFIX_PATH"' >>~/.zshrc
grep -qxF 'export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"' ~/.zshrc || echo 'export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"' >>~/.zshrc
elif [[ "$SHELL" == */fish ]]; then
grep -qxF 'set -x CMAKE_PREFIX_PATH "/usr/local:$CMAKE_PREFIX_PATH"' ~/.config/fish/config.fish || echo 'set -x CMAKE_PREFIX_PATH "/usr/local:$CMAKE_PREFIX_PATH"' >>~/.config/fish/config.fish
grep -qxF 'set -x LD_LIBRARY_PATH "/usr/local/lib:$LD_LIBRARY_PATH"' ~/.config/fish/config.fish || echo 'set -x LD_LIBRARY_PATH "/usr/local/lib:$LD_LIBRARY_PATH"' >>~/.config/fish/config.fish
else
echo "Unsupported shell: $SHELL"
fi
# Export variables in the current session
export CMAKE_PREFIX_PATH="/usr/local:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
}
# Array of function names corresponding to each repository
repos=("Dependencies" "sdbus-cpp" "hyprwayland-scanner" "hyprland-protocols" "hyprutils" "hyprland-qtutils" "hyprland-qt-support" "aquamarine" "hyprgraphics" "hyprlang" "hyprcursor" "Hyprland" "hyprlock" "hyprpicker" "hyprpaper" "hypridle" "hyprsunset" "xdg-desktop-portal-hyprland" "hyprsysteminfo" "hyprpolkitagent" "Hyprshot")
# Command-line argument parsing
while [[ "$#" -gt 0 ]]; do
case "$1" in
--rebuild)
rebuild=true
shift
;;
--rebuild-only)
rebuild=true
shift
while [[ "$#" -gt 0 && ! "$1" =~ ^-- ]]; do
rebuild_only+=("$1") # Add repository names to the array
shift
done
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Execute repositories based on user input
if [[ ${#rebuild_only[@]} -gt 1 ]]; then
# Rebuild packages with --rebuild-only separated by spaces
for repo_function in "${rebuild_only[@]}"; do
if declare -F "$repo_function" >/dev/null; then
"$repo_function"
else
echo "Repository function '$repo_function' not found!"
exit 1
fi
done
else # Build all packages
for repo_function in "${repos[@]}"; do
"$repo_function"
done
fi
echo "########################################################################"
echo "# All repositories have been pulled, built, and installed successfully #"
echo "########################################################################"