summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: be0851131baddd66cc9fef5ea39fd5e7037f4cbc (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Original maintainer Alex Talker < Alextalker at openmailbox dot com >
# Support Maintainer Filip Brcic < brcha at gna dot org >
# Contributor bitwave < aur [at] oomlu [d0t] de >
# Alex say thanks to Filip about support this package while he was away from Arch.
pkgname=(scst scst_local iscsi-scst scstadmin)
pkgver=3.2.0.7211
pkgrel=1
pkgdesc="Generic SCSI Target Subsystem For Linux"
arch=('i686' 'x86_64')
url="http://scst.sourceforge.net"
license=('GPL')
install=${pkgname}.install
makedepends=('linux' 'linux-headers')
source=(
# use SVN version so we succeeded with latest kernel
    "scst-svn-7211-branches-3.2.x.zip:https://sourceforge.net/code-snapshots/svn/s/sc/scst/svn/scst-svn-7211-branches-3.2.x.zip"
#    "scst-${pkgver}.tar.bz2::https://sourceforge.net/projects/scst/files/scst-${pkgver}.tar.bz2/download"
)
md5sums=(
    'SKIP'
)

_base() {
  cd $(find "$srcdir" -maxdepth 1 -type d -name 'scst*')

  # Fix problem with scstadmin
  unset PERL_MM_OPT

  export KVER=$(uname -r)
  export KVERSION=$(uname -r)
  export PREFIX="/usr"
  export MANDIR=/usr/share/man
}

_package_module() {
  msg "Package module $1..."

  _base
  export DESTDIR="$pkgdir"

  make -C "$1" INSTALL_MOD_PATH="$pkgdir" install

  shopt -s nullglob
  _mod_dir="$pkgdir"/lib/modules/"$KVER"
  # Clean up conflict files
  for f in "$_mod_dir"/modules.*; do
      rm "$f"
  done

  # Resolve symlink
  if [[ -d "$pkgdir"/lib ]]; then
      mkdir -p "$pkgdir"/usr/lib
      mv -v "$pkgdir"/lib/* "$pkgdir"/usr/lib/
      rm -rf "$pkgdir"/lib
  fi

  # Resolve sbin
  if [[ -d "$pkgdir"/usr/sbin ]]; then
      mkdir -p "$pkgdir"/usr/bin
      mv "$pkgdir"/usr/sbin/* "$pkgdir"/usr/bin/
      rm -rf "$pkgdir"/usr/sbin
  fi

  msg "Done with packaging module $1"
}

prepare() {
    cd $(find "$srcdir" -maxdepth 1 -type d -name 'scst*')

#    patch -Np0 -i "$srcdir/queue.patch"
}

build() {
    msg "Build package..."

    _base

    # Fix problems with linux-headers package
    # (rdma headers is missing)
#    _kern_inc=("$srcdir"/linux-*/include/)
#    cp -r "$_kern_inc/rdma" "scst/include"
    #export CFLAGS="$CFLAGS -I'$_kern_inc'"

    for d in scst scst_local iscsi-scst; do
        make -C "$d" 2release
        make -C "$d"
    done

    # Fix issue with man pages
    export MANDIR="$pkgdir"/usr/man
    make -C scstadmin

    msg "Done building"
}

package_scst() {
    pkgdesc="Generic SCSI Target Subsystem For Linux"
    depends=()

    _package_module scst
}

package_scst_local() {
    pkgdesc="Driver for support of local targets in SCST"
    depends=('scst')

    _package_module scst_local
}

package_iscsi-scst() {
    pkgdesc="Driver & daemon for support iSCSI in SCST"
    depends=('scst')

    _package_module iscsi-scst
}

package_scstadmin() {
    pkgdesc="Administration utilit for SCST"
    depends=('perl')

    msg "Package scstadmin util..."

    _base
    export DESTDIR="$pkgdir"

    # Resolve path to install man pages
    # and move script from sbin to bin
    export MANDIR="$pkgdir"/usr/share/man

    make -C scstadmin install_vendor
    mkdir -p "$pkgdir"/usr/bin
    mv "$pkgdir"/usr/sbin/* "$pkgdir"/usr/bin
    rm -rf "$pkgdir"/usr/sbin

    msg "Done with packaging scstadmin"
}