summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e718d8190622f39b595bb1531f2fa0bd96b86c00 (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
pkgname=mingw-w64-qwt-qt6
pkgver=6.2.0
pkgrel=1
pkgdesc="Qt Widgets for Technical Applications (mingw-w64)"
arch=('any')
license=('custom:qwt')
url="http://qwt.sourceforge.net"
depends=('mingw-w64-qt6-svg')
makedepends=('mingw-w64-gcc' 'qt6-base' 'subversion')
options=('staticlibs' '!strip' '!buildflags')
source=("svn+https://svn.code.sf.net/p/qwt/code/branches/qwt-6.2")
sha256sums=('SKIP')

_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

prepare() {
  cd qwt-6.2
  # Build release only
  sed -i 's|+= debug_and_release|+= release|' qwtbuild.pri
  sed -i '/+= build_all/d' qwtbuild.pri

  # No designer plugin:
  sed -i 's|+= QwtDesigner|-= QwtDesigner|' qwtconfig.pri

  # Make install locations consistent with Arch's native Qwt:
  sed -i 's|$${QWT_INSTALL_PREFIX}/doc|$${QWT_INSTALL_PREFIX}/share/doc/qwt|' qwtconfig.pri
  sed -i 's|$${QWT_INSTALL_PREFIX}/include|$${QWT_INSTALL_PREFIX}/include/qwt|' qwtconfig.pri

  # No need for docs:
  sed -i "s|= target doc|= target|" src/src.pro
}

build() {
  for _arch in ${_architectures}; do
    export QTDIR=/usr/${_arch}/lib/qt6
    export PATH=${QTDIR}/bin:${PATH}
    export QMAKESPEC=${QTDIR}/mkspecs/win32-g++

    mkdir -p "${srcdir}/qwt-build-${_arch}"
    cd "${srcdir}"
    rm -rf qwt-build-${_arch}
    cp -r "qwt-6.2" qwt-build-${_arch}
    cd qwt-build-${_arch}

    # This is a mingw build, so Windows prefix is used. Let's change it:
    sed -i "s|C:/Qwt-\$\$QWT_VERSION|/usr/${_arch}|" qwtconfig.pri

    ${QTDIR}/bin/qmake qwt.pro
    make
  done
}

package() {

  for _target in ${_architectures}; do

    cd "${srcdir}/qwt-build-${_target}/qwt-6.2"

    make INSTALL_ROOT=${pkgdir} QTDIR=/usr/${_target}/ install

    cd "${pkgdir}/usr/${_target}"

    # Move DLLs from lib to bin
    mkdir -p bin
    mv lib/*.dll bin/
    ${_target}-strip --strip-unneeded "$pkgdir"/usr/${_target}/bin/*.dll
    ${_target}-strip -g "$pkgdir"/usr/${_target}/lib/*.a
    # Move features to share/qt/mkspecs
    rm -rf "$pkgdir"/usr/${_target}/share
    mkdir -p lib/qt/mkspecs
    mv features lib/qt/mkspecs
  done
}