summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 817a2b557b422ad1126c1b90e9df4037aa10b274 (plain)
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
# Maintainer: tytan652 <tytan652 at tytanium dot xyz>

pkgname=cef-minimal-obs-bin
_cefver="103.0.0-5060-shared-textures_2594"
_version=${_cefver//-/_}
_commit="17f8588"
_cefbranch="5060"
_chromiumver="103.0.${_cefbranch}.134"
_rebuild="1" # The tarball sometime can get rebuild by OBS Project
pkgver="${_version}+g${_commit}+chromium_${_chromiumver}_${_rebuild}"
pkgrel=1
epoch=1
pkgdesc="Chromium Embedded Framework minimal release needed by OBS Studio release in /opt/cef-obs"
arch=("x86_64" "aarch64")
url="https://github.com/obsproject/cef/tree/5060-shared-textures"
license=(BSD-3-Clause)
depends=(
  "alsa-lib" "at-spi2-core" "dbus" "expat" "gcc-libs" "glib2"
  "glibc" "libcups" "libdrm" "libx11" "libxcb" "libxcomposite"
  "libxdamage" "libxext" "libxfixes" "libxkbcommon" "libxrandr" "mesa"
  "nspr" "nss" "wayland"
)
makedepends=("cmake")
provides=("cef-minimal-obs=$pkgver")
conflicts=("cef-minimal-obs")
# Prevent people from using link time optimisation for this package because it make OBS unable to be built against it
options=('!lto' '!strip' 'debug')
source_x86_64=("https://cdn-fastly.obsproject.com/downloads/cef_binary_${_cefbranch}_linux_x86_64_v3.tar.xz")
source_aarch64=("https://cdn-fastly.obsproject.com/downloads/cef_binary_${_cefbranch}_linux_aarch64_v3.tar.xz")
sha256sums_x86_64=("1253a6a36c3b8ac5b5ece9bfdb6eae6ab75e49516375fc475e2e871795ad9bea")
sha256sums_aarch64=("66ebcfce94a4527c8dd085a685691d0c43291adab9f2be4f8a0762f4a614083a")

prepare() {
  cd "${srcdir}/cef_binary_${_cefbranch}_linux_${CARCH}"

  # Fix directories permissions
  chmod 755 Release
  chmod 755 Resources
  chmod 755 Resources/locales
  chmod 755 include
  chmod 755 include/base
  chmod 755 include/base/internal
  chmod 755 include/capi
  chmod 755 include/capi/test
  chmod 755 include/capi/views
  chmod 755 include/internal
  chmod 755 include/test
  chmod 755 include/views
  chmod 755 include/wrapper
  chmod 755 libcef_dll
  chmod 755 libcef_dll/base
  chmod 755 libcef_dll/cpptoc
  chmod 755 libcef_dll/cpptoc/test
  chmod 755 libcef_dll/cpptoc/views
  chmod 755 libcef_dll/ctocpp
  chmod 755 libcef_dll/ctocpp/test
  chmod 755 libcef_dll/ctocpp/views
  chmod 755 libcef_dll/wrapper

  # Remove pre-built wrapper
  rm -rf build
}

build() {
  cd "${srcdir}/cef_binary_${_cefbranch}_linux_${CARCH}"

  # this uses malloc_usable_size, which is incompatible with fortification level 3
  export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
  export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"

  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DPROJECT_ARCH=$CARCH .

  make libcef_dll_wrapper

  # Remove unneeded files
  rm -f CMakeLists.txt CMakeCache.txt Makefile cmake_install.cmake README.txt libcef_dll/CMakeLists.txt
  rm -rf CMakeFiles
    
  cd libcef_dll_wrapper
  rm -f Makefile cmake_install.cmake
  rm -rf CMakeFiles
}

package() {
    mkdir -p "$pkgdir"/opt/cef-obs/
    cp -a "${srcdir}/cef_binary_${_cefbranch}_linux_${CARCH}"/* "$pkgdir"/opt/cef-obs
    rm -f "$pkgdir"/opt/cef-obs/LICENSE.txt
    rm -rf "$pkgdir"/opt/cef-obs/cmake
    install -Dm644 "${srcdir}/cef_binary_${_cefbranch}_linux_${CARCH}/LICENSE.txt" "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE
}