Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

First version of AppImage build script for reference

parent 72cea356
This diff is collapsed.
#!/bin/bash
# Halt on errors
set -e
# Be verbose
set -x
# Now we are inside CentOS 6
grep -r "CentOS release 6" /etc/redhat-release || exit 1
. /opt/rh/devtoolset-3/enable
#necessary ?
#pulseaudio-libs
QTVERSION=5.9.1
QVERSION_SHORT=5.9
QTDIR=/usr/local/Qt-${QTVERSION}/
# qjsonparser, used to add metadata to the plugins needs to work in a en_US.UTF-8 environment. That's
# not always set correctly in CentOS 6.7
export LC_ALL=en_US.UTF-8
export LANG=en_us.UTF-8
# Determine which architecture should be built
if [[ "$(arch)" = "i686" || "$(arch)" = "x86_64" ]] ; then
ARCH=$(arch)
else
echo "Architecture could not be determined"
exit 1
fi
# Make sure we build from the /, parts of this script depends on that. We also need to run as root...
cd /
# TO-DO ask about this.
export CMAKE_PREFIX_PATH=$QTDIR:/app/share/llvm/
# if the library path doesn't point to our usr/lib, linking will be broken and we won't find all deps either
export LD_LIBRARY_PATH=/usr/lib64/:/usr/lib:/app/usr/lib:$QTDIR/lib/:/opt/python3.5/lib/:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=/usr/lib64/:/usr/lib:/app/usr/lib:$QTDIR/lib/:$LD_LIBRARY_PATH
# Prepare the install location
#rm -rf /app/ || true
mkdir -p /app/usr
# export LLVM_ROOT=/opt/llvm/
# start building the deps
function build_external
{ (
# errors fatal
echo "Compiler version:" $(g++ --version)
set -e
SRC=/external
BUILD=/external/build
PREFIX=/app/usr/
# framework
EXTERNAL=$1
# clone if not there
mkdir -p $SRC
cd $SRC
if ( test -d $EXTERNAL )
then
echo "$EXTERNAL already cloned"
if [ $# -eq 0 ]; then
cd $EXTERNAL
git reset --hard
git pull --rebase
cd ..
fi
else
git clone $EXTERNAL_ADDRESS
fi
# create build dir
mkdir -p $BUILD/$EXTERNAL
# go there
cd $BUILD/$EXTERNAL
# cmake it
if ( $EXTERNAL_CMAKE )
then
cmake3 -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX $2 $SRC/$EXTERNAL
else
$EXTERNAL_CONFIGURE
fi
make -j8
# install
make install
) }
export WLD=/app/usr/ # change this to another location if you prefer
export LD_LIBRARY_PATH=$WLD/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/:/usr/lib/pkgconfig/:$PKG_CONFIG_PATH
export PATH=$WLD/bin:$PATH
export ACLOCAL_PATH=$WLD/share/aclocal
export ACLOCAL="aclocal -I $ACLOCAL_PATH"
#libx264
cd /external
if ( test -d /external/x264 )
then
echo "libx264 already cloned"
if [ $# -eq 0 ]; then
cd x264
git reset --hard
git pull --rebase
cd ..
fi
# make distclean
else
#git clone git://git.videolan.org/x264.git
git clone https://anonscm.debian.org/git/pkg-multimedia/x264.git
fi
cd x264
./configure --enable-static --enable-shared --prefix=$WLD
make -j5
make install
#libx265
cd /external
if ( test -d /external/x265 )
then
echo "libx265 already downloaded"
cd x265
if [ $# -eq 0 ]; then
git reset --hard
git pull --rebase
fi
cd build/linux
# make distclean
else
git clone https://anonscm.debian.org/git/pkg-multimedia/x265.git
cd x265/build/linux
fi
cmake3 -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$WLD" -DENABLE_PIC=ON -DENABLE_SHARED=OFF ../../source
make -j5
make install
#libvpx
cd /external
if ( test -d /external/libvpx )
then
echo "libvpx already cloned"
if [ $# -eq 0 ]; then
cd libvpx
git reset --hard
git pull --rebase
cd ..
fi
# make distclean
else
git clone https://anonscm.debian.org/git/pkg-multimedia/libvpx.git
fi
cd libvpx
./configure --enable-static --enable-shared --prefix=$WLD
make -j5
make install
#ffmpeg
cd /external
if ( test -d /external/ffmpeg )
then
echo "ffmpeg already cloned"
if [ $# -eq 0 ]; then
cd ffmpeg
git reset --hard
git pull --rebase
cd ..
fi
else
# git clone https://git.ffmpeg.org/ffmpeg.git
# Use debian source
git clone https://anonscm.debian.org/git/pkg-multimedia/ffmpeg.git
fi
cd ffmpeg
./configure --prefix=$WLD --extra-ldflags="-L$WLD/lib -lstdc++ -lm -lrt -ldl" --extra-cflags="-I$WLD/include" --enable-shared --enable-avfilter --enable-gpl --enable-avresample --enable-libx265 --enable-libvpx --enable-libx264 --disable-doc
make -j5
make install
#opencv_contrib
# download manually (hash mismatch)
# https://github.com/opencv/opencv_3rdparty/tree/ippicv/master_20151201/ippicv
if ( test -d /external/cairo-1.14.10 )
then
echo "cairo already downloaded"
cd /external/cairo-1.14.10
else
cd /external
wget https://www.cairographics.org/releases/cairo-1.14.10.tar.xz
tar -xf cairo-1.14.10.tar.xz
cd /external/cairo-1.14.10
./autogen.sh
fi
./configure --prefix=$WLD
make -j5
make install
/bin/cp /app/usr/lib/pkgconfig/cairo* /usr/lib/pkgconfig/
if ( test -d /external/harfbuzz-0.9.10 )
then
echo "pango already downloaded"
cd /external/harfbuzz-0.9.10
else
cd /external
wget https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.10.tar.bz2
tar -xf harfbuzz-0.9.10.tar.bz2
cd /external/harfbuzz-0.9.10
fi
./configure --prefix=$WLD
make -j5
make install
/bin/cp /app/usr/lib/pkgconfig/harf* /usr/lib/pkgconfig/
/bin/cp /app/usr/lib/libharfbuzz.* /usr/lib
if ( test -d /external/pango-1.28.4 )
then
echo "pango already downloaded"
cd /external/pango-1.28.4
else
cd /external
wget http://ftp.gnome.org/pub/GNOME/sources/pango/1.28/pango-1.28.4.tar.gz
tar -xf pango-1.28.4.tar.gz
cd /external/pango-1.28.4
fi
./configure --prefix=$WLD
make -j5
make install
/bin/cp /app/usr/lib/pkgconfig/pango* /usr/lib/pkgconfig/
if ( test -d /external/gdk-pixbuf-2.23.5 )
then
echo "gdk-pixbuf already downloaded"
cd /external/gdk-pixbuf-2.23.5
else
cd /external
wget http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.23/gdk-pixbuf-2.23.5.tar.xz
tar -xf gdk-pixbuf-2.23.5.tar.xz
cd /external/gdk-pixbuf-2.23.5
fi
./configure --prefix=$WLD
make -j5
make install
/bin/cp /app/usr/lib/pkgconfig/gdk* /usr/lib/pkgconfig/
if ( test -d /external/gtk+-2.23.90 )
then
echo "gtk2 already downloaded"
cd /external/gtk+-2.23.90
else
cd /external
wget http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.23/gtk+-2.23.90.tar.gz
tar -xf gtk+-2.23.90.tar.gz
cd /external/gtk+-2.23.90
fi
./configure --prefix=$WLD
make -j5
make install
/bin/cp /app/usr/lib/pkgconfig/gtk* /usr/lib/pkgconfig/
/bin/cp /app/usr/lib/pkgconfig/gdk* /usr/lib/pkgconfig/
cd /external
if ( test -d /external/opencv_contrib )
then
echo "opencv_contrib already cloned"
if [ $# -eq 0 ]; then
cd opencv_contrib
git reset --hard
# git pull --rebase
git checkout 3.3.0
cd ..
fi
else
git clone https://github.com/opencv/opencv_contrib.git
fi
cd /external
if ( test -d /external/opencv )
then
echo "opencv already cloned"
if [ $# -eq 0 ]; then
cd opencv
git reset --hard
# git pull --rebase
git checkout 3.3.0
cd ..
fi
else
git clone https://github.com/opencv/opencv.git
fi
#opencv
IN=opencv,https://github.com/opencv/opencv.git,true,""
IFS=',' read -a external_options <<< $IN
EXTERNAL="${external_options[0]}"
EXTERNAL_ADDRESS="${external_options[1]}"
EXTERNAL_CMAKE="${external_options[2]}"
EXTERNAL_CMAKE_OPTIONS="-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -DBUILD_opencv_aruco=OFF -DBUILD_opencv_bgsegm=OFF -DBUILD_opencv_bioinspired=OFF -DBUILD_opencv_ccalib=OFF -DBUILD_opencv_cnn_3dobj=OFF -DBUILD_opencv_cvv=OFF -DBUILD_opencv_dnn=OFF -DBUILD_opencv_dnns_easily_fooled=OFF -DBUILD_opencv_dpm=OFF -DBUILD_opencv_fuzzy=OFF -DBUILD_opencv_hdf=OFF -DBUILD_opencv_line_descriptor=OFF -DBUILD_opencv_matlab=OFF -DBUILD_opencv_optflow=OFF -DBUILD_opencv_plot=ON -DBUILD_opencv_reg=OFF -DBUILD_opencv_rgbd=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_sfm=OFF -DBUILD_opencv_stereo=OFF -DBUILD_opencv_structured_light=OFF -DBUILD_opencv_surface_matching=OFF -DBUILD_opencv_xfeatures2d=OFF -DBUILD_opencv_xobjdetect=OFF -DBUILD_opencv_xphoto=OFF -DBUILD_opencv_calib3d=OFF -DBUILD_opencv_cudaarithm=OFF -DBUILD_opencv_cudabgsegm=OFF -DBUILD_opencv_cudacodec=OFF -DBUILD_opencv_cudafilters=OFF -DBUILD_opencv_cudalegacy=OFF -DBUILD_opencv_cudaobjdetect=OFF -DBUILD_opencv_cudaoptflow=OFF -DBUILD_opencv_cudastereo=OFF -DBUILD_opencv_cudawarping=OFF -DBUILD_opencv_cudev=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_shape=OFF -DBUILD_opencv_stitching=OFF -DBUILD_opencv_superres=OFF -DBUILD_opencv_ts=OFF -DBUILD_opencv_videoio=OFF -DBUILD_opencv_videostab=OFF -DBUILD_opencv_viz=OFF"
# create build dir
SRC=/external
BUILD=/external/build
PREFIX=/app/usr/
mkdir -p $BUILD/opencv
# go there
cd $BUILD/opencv
cmake3 -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX $EXTERNAL_CMAKE_OPTIONS $SRC/opencv
# make
make -j8
# install
make install
#EXTERNAL_CONFIGURE="${external_options[3]}"
#build_external $EXTERNAL $EXTERNAL_CMAKE_OPTIONS
#vidstab
IN=vid.stab,https://github.com/georgmartius/vid.stab.git,true,""
IFS=',' read -a external_options <<< $IN
EXTERNAL="${external_options[0]}"
EXTERNAL_ADDRESS="${external_options[1]}"
EXTERNAL_CMAKE="${external_options[2]}"
EXTERNAL_CONFIGURE="${external_options[3]}"
build_external $EXTERNAL
echo "/////////////////\nBUILDING AV LIBS DONE\n////////////////"
#!/bin/bash
# Halt on errors
set -e
# Be verbose
set -x
# Now we are inside CentOS 6
grep -r "CentOS release 6" /etc/redhat-release || exit 1
# Get helper functions
wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
. ./functions.sh
rm -f functions.sh
. /opt/rh/devtoolset-3/enable
#necessary ?
#pulseaudio-libs
QTVERSION=5.9.1
QVERSION_SHORT=5.9
QTDIR=/usr/local/Qt-${QTVERSION}/
# qjsonparser, used to add metadata to the plugins needs to work in a en_US.UTF-8 environment. That's
# not always set correctly in CentOS 6.7
export LC_ALL=en_US.UTF-8
export LANG=en_us.UTF-8
# Determine which architecture should be built
if [[ "$(arch)" = "i686" || "$(arch)" = "x86_64" ]] ; then
ARCH=$(arch)
else
echo "Architecture could not be determined"
exit 1
fi
# Make sure we build from the /, parts of this script depends on that. We also need to run as root...
cd /
# TO-DO ask about this.
export CMAKE_PREFIX_PATH=$QTDIR:/app/share/llvm/
# if the library path doesn't point to our usr/lib, linking will be broken and we won't find all deps either
export LD_LIBRARY_PATH=/usr/lib64/:/usr/lib:/app/usr/lib:$QTDIR/lib/:/opt/python3.5/lib/:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=/usr/lib64/:/usr/lib:/app/usr/lib:$QTDIR/lib/:$LD_LIBRARY_PATH
# Workaround for: On CentOS 6, .pc files in /usr/lib/pkgconfig are not recognized
# However, this is where .pc files get installed when bulding libraries... (FIXME)
# I found this by comparing the output of librevenge's "make install" command
# between Ubuntu and CentOS 6
#ln -sf /usr/share/pkgconfig /usr/lib/pkgconfig
# Get project
if [ ! -d /kdenlive ] ; then
git clone --depth 1 http://anongit.kde.org/kdenlive.git /kdenlive
cd /kdenlive/
# git checkout -b timeline2 origin/refactoring_timeline
else
cd /kdenlive/
if [ $# -eq 0 ]; then
git pull
fi
fi
cd /kdenlive/
#git_pull_rebase_helper
# Prepare the install location
#rm -rf /app/ || true
#mkdir -p /app/usr
# export LLVM_ROOT=/opt/llvm/
# make sure lib and lib64 are the same thing
mkdir -p /app/usr/lib
cd /app/usr
#ln -s lib lib64
# start building the deps
function build_external
{ (
# errors fatal
echo "Compiler version:" $(g++ --version)
set -e
SRC=/external
BUILD=/external/build
PREFIX=/app/usr/
# framework
EXTERNAL=$1
# clone if not there
mkdir -p $SRC
cd $SRC
if ( test -d $EXTERNAL )
then
echo "$EXTERNAL already cloned"
if [ $# -eq 0 ]; then
cd $EXTERNAL
git reset --hard
git pull --rebase
cd ..
fi
else
git clone $EXTERNAL_ADDRESS
fi
# create build dir
mkdir -p $BUILD/$EXTERNAL
# go there
cd $BUILD/$EXTERNAL
# cmake it
if ( $EXTERNAL_CMAKE )
then
cmake3 -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX $2 $SRC/$EXTERNAL
else
$EXTERNAL_CONFIGURE
fi
# make
make -j8
# install
make install
) }
export WLD=/app/usr/ # change this to another location if you prefer
export LD_LIBRARY_PATH=$WLD/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/:/usr/lib/pkgconfig/:$PKG_CONFIG_PATH
export PATH=$WLD/bin:$PATH
export ACLOCAL_PATH=$WLD/share/aclocal
export ACLOCAL="aclocal -I $ACLOCAL_PATH"
IN=frei0r,https://github.com/dyne/frei0r.git,true,""
IFS=',' read -a external_options <<< $IN
EXTERNAL="${external_options[0]}"
EXTERNAL_ADDRESS="${external_options[1]}"
EXTERNAL_CMAKE="${external_options[2]}"
EXTERNAL_CMAKE_OPTIONS="-DWITHOUT_OPENCV:BOOL=ON"
EXTERNAL_CONFIGURE="${external_options[3]}"
build_external $EXTERNAL $EXTERNAL_CMAKE_OPTIONS
#TODO: dependencies for MLT modules (xml, sdl, etc).
#movit - - Requires some adjustments to build with older automake
# cd /external
#if ( test -d /external/movit )
#then
# echo "movit already cloned"
#if [ $# -eq 0 ]; then
# cd movit
# git pull
# git reset --hard
# git pull --rebase
# cd ..
#fi
#else
# git clone https://git.sesse.net/movit
#fi
#cd movit
#./autogen.sh
#./configure --prefix=/app/usr
#make -j5
#make install
#mlt
cd /external
if ( test -d /external/mlt )
then
echo "mlt already cloned"
if [ $# -eq 0 ]; then
cd mlt
git pull
git reset --hard
git pull --rebase
cd ..
fi
else
git clone https://github.com/mltframework/mlt.git
fi
cd mlt
# patch MLT
cat > mlt_fix.patch << 'EOF'
diff --git a/src/modules/vid.stab/configure b/src/modules/vid.stab/configure
index e501888..55f0307 100755
--- a/src/modules/vid.stab/configure
+++ b/src/modules/vid.stab/configure
@@ -19,7 +19,8 @@ then
exit 0
fi
- echo > config.mak
+ echo "CFLAGS += $(pkg-config --cflags vidstab)" > config.mak
+ echo "LDFLAGS += $(pkg-config --libs vidstab)" >> config.mak
case $targetos in
Darwin)
;;
EOF
cat mlt_fix.patch |patch -p1
export CXXFLAGS="-std=c++11"
./configure --enable-gpl --prefix=/app/usr --disable-rtaudio
make -j5
make install
# Build kdenlive
mkdir -p /kdenlive_build
cd /kdenlive_build
cmake3 ../kdenlive \
-DCMAKE_INSTALL_PREFIX:PATH=/app/usr/ \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPACKAGERS_BUILD=1 \
-DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON \
-DBUILD_TESTS=FALSE
make -j8 install
echo "++++++++++++++++++\nBUILD FINSHED \n+++++++++++++++++";
###############################################################
# Build complete, AppImage bundling begins here
###############################################################
This diff is collapsed.
#!/bin/bash
# Halt on errors
set -e
# Be verbose
set -x
echo "++ building dependencies and frameworks..."
. ./01-dependencies.sh
echo "++ building dependencies and frameworks DONE"
echo "++ building AV libraries (ffmpeg, OpenCV) ..."
. ./02-avlibs.sh
echo "++ building AV libraries (ffmpeg, OpenCV) DONE"
echo "++ building MLT and Kdenlive ..."
. ./03-kdenlive.sh
echo "++ building MLT and Kdenlive DONE"
echo "++ Preparing AppImage folder ..."
. ./04-create-app.sh
echo "++ Preparing AppImage folder DONE"
# Rules to build 3rd-party libraries for digiKam bundles.
#
# Copyright (c) 2015-2017, Gilles Caulier, <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
project(digikam-bundles)
cmake_minimum_required(VERSION 2.8.6)
function(JoinListAsString VALUES GLUE OUTPUT)
string(REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
set(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Compiling in the source directory is not supported. Use for example 'mkdir build; cd build; cmake ..'.")
endif()
# Tools must be obtained to work with:
include (ExternalProject)
# allow specification of a directory with pre-downloaded
# requirements
if(NOT IS_DIRECTORY ${EXTERNALS_DOWNLOAD_DIR})
message(FATAL_ERROR "No externals download dir set. Use -DEXTERNALS_DOWNLOAD_DIR")
endif()
if(NOT IS_DIRECTORY ${INSTALL_ROOT})
message(FATAL_ERROR "No install dir set. Use -DINSTALL_ROOT")
endif()
set(TOP_INST_DIR ${INSTALL_ROOT})
set(EXTPREFIX "${TOP_INST_DIR}")
set(CMAKE_PREFIX_PATH "${EXTPREFIX}")
message( STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
message( STATUS "CMAKE_CL_64: ${CMAKE_CL_64}")
set(GLOBAL_BUILD_TYPE RelWithDebInfo)
set(GLOBAL_PROFILE ${GLOBAL_PROFILE} -DBUILD_TESTING=false)
set(PATCH_COMMAND patch)
# this list must be dependency-ordered
add_subdirectory(ext_jpeg)
add_subdirectory(ext_jasper)
add_subdirectory(ext_png)
add_subdirectory(ext_tiff)
#add_subdirectory(ext_libgphoto2)
#add_subdirectory(ext_sane)
add_subdirectory(ext_exiv2)
add_subdirectory(ext_boost)
#add_subdirectory(ext_opencv)
#add_subdirectory(ext_lensfun)
add_subdirectory(ext_qt)
#add_subdirectory(ext_qtwebkit)
#add_subdirectory(ext_qtav)
#add_subdirectory(ext_kf5)
#add_subdirectory(ext_marble)
#add_subdirectory(ext_libksane)
# Script to build Boost for digiKam bundle.
#
# Copyright (c) 2015-2017, Gilles Caulier, <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
SET(PREFIX_ext_boost "${EXTPREFIX}")
ExternalProject_Add( ext_boost
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.bz2
URL_MD5 65a840e1a0b13a558ff19eeb2c4f0cbe
CONFIGURE_COMMAND <SOURCE_DIR>/bootstrap.sh --prefix=${PREFIX_ext_boost} --with-libraries=system
BUILD_COMMAND <SOURCE_DIR>/b2 install
INSTALL_COMMAND ""
INSTALL_DIR ${PREFIX_ext_boost}
UPDATE_COMMAND ""
ALWAYS 0