File: Recipe.sh

package info (click to toggle)
mediaconch 25.04-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,828 kB
  • sloc: ansic: 126,293; cpp: 39,636; javascript: 34,300; xml: 2,950; sh: 2,121; makefile: 200; python: 183
file content (268 lines) | stat: -rw-r--r-- 6,417 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
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
#!/bin/bash

#  Copyright (c) MediaArea.net SARL. All Rights Reserved.
#
#  Use of this source code is governed by a BSD-style license that can
#  be found in the License.html file in the root of the source tree.
#

# This script build mediaconch mediaconch-server and mediaconch-gui AppImages
# This script is supposed to be run on a CentOS 6 container or chroot"

function Make_image() {
    local APP=$1 BIN=$2 DESKTOP=$3 ICON=$4 LOWERAPP=${1,,}

    mkdir -p $LOWERAPP/$LOWERAPP.AppDir
    pushd $LOWERAPP
    pushd $LOWERAPP.AppDir

    mkdir -p usr/bin

    cp $BIN usr/bin/
    cp $DESKTOP $ICON .

    if [ "$LOWERAPP" == "mediaconch-gui" ] ; then
        if [ "$ARCH" == "x86_64" ] ; then
            mkdir -p usr/lib64/qt5
            cp -r /usr/lib64/qt5/plugins usr/lib64/qt5
        else
            mkdir -p usr/lib/qt5
            cp -r /usr/lib/qt5/plugins usr/lib/qt5
        fi
        get_desktopintegration $LOWERAPP
    fi

    get_apprun
    # Multiple runs to ensure we catch indirect ones
    copy_deps; copy_deps; copy_deps; copy_deps
    move_lib
    delete_blacklisted
    if [ "$ARCH" == "x86_64" ] ; then
        cp -f /usr/lib64/libnss3.so usr/lib64
    else
        cp -f /usr/lib/libnss3.so usr/lib
    fi
    popd
    generate_appimage
    popd
}

# Detect host
if ! grep "CentOS release 6\..*" /etc/centos-release ; then
    echo "This script is supposed to be run on a CentOS 6 container or chroot"
    exit 1
fi

# Setup evironment
VERSION=25.04

if [ "$(arch)" == "i386" ] ; then
    ARCH="i686"
else
    ARCH="$(arch)"
fi

PREFIX=$PWD/prefix

# Get AppImage utils
curl -L -O https://github.com/probonopd/AppImages/raw/master/functions.sh

# Fix functions.sh
sed -i "s/-x86_64/-$ARCH/g" functions.sh

source ./functions.sh

# Add EPEL repository
curl -L -O https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -i --nodeps epel-release-*.rpm

# Install build and AppImage dependencies
yum install -y file wget tar fuse-libs fuse gcc-c++ pkgconfig libtool automake autoconf git zlib-devel libxml2-devel \
               libxslt-devel sqlite-devel libcurl-devel jansson-devel qt5-qtbase-devel qt5-qtwebkit-devel

# Compile libevent (too old on CentOS 6)
curl -L https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz | tar xz

pushd libevent-2.0.22-stable
if [ "$ARCH" == "x86_64" ] ; then
    ./configure --enable-shared --disable-static --prefix=/usr --libdir=/usr/lib64
else
    ./configure --enable-shared --disable-static --prefix=/usr
fi
    if test ! -e Makefile; then
        echo Problem while configuring libevent
        exit 1
    fi

    make -j$(nproc)

    if test ! -e libevent.la; then
        echo Problem while compiling libevent
        exit 1
    fi

    make install
popd

# Compile ZenLib
if test -e ZenLib/Project/GNU/Library; then
    pushd ZenLib/Project/GNU/Library
    autoreconf -i

    if [ "$ARCH" == "x86_64" ] ; then
        ./configure --enable-shared --disable-static --prefix=/usr --libdir=/usr/lib64
    else
        ./configure --enable-shared --disable-static --prefix=/usr
    fi

    if test ! -e Makefile; then
        echo Problem while configuring ZenLib
        exit 1
    fi

    make -j$(nproc)

    if test ! -e libzen.la; then
        echo Problem while compiling ZenLib
        exit 1
    fi

    make install
    popd
else
    echo ZenLib directory is not found
    exit 1
fi

# Compile MediaInfoLib
if test -e MediaInfoLib/Project/GNU/Library; then
    pushd MediaInfoLib/Project/GNU/Library
    autoreconf -i

    if [ "$ARCH" == "x86_64" ] ; then
        ./configure --enable-shared --disable-static --prefix=/usr --libdir=/usr/lib64 --with-libcurl
    else
        ./configure --enable-shared --disable-static --prefix=/usr --with-libcurl
    fi

    if test ! -e Makefile; then
        echo Problem while configuring MediaInfoLib
        exit 1
    fi

    make -j$(nproc)

    if test ! -e libmediainfo.la; then
        echo Problem while compiling MediaInfoLib
        exit 1
    fi

    make install
    popd
else
    echo MediaInfoLib directory is not found
    exit 1
fi


# Compile MediaConch
if test -e MediaConch; then
    # CLI
    pushd MediaConch/Project/GNU/CLI
    autoreconf -i
    ./configure --prefix=$PREFIX

    if test ! -e Makefile; then
        echo Problem while configuring MediaConch
        exit 1
    fi

    make -j$(nproc)

    if test ! -e mediaconch; then
        echo Problem while compiling MediaConch
        exit 1
    fi

    make install
    popd

   # Server
    pushd MediaConch/Project/GNU/Server
    autoreconf -i
    ./configure --prefix=$PREFIX

    if test ! -e Makefile; then
        echo Problem while configuring MediaConch Server
        exit 1
    fi

    make -j$(nproc)

    if test ! -e mediaconchd; then
        echo Problem while compiling MediaConch Server
        exit 1
    fi

    make install
    popd

    # GUI
    pushd MediaConch/Project/Qt
    ./prepare USE_WEBKIT=1

    if test ! -e Makefile; then
        echo Problem while configuring MediaConch GUI
        exit 1
    fi

    make -j$(nproc)

    if test ! -e mediaconch-gui; then
        echo Problem while compiling MediaConch GUI
        exit 1
    fi

    install -m 755 -d $PREFIX/bin
    install -m 755 mediaconch-gui $PREFIX/bin

    popd
else
    echo MediaConch directory is not found
    exit 1
fi

# Make appImages
cp ${PWD}/MediaConch/Source/Resource/Image/MediaConch.png mediaconch.png

cat > mediaconch.desktop <<EOF
[Desktop Entry]
Comment=Implementation checker, policy checker, reporter, and fixer (CLI)
Name=mediaconch
Exec=mediaconch
Icon=mediaconch
Terminal=true
Categories=Multimedia;
EOF

cat > mediaconch-server.desktop <<EOF
[Desktop Entry]
Comment=Implementation checker, policy checker, reporter, and fixer (Server)
Name=mediaconchd
Exec=mediaconchd
Icon=mediaconch
Terminal=true
Categories=Multimedia;
EOF

Make_image mediaconch $PREFIX/bin/mediaconch \
                      ${PWD}/mediaconch.desktop \
                      ${PWD}/mediaconch.png

Make_image mediaconch-server $PREFIX/bin/mediaconchd \
                             ${PWD}/mediaconch-server.desktop \
                             ${PWD}/mediaconch.png

Make_image mediaconch-gui $PREFIX/bin/mediaconch-gui \
                          ${PWD}/MediaConch/Project/GNU/GUI/mediaconch-gui.desktop \
                          ${PWD}/mediaconch.png