summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b16e3ab770f0bdae0a4ec376c33b9997e63f969d (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:‌ dreieck

_pkgname=dptf
pkgname="${_pkgname}-git"
epoch=1
pkgver=9.0.11402.build38022.r100.20230911.00b9ac15
pkgrel=5
pkgdesc='Intel (R) Dynamic Platform and Thermal Framework (Intel (R) DPTF)'
arch=('x86_64')
url='https://github.com/intel/dptf'
license=('Apache')
depends=('gcc-libs' 'glibc' 'libedit')
makedepends=('cmake' 'git')
provides=("${_pkgname}=${pkgver}")
conflicts=("${_pkgname}")
backup=(
  'etc/dptf/dsp.dv'
)
source=("${_pkgname}::git+${url}.git")
sha256sums=('SKIP')
options+=('!lto')

pkgver() {
  cd "${srcdir}/${_pkgname}"

  # As of 2023-07-13, `VER_MAJOR` from `Common/Ver.h` is 1 but the major version from git tags is 9.
  _ver_gittag="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|-g[0-9a-f]*$||' | tr '-' '+')"
  _ver_major="$(grep -E '^[[:space:]]*#define[[:space:]]+VER_MAJOR[[:space:]]+[0-9]*' Common/Ver.h | awk '{print $3}')"
  _ver_minor="$(grep -E '^[[:space:]]*#define[[:space:]]+VER_MINOR[[:space:]]+[0-9]*' Common/Ver.h | awk '{print $3}')"
  _ver_hotfix="$(grep -E '^[[:space:]]*#define[[:space:]]+VER_HOTFIX[[:space:]]+[0-9]*' Common/Ver.h | awk '{print $3}')"
  _ver_build="$(grep -E '^[[:space:]]*#define[[:space:]]+VER_BUILD[[:space:]]+[0-9]*' Common/Ver.h | awk '{print $3}')"
  _ver="${_ver_gittag}.build${_ver_build}"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Version could not be determined."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

build() {
    cd "${srcdir}/${_pkgname}"

    export CXXFLAGS="${CXXFLAGS} -Wno-error=catch-value -Wno-error=stringop-truncation -Wno-error=overloaded-virtual -Wno-error=lto-type-mismatch -ffile-prefix-map='${srcdir}/${_pkgname}'="
    export CFLAGS="${CFLAGS} -Wno-error=format-truncation -Wno-error=format-overflow -Wno-error=overloaded-virtual -Wno-error=lto-type-mismatch -ffile-prefix-map='${srcdir}/${_pkgname}'="

    pushd DPTF/Linux/build
      cmake \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        ..
      make
    popd

    pushd ESIF/Products/ESIF_UF/Linux
      make
    popd

    pushd ESIF/Products/ESIF_CMP/Linux
      make
    popd

    pushd ESIF/Products/ESIF_WS/Linux
      make
    popd

    pushd IPF/Linux
      make
    popd
}

package() {
    cd "${srcdir}/${_pkgname}"
    install -Dvm755  DPTF/Linux/build/x64/release/*.so         -t "${pkgdir}/usr/share/dptf/ufx64/"
    install -Dvm755  ESIF/Products/ESIF_UF/Linux/ipf_ufd          "${pkgdir}/usr/bin/ipf_ufd"
    install -Dvm755  ESIF/Products/ESIF_CMP/Linux/*.so         -t "${pkgdir}/usr/share/dptf/ufx64/"
    install -Dvm755  ESIF/Products/ESIF_WS/Linux/*.so          -t "${pkgdir}/usr/share/dptf/ufx64/"
    install -Dvm755  IPF/Linux/*.so                            -t "${pkgdir}/usr/share/dptf/ufx64/"
    install -Dvm755  IPF/Linux/ipfhostd                           "${pkgdir}/usr/bin/ipfhostd"
    install -Dvm644  ESIF/Packages/DSP/dsp.dv                     "${pkgdir}/etc/dptf/dsp.dv"
    install -Dvm644  ESIF/Packages/Installers/linux/dtt.service   "${pkgdir}/usr/lib/systemd/system/dtt.service"
    install -Dvm644  ESIF/Packages/Installers/linux/ipf.service   "${pkgdir}/usr/lib/systemd/system/ipf.service"

    install -Dvm644  README.txt   "${pkgdir}/usr/share/doc/${_pkgname}/README.txt"
    install -Dvm644  security.md  "${pkgdir}/usr/share/doc/${_pkgname}/security.md"
    install -Dvm644  LICENSE.txt  "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt" "${pkgdir}/usr/share/doc/${_pkgname}/LICENSE.txt"
}