summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bd77452d0d46ba48ecf362d6e7ee0ab427d6fb1d (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
93
94
95
96
97
98
99
100
# Contributor: carstene1ns <arch carsten-teibes de>
# Contributor: felix <base64 -d <<< ZmVsaXgudm9uLnNAcG9zdGVvLmRlCg==>
# Contributor: Schala
# Contributor: janezz55

pkgname=dosbox-djcrx
pkgver=2.05
pkgrel=7
pkgdesc="Headers and utilities for the djgpp dosbox cross-compiler"
arch=('i686' 'x86_64')
url="http://www.delorie.com/djgpp/"
depends=('glibc' 'gcc-libs')
license=('GPL' 'LGPL' 'custom:djgpp')
source=("http://www.delorie.com/pub/djgpp/current/v2/djcrx${pkgver//./}.zip"
        "http://www.delorie.com/pub/djgpp/current/v2/djlsr${pkgver//./}.zip"
        ttyscrn.patch
        nmemalign.patch
        fseeko64.patch
        asm.patch
        dxegen.patch
        gcc-no-werror.patch
        environ.c)
makedepends=('dosbox-gcc')
sha256sums=('22274ed8d5ee57cf7ccf161f5e1684fd1c0192068724a7d34e1bde168041ca60'
            '80690b6e44ff8bc6c6081fca1f4faeba1591c4490b76ef0ec8b35847baa5deea'
            '83bc02407566c0613c2eeb86d78f2968c11256dfc8d3c2805a5488540e059124'
            'ffdbab52eb13dde716fbcce54154f7c95644afd6333f4931b2cceeb95935c675'
            '536684b0152f7ad77b99bcc5ea535ca8339832399c4582b944ccd882e4b261a1'
            '693810c3242f4e23cdc55d3101281721da9407851e5d29459ad59405e534b916'
            'SKIP'
            'e768d4f2ac8c5b2f21afd7a0dddfc1921377a6675ca099e78baffe9ecab081db'
            '4d5a1448a12fdcebc37578da8a29a1924f68495d4c27b75297ead8ac0542e816')
options=('!buildflags' '!strip')
_target='i586-pc-msdosdjgpp'

prepare() {
  sed -i "s/i586-pc-msdosdjgpp/$_target/" src/makefile.def src/dxe/makefile.dxe
  sed -i 's/ln/ln -f/' src/dxe/makefile.dxe

  # enable building without an ldscript
  ln -fs ../../../environ.c src/libc/crt0/environ.c
  sed -i '/dfinfo\.c/ a \
SRC += environ.c' src/libc/crt0/makefile

  # fix build with gcc > 6
  patch -Np0 < gcc-no-werror.patch

  # gcc provides its own float.h which masks this one
  ln -fs float.h include/djfloat.h
  sed -i 's/<float\.h>/<djfloat.h>/' src/libc/{go32/dpmiexcp,emu387/npxsetup}.c src/utils/redir.c

  # fix libc bugs
  patch -Np0 < ttyscrn.patch
  patch -Np0 < nmemalign.patch
  patch -Np0 < fseeko64.patch
  patch -Np0 < asm.patch

  # allow using dxe3gen without DJDIR and without dxe3res in PATH
  patch -Np0 < dxegen.patch

  # be verbose
  #sed -i '/@$(MISC) echo - / d; s/^\t@/\t/' src/makefile.inc src/libc/makefile src/utils/makefile
}

build() {
  cd src
  make clean
  make -j1

  cd dxe
  make -f makefile.dxe
}

package() {
  install -d "$pkgdir"/usr/bin
  install -d "$pkgdir"/usr/$_target/bin

  cp -r lib include "$pkgdir"/usr/$_target

  cd hostbin
  for _file in djasm mkdoc stubedit stubify; do
    install -m0755 $_file.exe "$pkgdir"/usr/$_target/bin/$_file
    ln -s ../$_target/bin/$_file "$pkgdir"/usr/bin/$_target-$_file
  done

  cd ../src/dxe
  for _file in dxe3gen dxe3res; do
    install -m0755 $_file "$pkgdir"/usr/$_target/bin/$_file
    ln -s ../$_target/bin/$_file "$pkgdir"/usr/bin/$_target-$_file
  done
  ln -s dxe3gen "$pkgdir"/usr/$_target/bin/dxegen

  cd "$srcdir"
  install -Dm644 copying.dj "$pkgdir"/usr/share/licenses/$pkgname/copying.dj

  cd info
  for _file in *.info; do
    install -Dm0644 $_file "$pkgdir"/usr/share/info/djgpp-$_file
  done
}