2 # basic build script example
6 APT_PATH=`which apt-get` || true
7 apt_get=${APT_PATH:-"/usr/local/bin/apt-get"}
10 VIPER_DEPS_UBUNTU="zlib1g-dev git-core build-essential libxml2-dev libcurl4-openssl-dev \
11 qt57base qt57svg qt57charts-no-lgpl qt57multimedia libqtav-dev libicnet \
12 libavcodec-dev libavformat-dev libswscale-dev libavresample-dev libqml-module-qtav \
13 qt57quickcontrols qt57quickcontrols2 libxml2-dev"
15 BUILD_TOOLS="build-essential cmake"
18 # $1 = Distribution [Trusty / CentOS]
24 if [ "$DISTRIBUTION" == "trusty" ]; then
25 sudo ${apt_get} install -y --allow-unauthenticated software-properties-common
26 sudo add-apt-repository --yes ppa:george-edison55/cmake-3.x
27 elif [ "$DISTRIBUTION" == "CentOS" ]; then
28 sudo cat << EOF > cmake.repo
31 baseurl=http://mirror.ghettoforge.org/distributions/gf/el/7/plus/x86_64/
35 sudo cat << EOF > jsoncpp.repo
38 baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64/
42 sudo mv cmake.repo /etc/yum.repos.d/cmake.repo
43 sudo mv jsoncpp.repo /etc/yum.repos.d/jsoncpp.repo
48 # $1 = Distribution codename
51 DISTRIBUTION_CODENAME=$1
53 if [ "$DISTRIBUTION_CODENAME" != "trusty" ] && [ "$DISTRIBUTION_CODENAME" != "xenial" ]; then
54 echo "No valid distribution specified when calling 'update_qt_repo'. Exiting.."
58 sudo ${apt_get} install -y --allow-unauthenticated software-properties-common
59 sudo add-apt-repository --yes ppa:beineri/opt-qt571-$DISTRIBUTION_CODENAME
61 wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
62 sudo sh -c "echo 'deb http://archive.getdeb.net/ubuntu $DISTRIBUTION_CODENAME-getdeb apps' >> /etc/apt/sources.list.d/getdeb.list"
64 sudo ${apt_get} update
68 # $1 = Distribution id
69 # $2 = Distribution codename
75 NEXUS_PROXY=${NEXUSPROXY:-"http://nexus.fd.io"}
79 if [ "$DISTRIB_ID" == "Ubuntu" ]; then
81 if [ "$DISTRIB_CODENAME" == "xenial" ]; then
82 REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.ubuntu.xenial.main/"
83 REPO=${REPO_NAME:-"master.ubuntu.xenial.main"}
84 REPO_CICN_URL="${NEXUS_PROXY}/content/repositories/fd.io.${REPO}"
85 elif [ "$DISTRIB_CODENAME" == "trusty" ]; then
86 REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.ubuntu.trusty.main/"
87 REPO=${REPO_NAME:-"master.ubuntu.trusty.main"}
88 REPO_CICN_URL="${NEXUS_PROXY}/content/repositories/fd.io.${REPO}"
90 echo "Distribution $DISTRIB_CODENAME is not supported"
94 echo "deb ${REPO_VPP_URL} ./" | sudo tee /etc/apt/sources.list.d/99fd.io.list
95 echo "deb ${REPO_CICN_URL} ./" | sudo tee /etc/apt/sources.list.d/99fd.io.master.list
97 elif [ "$DISTRIB_ID" == "CentOS" ]; then
98 REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.centos7/"
99 REPO=${REPO_NAME:-"master.centos7"}
100 REPO_CICN_URL="${NEXUS_PROXY}/content/repositories/fd.io.${REPO}"
102 sudo cat << EOF > fdio.repo
104 name=fd.io master branch latest merge
105 baseurl=${REPO_VPP_URL}
110 name=fd.io master branch latest merge
111 baseurl=${REPO_CICN_URL}
115 sudo mv fdio.repo /etc/yum.repos.d/fdio.repo
117 echo "Distribution $DISTRIB_CODENAME is not supported"
128 if [ "$DISTRIB_ID" == "Ubuntu" ]; then
129 if [ "$DISTRIB_CODENAME" == "trusty" ]; then
130 update_cmake_repo $DISTRIB_CODENAME
133 update_fdio_repo $DISTRIB_ID $DISTRIB_CODENAME
135 sudo ${apt_get} update || true
137 elif [ "$DISTRIB_ID" == "CentOS" ]; then
138 update_cmake_repo $DISTRIB_ID
139 update_fdio_repo $DISTRIB_ID $DISTRIB_CODENAME
143 ARCHITECTURE=`uname -m`
145 # Figure out what system we are running on
146 if [ -f /etc/lsb-release ];then
152 if [ "$ARCHITECTURE" == "x86_64" ]; then
156 elif [ -f /etc/redhat-release ];then
158 sudo yum install -y redhat-lsb
159 DISTRIB_ID=`lsb_release -si`
160 DISTRIB_RELEASE=`lsb_release -sr`
161 DISTRIB_CODENAME=`lsb_release -sc`
162 DISTRIB_DESCRIPTION=`lsb_release -sd`
167 echo "ERROR: System configuration not recognized. Build failed"
171 echo ARCHITECTURE: $ARCHITECTURE
172 echo DISTRIB_ID: $DISTRIB_ID
173 echo DISTRIB_RELEASE: $DISTRIB_RELEASE
174 echo DISTRIB_CODENAME: $DISTRIB_CODENAME
175 echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
177 setup $DISTRIB_ID $DISTRIB_CODENAME
181 if [ $DISTRIB_ID == "Ubuntu" ]; then
182 update_qt_repo $DISTRIB_CODENAME
183 echo $BUILD_TOOLS $VIPER_DEPS_UBUNTU | xargs sudo ${apt_get} install -y --allow-unauthenticated
185 echo "This package is currently supported only for ubuntu. Exiting.."
191 sudo ln -sf /usr/include/x86_64-linux-gnu/qt5/QtAV /opt/qt57/include/QtAV
192 sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/av.prf /opt/qt57/mkspecs/features/av.prf
193 sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/avwidgets.prf /opt/qt57/mkspecs/features/avwidgets.prf
194 sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_avwidgets.pri /opt/qt57/mkspecs/modules/qt_lib_avwidgets.pri
195 sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_av.pri /opt/qt57/mkspecs/modules/qt_lib_av.pri
196 sudo ln -sf /usr/lib/x86_64-linux-gnu/libQtAV.prl /opt/qt57/lib/libQtAV.prl
197 sudo ln -sf /usr/lib/x86_64-linux-gnu/libQtAVWidgets.prl /opt/qt57/lib/libQtAVWidgets.prl
198 sudo ln -sf /usr/lib/x86_64-linux-gnu/libQtAVWidgets.so /opt/qt57/lib/libQt5AVWidgets.so
199 sudo ln -sf /usr/lib/x86_64-linux-gnu/libQt5AV.so /opt/qt57/lib/libQt5AV.so
200 sudo ln -sf /usr/lib/x86_64-linux-gnu/libQtAV.so /opt/qt57/lib/libQtAV.so
201 sudo ln -sf /usr/lib/x86_64-linux-gnu/libQt5AVWidgets.so /opt/qt57/lib/libQtAVWidgets.so
209 cmake -DCMAKE_INSTALL_PREFIX=/usr -DRPM_PACKAGE=$RPM -DDEB_PACKAGE=$DEB -DDISTRIBUTION=$DISTRIB_CODENAME -DARCHITECTURE=$ARCHITECTURE ..
218 find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
225 find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true