File: simple_make.sh

package info (click to toggle)
qtox 1.16.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 24,048 kB
  • sloc: cpp: 35,612; xml: 10,669; sh: 2,108; ansic: 1,520; objc: 208; perl: 28; makefile: 13
file content (169 lines) | stat: -rwxr-xr-x 3,702 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
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
#!/usr/bin/env bash

# additional flags for apt-get, used for CI
readonly APT_FLAGS=$1
readonly WITHOUT_SQLCIPHER=$2

set -eu -o pipefail

apt_install() {
    local apt_packages=(
        automake
        autotools-dev
        build-essential
        check
        checkinstall
        cmake
        git
        libavdevice-dev
        libexif-dev
        libgdk-pixbuf2.0-dev
        libgtk2.0-dev
        libopenal-dev
        libopus-dev
        libqrencode-dev
        libqt5opengl5-dev
        libqt5svg5-dev
        libsodium-dev
        libtool
        libvpx-dev
        libxss-dev
        qrencode
        qt5-default
        qttools5-dev
        qttools5-dev-tools
    )

    if [ "$WITHOUT_SQLCIPHER" != "True" ]; then
        apt_packages+=("libsqlcipher-dev")
    fi

    sudo apt-get install $APT_FLAGS "${apt_packages[@]}"
}

pacman_install() {
    local pacman_packages=(
        base-devel
        git
        libsodium
        libvpx
        libxss
        openal
        opus
        qrencode
        qt5
    )
    sudo pacman -S --needed "${pacman_packages[@]}"
}

dnf_install() {
    local dnf_group_packages=(
        'Development Tools'
        'C Development Tools and Libraries'
    )
    sudo dnf group install "${dnf_group_packages[@]}"

    # pure Fedora doesn't have what it takes to compile qTox (ffmpeg)
    local fedora_version=$(rpm -E %fedora)
    local dnf_rpmfusion_package=(
        http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$fedora_version.noarch.rpm
    )
    sudo dnf install "$dnf_rpmfusion_package"

    local dnf_packages=(
        ffmpeg-devel
        gdk-pixbuf2-devel
        git
        glib2-devel
        gtk2-devel
        libsodium-devel
        libtool
        libvpx-devel
        libXScrnSaver-devel
        openal-soft-devel
        openssl-devel
        opus-devel
        qrencode-devel
        qt5-qtsvg
        qt5-qtsvg-devel
        qt5-qttools-devel
        qt-creator
        qt-devel
        qt-doc
    )
    sudo dnf install "${dnf_packages[@]}"
}

# Fedora by default doesn't include libs in /usr/local/lib so add it
fedora_locallib() {
    local llib_file="/etc/ld.so.conf.d/locallib.conf"
    local llib_line="/usr/local/lib/"

    # check whether needed line already exists
    is_locallib() {
        grep -q "^$llib_line\$" "$llib_file"
    }

    # proceed only if line doesn't exist
    is_locallib \
        || echo "$llib_line" \
            | sudo tee -a "$llib_file"
}

zypper_install() {
    local zypper_packages=(
        +pattern:devel_basis
        cmake
        git
        libavcodec-devel
        libavdevice-devel
        libopus-devel
        libexif-devel
        libQt5Concurrent-devel
        libqt5-linguist
        libqt5-linguist-devel
        libQt5Network-devel
        libQt5OpenGL-devel
        libqt5-qtbase-common-devel
        libqt5-qtsvg-devel
        libQt5Test-devel
        libQt5Xml-devel
        libsodium-devel
        libvpx-devel
        libXScrnSaver-devel
        openal-soft-devel
        qrencode-devel
        sqlcipher-devel
    )

    # if not sudo is installed, e.g. in docker image, install it
    command -v sudo || zypper in sudo

    sudo zypper in "${zypper_packages[@]}"
}

main() {
    if command -v zypper && [ -f /etc/products.d/openSUSE.prod ]
    then
        zypper_install
    elif command -v apt-get
    then
        apt_install
    elif command -v pacman
    then
        pacman_install
    elif command -v dnf
    then
        dnf_install
        fedora_locallib
    else
        echo "Unknown package manager, attempting to compile anyways"
    fi

    ./bootstrap.sh
    mkdir -p _build
    cd _build
    cmake ../
    make -j$(nproc)
}
main