File: Recipe.sh

package info (click to toggle)
mediainfo 26.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,912 kB
  • sloc: cpp: 19,090; objc: 3,102; xml: 1,428; sh: 1,328; python: 263; makefile: 212
file content (201 lines) | stat: -rw-r--r-- 4,688 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
#!/usr/bin/env bash

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

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

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" == "mediainfo-gui" ]; then
        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 environment
VERSION=26.01

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 libcurl-devel cairo-devel wxGTK-devel

# 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 MediaInfo
if test -e MediaInfo; then
    # CLI
    pushd MediaInfo/Project/GNU/CLI
    autoreconf -i
    ./configure --prefix="$PREFIX"

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

    make -j "$(nproc)"

    if test ! -e mediainfo; then
        echo "Problem while compiling MediaInfo"
        exit 1
    fi

    make install
    popd

    # GUI
    pushd MediaInfo/Project/GNU/GUI
    autoreconf -i
    ./configure --prefix="$PREFIX"

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

    make -j "$(nproc)"

    if test ! -e mediainfo-gui; then
        echo "Problem while compiling MediaInfo GUI"
        exit 1
    fi

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

# Make appImages
cp "${PWD}/MediaInfo/Source/Resource/Image/MediaInfo.png" mediainfo.png

cat > mediainfo.desktop <<EOF
[Desktop Entry]
Comment=Command-line utility for reading information from audio/video files
Name=mediainfo
Exec=mediainfo
Icon=mediainfo
Terminal=true
Categories=Multimedia;
EOF

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

Make_image mediainfo-gui "$PREFIX/bin/mediainfo-gui" \
                          "${PWD}/MediaInfo/Project/GNU/GUI/mediainfo-gui.desktop" \
                          "${PWD}/mediainfo.png"