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
|
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/pcmcia.eclass,v 1.4 2004/06/23 22:08:30 mr_bones_ Exp $
# pcmcia.eclass - This eclass facilities writing ebuilds for driver packages
# that may need to build against the pcmcia-cs drivers, depending on kernel
# support, pcmcia-cs version installed, etc.
# It also ensures that any fixes need for pcmcia-cs configuration, driver
# compilation, etc can be located in one spot and be consistent among all
# driver packages
# Author - Peter Johanson <latexer@gentoo.org>
# Variables - You may safely use PCMCIA_SOURCE_DIR and PCMCIA_VERSION in ebuilds
# if this information is needed. These will be blank if kernel PCMCIA support
# is detected.
# Functions - pcmcia_src_unpack unpacks and patches as needed the pcmcia-cs
# sources in ${WORKDIR}/${PCMCIA_SOURCE_DIR} and set the two variables.
# pcmcia_configure will configure the pcmcia-cs sources if that is needed
inherit eutils
ECLASS="pcmcia"
INHERITED="$INHERITED $ECLASS"
DESCRIPTION="eclass for drivers that may build against pcmcia-cs"
IUSE="${IUSE} pcmcia"
# Be VERY careful when pumping the PCMCIA_BASE_VERSION. May require remaking some patches, etc
# Ugly, but portage doesn't like more dynamics SRC_URIs.
PCMCIA_BASE_VERSION="pcmcia-cs-3.2.5"
PATCH_TO_3_2_6="pcmcia-cs-3.2.5-3.2.6.diff.gz"
PATCH_TO_3_2_7="pcmcia-cs-3.2.5-3.2.7.diff.gz"
SRC_URI="pcmcia? ( mirror://sourceforge/pcmcia-cs/${PCMCIA_BASE_VERSION}.tar.gz \
http://dev.gentoo.org/~latexer/files/patches/${PCMCIA_BASE_VERSION}-module-init-tools.diff.gz
http://dev.gentoo.org/~latexer/files/patches/${PCMCIA_BASE_VERSION}-SMP-fix.diff.gz
http://dev.gentoo.org/~latexer/files/patches/${PATCH_TO_3_2_6} \
http://dev.gentoo.org/~latexer/files/patches/${PATCH_TO_3_2_7} )"
# This shouldn't be needed, as it fixes pcmcia-cs *compilation* on new benh
# kernel's, but it's here to remind me in case it does become an issue
#ppc? ( http://dev.gentoo.org/~latexer/files/patches/${PCMCIA_BASE_VERSION}-ppc-fix.diff.gz ) )
DEPEND="pcmcia? ( >=sys-apps/${PCMCIA_BASE_VERSION} )"
PCMCIA_SOURCE_DIR="${WORKDIR}/${PCMCIA_BASE_VERSION}"
pcmcia_src_unpack()
{
cd ${WORKDIR}
if use pcmcia ; then
if egrep '^CONFIG_PCMCIA=[ym]' /usr/src/linux/.config >&/dev/null
then
# Sadly, we still need to download these sources in SRC_URI
# til portage can handle more dynamic SRC_URIs
einfo "Kernel PCMCIA detected. Skipping external pcmcia-cs sources."
PCMCIA_VERSION=""
PCMCIA_SOURCE_DIR=""
else
# We unpack the base version, figure out what is installed, then
# patch up to that version. Ugly hack to avoid messy SRC_URIs
unpack ${PCMCIA_BASE_VERSION}.tar.gz
cd ${PCMCIA_SOURCE_DIR}
epatch ${DISTDIR}/${PCMCIA_BASE_VERSION}-module-init-tools.diff.gz
epatch ${DISTDIR}/${PCMCIA_BASE_VERSION}-SMP-fix.diff.gz
PCMCIA_CS_EBUILD=(/var/db/pkg/sys-apps/pcmcia-cs-*/pcmcia-cs-*.ebuild) ## use bash globbing
if [ ! -f "${PCMCIA_CS_EBUILD}" ]; then
die "ERROR: pcmcia-cs ebuild (${PCMCIA_CS_EBUILD}) not found - are you sure pcmcia-cs is installed?"
fi
PCMCIA_CS_VER="${PCMCIA_CS_EBUILD##*/}" ## -> pcmcia-cs-VER.ebuild
PCMCIA_CS_VER="${PCMCIA_CS_VER/pcmcia-cs-/}" ## strip 'pcmcia-cs-'
PCMCIA_CS_VER="${PCMCIA_CS_VER/.ebuild/}" ## strip '.ebuild'
if [ "${PCMCIA_CS_VER/-*/}" = "3.2.7" ]; then
PCMCIA_VERSION=${PCMCIA_CS_VER}
einfo "Using pcmcia-cs-3.2.7"
epatch ${DISTDIR}/${PATCH_3_2_7}
elif [ "${PCMCIA_CS_VER/-*/}" = "3.2.6" ]; then
PCMCIA_VERSION=${PCMCIA_CS_VER}
einfo "Using pcmcia-cs-3.2.6"
epatch ${DISTDIR}/${PATCH_3_2_6}
else
PCMCIA_VERSION="${PCMCIA_BASE_VERSION}"
einfo "Using ${PCMCIA_BASE_VERSION}"
fi
fi
fi
cd ${S}
}
# Call this if you need the package configured for building to work
pcmcia_configure()
{
if use pcmcia ; then
if ! egrep '^CONFIG_PCMCIA=[ym]' /usr/src/linux/.config >&/dev/null
then
cd ${PCMCIA_SOURCE_DIR}
local myarch
# pcmcia-cs expects "i386" not "x86"
case "${ARCH}" in
x86) myarch="i386" ;;
*) myarch="${ARCH}" ;;
esac
#use $CFLAGS for user tools, but standard kernel optimizations for
#the kernel modules (for compatibility)
./Configure -n \
--target=${D} \
--srctree \
--kernel=/usr/src/linux \
--kflags="-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer" \
--arch="${myarch}" \
--uflags="${CFLAGS}" || die "failed configuring pcmcia-cs"
fi
fi
cd ${S}
}
EXPORT_FUNCTIONS src_unpack configure
|