aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipw-firmware/Makefile
blob: 15838660d68c5e7254e5beef18ab63664dadf5b3 (plain) (blame)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# New ports collection makefile for:    ipw-firmware
# Date created:             May 11 2005
# Whom:                 Florent Thoumie <flz@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME?=  ipw-firmware
RELNAME?=   ipw2100
PORTVERSION?=   1.3
PORTREVISION?=  10
CATEGORIES= net sysutils kld
MASTER_SITES=   ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= flz/ipw
DISTFILES=  ${RELNAME}-fw-${PORTVERSION}.tgz

MAINTAINER= flz@FreeBSD.org
COMMENT?=   Intel PRO/Wireless 2100 Driver Firmware

DRIVERNAME?=    ipw
DRIVERVERSION?= 1.6.4
DRIVERDISTNAME= ${DRIVERNAME}-freebsd-${DRIVERVERSION}
DISTFILES+= ${DRIVERDISTNAME}.tgz
FIRMWARES?= ${RELNAME}-${PORTVERSION}-i.fw:${DRIVERNAME}-i.fw \
        ${RELNAME}-${PORTVERSION}-p.fw:${DRIVERNAME}-p.fw \
        ${RELNAME}-${PORTVERSION}.fw:${DRIVERNAME}.fw

.include <bsd.port.pre.mk>
 
# Dummy OSVERSION for ipw.
MIN7OSVERSION?= 999999
MAX6OSVERSION?= 700000

# Try to guess sensible defaults.
.if ${OSVERSION} > ${MIN7OSVERSION}
OPTIONS+=   CONTROL "Install ${DRIVERNAME}control(8) utility" off
.else
OPTIONS+=   CONTROL "Install ${DRIVERNAME}control(8) utility" on
.endif

.if ${OSVERSION} > 600023
OPTIONS+=   MODULE  "Install ${DRIVERNAME}(4) kernel module (very old snapshot)" off
.else
OPTIONS+=   MODULE  "Install ${DRIVERNAME}(4) kernel module (very old snapshot)" on
.endif

# Override PREFIX to install ${DRIVERNAME}control(8) somewhere we hope it'll
# be available soon enough.
PREFIX=     /usr

WRKSRC=     ${WRKDIR}
KERNDIR=    /boot/kernel
KMODDIR=    /boot/modules
FWDIR=      /boot/firmware
SUB_FILES=  pkg-message
SUB_LIST=   DRIVERNAME="${DRIVERNAME}" \
        RELNAME="${RELNAME}" \
        KMODDIR="${KMODDIR}" \
        FWDIR="${FWDIR}"
PLIST_SUB:= ${SUB_LIST}
MAKE_ENV=   BINDIR="${PREFIX}/sbin" \
        MANDIR="${PREFIX}/share/man/man" \
        KMODDIR="${KMODDIR}"

MANCOMPRESSED=  yes

.if !defined(PACKAGE_BUILDING)
IS_INTERACTIVE= yes
.endif

# That's a bit arbitrary since I have no idea if ${DRIVERNAME}(4) can be
# compiled on FreeBSD previous to 5.3-RELEASE. This is just too old, people
# should move on. I may change this if I get successful reports though.
# Comment this IGNORE line if you want to test it anyway.
.if ${OSVERSION} < 503000
IGNORE=     needs at least FreeBSD 5.3-RELEASE
.endif

.if ( ${OSVERSION} >= 700014 || ( ${OSVERSION} < 700000 && ${OSVERSION} >= ${MAX6OSVERSION} ) )
IGNORE=     is now obsolete, install net/${DRIVERNAME}-firmware-kmod instead
.endif


.if ${OSVERSION} > ${MIN7OSVERSION}
SUB_LIST+=  DONT_NEED_CONTROL="@comment "
MTREE_DIRRM=    "@comment "
. if !defined(WITHOUT_CONTROL)
IGNORE=     is configured with ${DRIVERNAME}control(8) which you don't need, use 'make rmconfig' and uncheck CONTROL
. endif
.else
SUB_LIST+=  DONT_NEED_CONTROL=""
MTREE_DIRRM=    ""
MAN8+=      ${DRIVERNAME}control.8
USE_RCORDER=    ${DRIVERNAME}.sh
.endif

# Hack because ipw(4) and iwi(4) behavior are not in sync: as of 20/01/2006,
# iwi(4) loads firmware from /boot/firmware, but ipw(4) does not). Hopefully,
# sam or mlaier will commit generic firmware loading support and new firmware
# ports will be created once ipw(4) and iwi(4) have been patched to use it.
.if ${DRIVERNAME} == "ipw" && ${OSVERSION} > 700006
MTREE_DIRRM=    "@comment "
.endif

PLIST_SUB+= MTREE_DIRRM=${MTREE_DIRRM}

.if defined(WITH_MODULE)
. if ${OSVERSION} > 600023
IGNORE=     is configured with ${DRIVERNAME}(4) support which you don't need, use 'make rmconfig' and uncheck MODULE
. else
PLIST_SUB+= WITH_MODULE=""
MAN4+=      ${DRIVERNAME}.4
. endif
.else
PLIST_SUB+= WITH_MODULE="@comment MODULE "
.endif

.if !defined(WITHOUT_CONTROL)
PLIST_SUB+= WITH_CONTROL=""
.else
PLIST_SUB+= WITH_CONTROL="@comment CONTROL "
.endif

# "Might" because people still can include ${DRIVERNAME}(4) support in kernel by extracting
# its source in src/ and tweaking src/sys/conf/files.
.if ${OSVERSION} <= 600023 && !exists(${KERNDIR}/if_${DRIVERNAME}.ko) && !defined(WITH_MODULE)
SUB_LIST+=  MIGHT_NEED_MODULE=""
.else
SUB_LIST+=  MIGHT_NEED_MODULE="@comment "
.endif

do-build:
.if defined(WITH_MODULE)
. for i in share sys
    cd ${WRKSRC}/${DRIVERDISTNAME}/src/${i}; make all
. endfor
.endif
.if !defined(WITHOUT_CONTROL)
    cd ${WRKSRC}/${DRIVERDISTNAME}/src/usr.sbin/${DRIVERNAME}control/; make all
.endif

do-install:
.if !defined(PACKAGE_BUILDING)
# Let pointyhat build the package, anyway the user will have to agree with license
# terms to install the port/package.
    ${SH} ${PKGREQ} ${PORTNAME} INSTALL
.endif
.if defined(WITH_MODULE)
. for i in share sys
    cd ${WRKSRC}/${DRIVERDISTNAME}/src/${i}; make install ${MAKE_ENV}
. endfor
.endif
.if !defined(WITHOUT_CONTROL)
    cd ${WRKSRC}/${DRIVERDISTNAME}/src/usr.sbin/${DRIVERNAME}control/; make install ${MAKE_ENV}
.endif
    ${MKDIR} ${FWDIR}
    ${INSTALL_DATA} ${WRKSRC}/LICENSE ${FWDIR}/LICENSE.${DRIVERNAME}
.for i in ${FIRMWARES}
    ${INSTALL_KLD} ${WRKSRC}/${i:C/:.*//} ${FWDIR}/${i:C/.*://}
.endfor

post-install:
    @${CAT} ${PKGMESSAGE}
.if defined(WITH_MODULE)
    @${ECHO_CMD} "You asked for ${DRIVERNAME}(4) module to be installed but"
    @${ECHO_CMD} "be aware that this is a *very* *old* snapshot of the code"
    @${ECHO_CMD} "and that it probably won't work correctly."
    @${ECHO_CMD} "This option will probably go away in a near future."
    @${ECHO_CMD} "SLIPPERY WHEN WET ! BEWARE OF THE DOGS !"
    @${ECHO_CMD} "You have been warned."
.endif


.include <bsd.port.post.mk>