summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ed97d239f3a659324daea622c49b33c586472f56 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#
# PKGBUILD for opencbm
#
# Contributor: Uffe Jakobsen <microtop@starion.dk>
# Maintainer: Uffe Jakobsen <microtop@starion.dk>
#
pkgname=opencbm
pkgver=0.4.99.104
pkgrel=1
epoch=
pkgdesc="OpenCBM allows access to Commodore (C64) floppy drives 1540, 1541, 1570, 1571, 1581"
arch=('i686' 'x86_64')
url="https://github.com/OpenCBM/OpenCBM"
license=('GPL-2.0-only')
groups=()
depends=('libusb' 'ncurses')
makedepends=('git' 'cc65')
checkdepends=()
optdepends=()
provides=('opencbm')
conflicts=('opencbm')
replaces=()
backup=('etc/opencbm.conf')
options=()
install=
changelog=
noextract=()
_pkgname=OpenCBM
_pkgver=${pkgver}
_src_dirname=${_pkgname}-${_pkgver}
source=("opencbm.src.tgz::https://github.com/OpenCBM/${_pkgname}/archive/v${_pkgver}.tar.gz")
#        "nibtools.src.tgz::https://github.com/OpenCBM/nibtools/archive/refs/heads/master.tar.gz")
sha256sums=('5499cd1143b4a246d6d7e93b94efbdf31fda0269d939d227ee5bcc0406b5056a')
#            "a96022c26bc0dd175ca0428bc101c5d87bd891569953c06123d75244b775a466")

build_kernel_module=

#
#
#

prepare()
{
  cd "${srcdir}/${_src_dirname}"

  # nibtools
  # not in use - a separate nibtools package exists
  #rmdir opencbm/nibtools
  #ln -s ../../nibtools-master opencbm/nibtools
  # temp hack in order to compile nibtools
  #echo "CFLAGS+=-D_DEFAULT_SOURCE" >> opencbm/nibtools/GNU/Makefile

  # kernel module: add includes to kernel module source
  #sed -i '\!#include <asm/uaccess.h>!s!.*!&\n#include <linux/uaccess.h>\n#include <linux/sched/signal.h>!' opencbm/sys/linux/cbm_module.c
  # kernel module: Makefile is needed later
  sed -i '\!-rm -f Makefile!d' opencbm/sys/linux/LINUX/Makefile
}

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

  CC65_HOME="/usr/share/cc65"
  export CC65_HOME

  #make -s -w -f LINUX/Makefile opencbm plugin
  make -s -w -f LINUX/Makefile opencbm plugin-xum1541 plugin-xu1541

  # kernel module: build (optional)
  if test "x${build_kernel_module}" != "x"; then
    make -s -w -f LINUX/Makefile plugin-xa1541
  fi
}

check()
{
  cd "${srcdir}/${_src_dirname}"
}

package()
{
  cd "${srcdir}/${_src_dirname}"

  mkdir -p "${pkgdir}/etc/udev/rules.d"

  make -s -w -f LINUX/Makefile PREFIX="/usr" MANDIR="/usr/share/man/man1" INFODIR="/usr/share/info" DESTDIR="${pkgdir}/" install install-plugin-xum1541 install-plugin-xu1541

  mv "${pkgdir}/etc/opencbm.conf" "${pkgdir}/etc/opencbm.conf.sample"

  # Don't overwrite ld.so.conf
  rm -f ${pkgdir}/etc/ld.so.conf

  # Remove scary warning from /etc/opencbm.conf and don't install both /etc/opencbm.conf.d/ and opencbm_plugin_helper_tools at all
  ##sed -i "/^;.*/d" ${pkgdir}/etc/opencbm.conf
  ##rm -rf ${pkgdir}/etc/opencbm.conf.d/
  ##rm ${pkgdir}/usr/bin/opencbm_plugin_helper_tools

  # kernel module: build (optional)
  if test "x${build_kernel_module}" != "x"; then
    make -s -w -f LINUX/Makefile PREFIX="/usr" MANDIR="/usr/share/man/man1" INFODIR="/usr/share/info" DESTDIR="${pkgdir}/" install install-plugin-xa1541
    # kernel module: copy and compress
    cp -a "${pkgdir}/lib" "${pkgdir}/usr"
    gzip "${pkgdir}/usr/lib/modules/$(uname -r)/kernel/drivers/char/cbm.ko"
    # kernel module: clean up left overs
    rm -rf "${pkgdir}/lib/modules"
  fi

  # clean up empty dirs
  #rmdir "${pkgdir}/lib"
  #rmdir "${pkgdir}/usr/share/info"
  find "${pkgdir}" -type d -empty -delete
}

#
# EOF
#