File PKGBUILD of Package linphoneqt

# Fix for error: bsdtar: Failed to set default locale
# LANG=en_US.UTF-8 # not available, use C or POSIX
LANG=C
LC_ALL=${LANG}
_name=linphone
pkgname=linphone-desktop
_pkgname=linphone-desktop
pkgver=5.2.4
pkgrel=0
arch=(x86_64 i686)
pkgdesc='A free VoIP and video softphone based on the SIP protocol'
url='http://linphone.org'
license=(GPL)
# optional makedepends: 'zxing-cpp'
# With debug symbols
options=(!strip)
# Some dependencies cascaded into liblinphone, mediastreamer2 etc.
depends=(liblinphone qt5-quickcontrols qt5-quickcontrols2 
  qt5-graphicaleffects qt5-svg qt5-tools qt5-speech qt5-webengine
  hicolor-icon-theme)
conflicts=("$pkgname")
provides=("$pkgname=$pkgver")
#makedepends: inkscape imagemagick
makedepends=(cmake libdecaf glew zxing-cpp libyuv
  qt5-svg qt5-quickcontrols qt5-quickcontrols2 qt5-graphicaleffects
  qt5-tools qt5-declarative qt5-speech qt5-wayland qt5-webview 
  liblinphone chrpath)
# Optional patch linphoneqt-0006-plugin-dir.patch
optdepends=('linphone-contacts-vcard-csv-import-export: linphone contacts vCard CSV avatar import export')
source=("${pkgname}-${pkgver}.tar.bz2" 
  linphoneqt-fix-no-git.patch
  linphoneqt-0002-remove-bc_compute_full_version-usage.patch
  linphoneqt_fix_gcc12_error.patch
  linphoneqt-fix-Archlinux-compilation.patch
  linphoneqt-0001-system-tray.patch
  linphoneqt-0005-enforce-media-encryption.patch
  linphoneqt-0006-plugin-dir.patch
  linphoneqt-0007-expiry-time.patch)
sha256sums=(SKIP SKIP SKIP SKIP SKIP SKIP SKIP SKIP SKIP)
_move_libmsqogl_to_lib=true
_uploaddir=/usr/src/packages/SOURCES
_sourcedir=/usr/src/packages/BUILD/${pkgname}/src/${pkgname}-${pkgver}
# srcdir is already defined as first package name in list ${pkgname}
# ${srcdir}=/usr/src/packages/BUILD/${pkgname}/src
_builddir=/usr/src/packages/BUILD/${pkgname}/build
_pkgdir=/usr/src/packages/BUILD/${pkgname}/pkg/${pkgname}
_installToDir=${_pkgdir}/usr

prepare() {
  echo "Move patching to build() section for verbose log output"
  # patch -d "${_sourcedir}" -p1 < fix.patch
  # patch -d "${_sourcedir}" --forward --strip=1 --input="${srcdir}/fix.patch"
  # patch -d "${_sourcedir}" --forward --strip=1 --input="${_uploaddir}/fix.patch"
  patch -d "${_sourcedir}" -p1 < linphoneqt-fix-no-git.patch
  patch -d "${_sourcedir}" -p1 < linphoneqt-0002-remove-bc_compute_full_version-usage.patch
  patch -d "${_sourcedir}" -p1 < linphoneqt_fix_gcc12_error.patch
  patch -d "${_sourcedir}" -p1 < linphoneqt-fix-Archlinux-compilation.patch
  patch -d "${_sourcedir}" -p1 < linphoneqt-0001-system-tray.patch
  patch -d "${_sourcedir}" -p1 < linphoneqt-0005-enforce-media-encryption.patch
  if ${_move_libmsqogl_to_lib}; then
    patch -d "${_sourcedir}" -p1 < linphoneqt-0006-plugin-dir.patch
  fi
  patch -d "${_sourcedir}" -p1 < linphoneqt-0007-expiry-time.patch
}

build() {
  cd "${_sourcedir}"
  # Fix building out-of-git
  echo '#define LINPHONE_QT_GIT_VERSION "${PROJECT_VERSION}"' >> linphone-app/src/config.h.cmake
  # Hardcode linphoneqt version
  echo "project(linphoneqt VERSION $pkgver)" > linphone-app/linphoneqt_version.cmake
  cp -v ${_uploaddir}/${_name}.appdata.xml linphone.appdata.xml
  touch linphone-sdk/CMakeLists.txt
  # Adaptation from SPEC file (maybe obsolete):
  sed -i '/^add_custom_command/s@${CMAKE_INSTALL_PREFIX}/include/@/usr/src/packages/BUILD/linphone/pkg/linphone/usr/include/@;/^add_custom_command/s@${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/@/usr/src/packages/BUILD/linphone/pkg/linphone/usr/lib/@' linphone-app/CMakeLists.txt
  sed -i '/\/ui/s@${qml_dir}@${CMAKE_CURRENT_SOURCE_DIR}/../&@' linphone-app/cmake_builder/linphone_package/CMakeLists.txt
  export CFLAGS=$(echo "$CFLAGS -Wno-error=deprecated-declarations")
  export CXXFLAGS=$(echo "$CXXFLAGS -Wno-error=deprecated-declarations")
  cmake -S "${_sourcedir}" -B "${_builddir}" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLINPHONE_OUTPUT_DIR="/usr/src/packages/BUILD/${pkgname}/build" \
    -DMSPLUGINS_DIR="/usr/lib" \
    -DENABLE_UPDATE_CHECK=OFF \
    -DENABLE_STATIC=OFF \
    -DENABLE_BUILD_EXAMPLES=NO \
    -DENABLE_QT_KEYCHAIN=NO    
  cmake --build "${_builddir}"  
  echo "Cleaning cmake_install.cmake files from linphone-sdk items..."
  sed -i 's/lib:\/usr\/src\/packages\/BUILD\/linphone-desktop\/build\/linphone-sdk\/desktop\///g' ${_builddir}/linphone-app/cmake_builder/linphone_package/cmake_install.cmake
  sed -i '/linphone-sdk/d' ${_builddir}/linphone-app/cmake_builder/linphone_package/cmake_install.cmake
  sed -i "s|$srcdir/build/OUTPUT|$pkgdir/usr|" ${_builddir}/cmake_install.cmake
  echo "--- Show installed files from build section ---"
  echo "Check that these files are not missing in package $_pkgname."
  echo "If necessary, move these files to"
  echo "    ${_pkgdir}"
  echo
  find /usr/src/packages/BUILD/linphone
  echo "--- End show installed files from build section ---"
}

package() {
  rm -rf "${pkgdir}"; mkdir -pv "${pkgdir}"
  ADD_MISSING_DIRS_FROM_BASEDIR="/usr/src/packages/BUILD/${pkgname}/build"
  if ${_move_libmsqogl_to_lib}; then
    mkdir -pv "$ADD_MISSING_DIRS_FROM_BASEDIR/bin"
    mkdir -pv "$ADD_MISSING_DIRS_FROM_BASEDIR/share/linphone"
    mkdir -pv "$ADD_MISSING_DIRS_FROM_BASEDIR/share/sounds/linphone"
  else
    mkdir -pv "$ADD_MISSING_DIRS_FROM_BASEDIR/bin"
    mkdir -pv "$ADD_MISSING_DIRS_FROM_BASEDIR/share/linphone"
    mkdir -pv "$ADD_MISSING_DIRS_FROM_BASEDIR/share/sounds/linphone"  
  fi
  # Install: We don't yet want to remove the debug info
  cmake --install "${_builddir}" --config RelWithDebInfo --prefix "${_installToDir}"
  # cmake --install "${_builddir}" --config RelWithDebInfo --prefix "${_installToDir}" --strip
  # DESTDIR="${_installToDir}" cmake --install "${builddir}"
  # DESTDIR="${_installToDir}" cmake --install "${builddir}" --strip
  FILE=${pkgdir}/usr/share/icons/hicolor/scalable/apps/linphone.svg
  echo "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"64\" height=\"64\" version=\"1\">" > $FILE
  echo " <path style=\"opacity:0.2\" d=\"m 32,5 c -0.78188,0 -1.551046,0.039322 -2.316406,0.101562 -6.9222,0.4922802 -12.484081,3.0549814 -17.488282,8.050781 -4.1227994,4.116 -6.6776994,9.194719 -7.6874996,14.511719 -0.09302,0.48592 -0.166654,0.977996 -0.2343748,1.472656 -0.04094,0.30366 -0.086308,0.605516 -0.117188,0.910158 -0.06788,0.65334 -0.106346,1.314268 -0.128906,1.980468 -0.005,0.16788 -0.01362,0.335946 -0.01562,0.503906 C 4.0077188,32.68525 4,32.844 4,33 c 0,15.2532 12.076563,27.570562 27.226562,27.976562 0.11766,0.0034 0.23777,0.01 0.35547,0.0118 C 31.724032,60.991282 31.86,61 32,61 c 0.67422,0 1.341846,-0.03564 2.003906,-0.08204 0.08308,-0.0062 0.16308,-0.0086 0.246094,-0.0156 10.0028,-0.7894 18.473306,-6.796194 22.753906,-15.308594 0,0 0.004,-0.004 0.004,-0.004 0.2769,-0.55108 0.559902,-1.100496 0.800782,-1.671876 1.31076,-2.96 2.022944,-6.102024 2.152344,-9.390624 0.0056,-0.10624 0.0072,-0.213752 0.0118,-0.320312 0.0086,-0.31416 0.02554,-0.624588 0.02344,-0.941408 C 59.995894,33.175624 60,33.09 60,33 V 9.199219 C 60,6.872419 58.127582,5 55.800782,5 H 32.210938 Z\"/>" >> $FILE
  echo " <path style=\"fill:#f57f38\" d=\"m 32,4 c -0.78188,0 -1.551046,0.039322 -2.316406,0.101562 -6.9222,0.4922802 -12.484081,3.0549814 -17.488282,8.050781 -4.1227994,4.116 -6.6776994,9.194719 -7.6874996,14.511719 -0.09302,0.48592 -0.166654,0.977996 -0.2343748,1.472656 -0.04094,0.30366 -0.086308,0.605516 -0.117188,0.910158 -0.06788,0.65334 -0.106346,1.314268 -0.128906,1.980468 -0.005,0.16788 -0.01362,0.335946 -0.01562,0.503906 C 4.0077188,31.68525 4,31.844 4,32 c 0,15.2532 12.076563,27.570562 27.226562,27.976562 0.11766,0.0034 0.23777,0.01 0.35547,0.0118 C 31.724032,59.991282 31.86,60 32,60 c 0.67422,0 1.341846,-0.03564 2.003906,-0.08204 0.08308,-0.0062 0.16308,-0.0086 0.246094,-0.0156 10.0028,-0.7894 18.473306,-6.796194 22.753906,-15.308594 0,0 0.004,-0.004 0.004,-0.004 0.2769,-0.55108 0.559902,-1.100496 0.800782,-1.671876 1.31076,-2.96 2.022944,-6.102024 2.152344,-9.390624 0.0056,-0.10624 0.0072,-0.213752 0.0118,-0.320312 0.0086,-0.31416 0.02554,-0.624588 0.02344,-0.941408 C 59.995894,32.175624 60,32.09 60,32 V 8.1992188 C 60,5.872419 58.127582,4 55.800782,4 H 32.210938 Z\"/>" >> $FILE
  echo " <path style=\"opacity:0.2\" d=\"m 34.747,17.002876 c -0.70276,0 -1.28592,0.561239 -1.29262,1.241349 -0.0042,0.683208 0.5792,1.257729 1.28694,1.261247 3.0544,0.02294 5.5658,0.988176 7.5908,2.891696 2.0012,1.885862 3.0444,4.498728 3.071,7.90837 v 0.003 c 0.0072,0.678268 0.59086,1.23845 1.29546,1.23845 7.4e-5,0 0.0134,-0.0028 0.0142,-0.003 0.70618,-0.0064 1.29264,-0.5758 1.28692,-1.258408 v -0.003 c -0.016,-1.98979 -0.34,-3.817598 -0.972,-5.42543 -0.64,-1.624828 -1.612,-3.062278 -2.88,-4.258152 -2.506,-2.355953 -5.706,-3.573025 -9.39,-3.599022 h -0.0114 z m -13.1192,2.94009 c -0.4928,-0.08374 -1.02662,0.0078 -1.55966,0.264172 h -0.04262 l -0.05968,0.0341 c -0.9876,0.56154 -1.913601,1.314262 -2.781001,2.258362 l -0.06818,0.07386 v 0.06818 c -0.6,0.74812 -0.9968,1.501242 -1.088,2.255562 -0.02912,0.12784 -0.0284,0.243094 -0.0284,0.366442 0,0.343184 0.05044,0.691948 0.15626,1.033992 l 0.0284,0.09658 0.05966,0.0341 c 0.34258,1.175276 1.12,3.004284 2.821001,6.101758 1.13298,2.052984 2.2906,3.767804 3.4404,5.212652 0.60566,0.75936 1.29176,1.549978 2.088,2.346354 0.0094,0.0096 0.04304,0.04376 0.07956,0.0767 0.0126,0.0126 0.03036,0.03888 0.07386,0.0824 l 0.07954,0.07954 h 0.0058 c 0.02802,0.02804 0.04694,0.04838 0.05114,0.05398 l 0.0142,0.017 0.0142,0.0144 c 0.79628,0.787518 1.58166,1.477684 2.3494,2.079382 1.44274,1.149718 3.1574,2.316356 5.2102,3.451438 3.1012,1.7107 4.9474,2.483938 6.1164,2.820702 l 0.04262,0.05114 0.07104,0.02558 c 0.3312,0.1104 0.67584,0.16138 1.01704,0.15624 0.1384,0.0074 0.26094,-0.002 0.37784,-0.0284 0.8007,-0.09362 1.59352,-0.472692 2.3778,-1.130562 l 0.0086,-0.0114 0.0086,-0.0056 c 0.0122,-0.012 0.005,-0.0062 0.0114,-0.0144 0.007,-0.0062 0.01,-0.0136 0.0172,-0.02 0.92836,-0.847212 1.67766,-1.768634 2.2414,-2.755312 l 0.03692,-0.0625 v -0.05966 c 0.5178,-1.078148 0.3127,-2.178772 -0.5284,-2.880498 -0.0206,-0.0176 -0.42474,-0.355462 -0.92614,-0.76412 -0.51276,-0.417796 -1.12088,-0.908904 -1.53146,-1.210152 -0.77684,-0.57462 -1.97752,-1.317902 -2.662,-1.698702 h -0.0028 c -1.31456,-0.736122 -2.6882,-0.308328 -3.2926,0.47439 l -1.05966,1.326582 c -0.42736,0.538422 -1.2813,0.487068 -1.30398,0.485748 -7.1874,-1.848946 -9.1198,-9.075446 -9.1336,-9.126842 -0.0013,-0.02262 -0.05294,-0.877986 0.4858,-1.312382 l 1.32102,-1.056708 c 0.78466,-0.600898 1.2258,-1.974212 0.4858,-3.292254 -0.38604,-0.681428 -1.1326,-1.891062 -1.69886,-2.66172 h -0.0028 c -0.306,-0.412158 -0.796,-1.023694 -1.214,-1.53704 -0.208,-0.256572 -0.398,-0.491348 -0.536,-0.65893 -0.07,-0.0838 -0.126,-0.15138 -0.166,-0.19878 -0.02,-0.0237 -0.03662,-0.04036 -0.0483,-0.05398 -0.0058,-0.0068 -0.009,-0.0114 -0.0142,-0.017 -0.366,-0.434754 -0.832,-0.699526 -1.346,-0.786918 z m 13.196,2.880498 c -0.69314,-0.04888 -1.31594,0.47045 -1.36648,1.1391 -0.05058,0.66939 0.48946,1.266408 1.18182,1.315202 1.71216,0.12098 2.8676,0.624314 3.7358,1.542458 v 0.003 c 0.88622,0.935182 1.28946,2.00319 1.25568,3.462636 v 0.0056 c -0.015,0.671608 0.54838,1.24079 1.24432,1.255508 h 0.0312 c 0.68578,0 1.25746,-0.541304 1.27272,-1.204434 0.0469,-2.00619 -0.60658,-3.796202 -1.9233,-5.184056 -1.326,-1.394652 -3.2,-2.17597 -5.434,-2.334754 z\"/>" >> $FILE
  echo " <path style=\"fill:#ffffff\" d=\"m 34.747,16.002876 c -0.70276,0 -1.28592,0.561239 -1.29262,1.241349 -0.0042,0.683208 0.5792,1.257728 1.28694,1.261246 3.0544,0.02294 5.5658,0.988176 7.5908,2.891697 2.0012,1.885862 3.0444,4.498728 3.071,7.90837 v 0.003 c 0.0072,0.678268 0.59086,1.23845 1.29546,1.23845 7.4e-5,0 0.0134,-0.0028 0.0142,-0.003 0.70618,-0.0064 1.29264,-0.5758 1.28692,-1.258408 v -0.003 c -0.016,-1.98979 -0.34,-3.817598 -0.972,-5.42543 -0.64,-1.624828 -1.612,-3.062278 -2.88,-4.258153 -2.506,-2.355952 -5.706,-3.573024 -9.39,-3.599021 h -0.0114 z m -13.1192,2.940089 c -0.4928,-0.08374 -1.02662,0.0078 -1.55966,0.264172 h -0.04262 l -0.05968,0.0341 c -0.9876,0.56154 -1.913601,1.314263 -2.781001,2.258363 l -0.06818,0.07386 v 0.06818 c -0.6,0.74812 -0.9968,1.501242 -1.088,2.255562 -0.02912,0.12784 -0.0284,0.243094 -0.0284,0.366442 0,0.343184 0.05044,0.691948 0.15626,1.033992 l 0.0284,0.09658 0.05966,0.0341 c 0.34258,1.175276 1.12,3.004284 2.821001,6.101758 1.13298,2.052984 2.2906,3.767804 3.4404,5.212652 0.60566,0.75936 1.29176,1.549978 2.088,2.346354 0.0094,0.0096 0.04304,0.04376 0.07956,0.0767 0.0126,0.0126 0.03036,0.03888 0.07386,0.0824 l 0.07954,0.07954 h 0.0058 c 0.02802,0.02804 0.04694,0.04838 0.05114,0.05398 l 0.0142,0.017 0.0142,0.0144 c 0.79628,0.787518 1.58166,1.477684 2.3494,2.079382 1.44274,1.149718 3.1574,2.316356 5.2102,3.451438 3.1012,1.7107 4.9474,2.483938 6.1164,2.820702 l 0.04262,0.05114 0.07104,0.02558 c 0.3312,0.1104 0.67584,0.16138 1.01704,0.15624 0.1384,0.0074 0.26094,-0.002 0.37784,-0.0284 0.8007,-0.09362 1.59352,-0.472692 2.3778,-1.130562 l 0.0086,-0.0114 0.0086,-0.0056 c 0.0122,-0.012 0.005,-0.0062 0.0114,-0.0144 0.007,-0.0062 0.01,-0.0136 0.0172,-0.02 0.92836,-0.847212 1.67766,-1.768634 2.2414,-2.755312 l 0.03692,-0.0625 v -0.05966 c 0.5178,-1.078148 0.3127,-2.178772 -0.5284,-2.880498 -0.0206,-0.0176 -0.42474,-0.355462 -0.92614,-0.76412 -0.51276,-0.417796 -1.12088,-0.908904 -1.53146,-1.210152 -0.77684,-0.57462 -1.97752,-1.317902 -2.662,-1.698702 h -0.0028 c -1.31456,-0.736122 -2.6882,-0.308328 -3.2926,0.47439 l -1.05966,1.326582 c -0.42736,0.538422 -1.2813,0.487068 -1.30398,0.485748 -7.1874,-1.848946 -9.1198,-9.075446 -9.1336,-9.126842 -0.0013,-0.02262 -0.05294,-0.877986 0.4858,-1.312382 l 1.32102,-1.056708 c 0.78466,-0.600898 1.2258,-1.974212 0.4858,-3.292254 -0.38604,-0.681428 -1.1326,-1.891062 -1.69886,-2.66172 h -0.0028 c -0.306,-0.412158 -0.796,-1.023694 -1.214,-1.53704 -0.208,-0.256572 -0.398,-0.491348 -0.536,-0.658931 -0.07,-0.0838 -0.126,-0.15138 -0.166,-0.19878 -0.02,-0.0237 -0.03662,-0.04036 -0.0483,-0.05398 -0.0058,-0.0068 -0.009,-0.0114 -0.0142,-0.017 -0.366,-0.434754 -0.832,-0.699526 -1.346,-0.786918 z m 13.196,2.880499 c -0.69314,-0.04888 -1.31594,0.47045 -1.36648,1.1391 -0.05058,0.66939 0.48946,1.266408 1.18182,1.315202 1.71216,0.12098 2.8676,0.624314 3.7358,1.542458 v 0.003 c 0.88622,0.935182 1.28946,2.00319 1.25568,3.462636 v 0.0056 c -0.015,0.671608 0.54838,1.24079 1.24432,1.255508 h 0.0312 c 0.68578,0 1.25746,-0.541304 1.27272,-1.204434 0.0469,-2.00619 -0.60658,-3.796202 -1.9233,-5.184056 -1.326,-1.394652 -3.2,-2.17597 -5.434,-2.334754 z\"/>" >> $FILE
  echo " <path style=\"opacity:0.2;fill:#ffffff\" d=\"M 32 4 C 31.21812 4 30.448954 4.0393225 29.683594 4.1015625 C 22.761394 4.5938429 17.199514 7.1565441 12.195312 12.152344 C 8.0725131 16.268344 5.5176127 21.347062 4.5078125 26.664062 C 4.4147925 27.149983 4.3411563 27.642059 4.2734375 28.136719 C 4.2324975 28.440379 4.18713 28.742231 4.15625 29.046875 C 4.08837 29.700215 4.0499037 30.361144 4.0273438 31.027344 C 4.0223438 31.195224 4.0137188 31.36329 4.0117188 31.53125 C 4.007714 31.68525 4 31.844 4 32 C 4 32.121303 4.0101924 32.240032 4.0175781 32.359375 C 4.0210866 32.248684 4.0240493 32.137957 4.0273438 32.027344 C 4.0499037 31.361144 4.08837 30.700215 4.15625 30.046875 C 4.18713 29.742231 4.2324975 29.440379 4.2734375 29.136719 C 4.3411563 28.642059 4.4147925 28.149983 4.5078125 27.664062 C 5.5176127 22.347062 8.0725131 17.268344 12.195312 13.152344 C 17.199514 8.1565441 22.761394 5.5938429 29.683594 5.1015625 C 30.448954 5.0393225 31.21812 5 32 5 L 32.210938 5 L 55.800781 5 C 58.127581 5 60 6.872419 60 9.1992188 L 60 8.1992188 C 60 5.8724189 58.127581 4 55.800781 4 L 32.210938 4 L 32 4 z\"/>" >> $FILE
  echo "</svg>" >> $FILE
  chrpath -d "${pkgdir}"/usr/bin/linphone "${pkgdir}"/usr/lib/libapp-plugin.so
  # Clean-up
  rm -vrf "${pkgdir}"/usr/src
  rm -vf "${pkgdir}"/usr/bin/qt.conf
  echo
  echo pkgdir=${pkgdir}
  echo "--- Show files that will be packaged in $_pkgname package ---"
  find ${pkgdir} | sed "s|${pkgdir}||g" | sort
  echo "--- End files that will be packaged in $_pkgname package ---"
}
openSUSE Build Service is sponsored by