File: quickinstall

package info (click to toggle)
ckb-next 0.4.3%2Bdfsg.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 4,428 kB
  • sloc: cpp: 16,823; ansic: 10,448; sh: 205; xml: 121; python: 21; makefile: 9
file content (70 lines) | stat: -rwxr-xr-x 1,481 bytes parent folder | download
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
#!/usr/bin/env bash

# We want to see the logs in English
if [[ -z "$LC_ALL" && -z "$LANG" ]]; then
	echo "* Weird, neither LC_ALL nor LANG is set:"
	locale
	echo "* Trying LANG=en_US.UTF-8 anyway"
	export LANG="en_US.UTF-8"
else
	# don't let LC_ALL to be set because it always overrides all LC_*,
	# while LANG only sets LC_* once
	if [[ ! -z "$LC_ALL" ]]; then
		export LC_ALL=
	fi
fi

export LC_NUMERIC=C
export LC_TIME=C
export LC_MONETARY=C
export LC_MESSAGES=C
export LC_PAPER=C
export LC_NAME=C
export LC_ADDRESS=C
export LC_TELEPHONE=C
export LC_MEASUREMENT=C
export LC_IDENTIFICATION=C

function checkfail {
    if [[ $1 -ne 0 ]]; then
        echo "An error occurred,"
        echo "press enter to exit."
        read -rs dummy
        exit "$1"
    fi
}

function finish {
    echo "Done."
    echo "Thank you for installing ckb-next!"
    exit 0
}

# Check if we're in the right directory
if [[ ! -f "src/daemon/usb.c" ]]; then
    echo "Please run this script inside the ckb-next source directory."
    exit
fi

rm -rf build

cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DSAFE_INSTALL=ON -DSAFE_UNINSTALL=ON
checkfail $?

# Find out how many cores the system has, for make
if [[ -z "$JOBS" ]]; then
	JOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
fi

# Default to 2 jobs if something went wrong earlier
if [[ -z "$JOBS" ]]; then
    JOBS=2
fi

cmake --build build --target all -- -j "$JOBS"
checkfail $?

sudo cmake --build build --target install
checkfail $?

finish