/[gentoo-alt]/trunk/prefix/eclass/pcmcia.eclass
Gentoo

Contents of /trunk/prefix/eclass/pcmcia.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (show annotations) (download)
Thu Feb 2 04:20:17 2006 UTC (13 years, 2 months ago) by kito
File size: 4772 byte(s)
Initial eclass import from gentoo-x86
1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/pcmcia.eclass,v 1.10 2005/08/23 14:55:11 swegener Exp $
4
5 # pcmcia.eclass - This eclass facilities writing ebuilds for driver packages
6 # that may need to build against the pcmcia-cs drivers, depending on kernel
7 # support, pcmcia-cs version installed, etc.
8
9 # It also ensures that any fixes need for pcmcia-cs configuration, driver
10 # compilation, etc can be located in one spot and be consistent among all
11 # driver packages
12
13 # Author - Peter Johanson <latexer@gentoo.org>
14
15 # Variables - You may safely use PCMCIA_SOURCE_DIR and PCMCIA_VERSION in ebuilds
16 # if this information is needed. These will be blank if kernel PCMCIA support
17 # is detected.
18
19 # Functions - pcmcia_src_unpack unpacks and patches as needed the pcmcia-cs
20 # sources in ${WORKDIR}/${PCMCIA_SOURCE_DIR} and set the two variables.
21
22 # pcmcia_configure will configure the pcmcia-cs sources if that is needed
23
24 inherit eutils
25
26 DESCRIPTION="eclass for drivers that may build against pcmcia-cs"
27 IUSE="pcmcia"
28
29 # Be VERY careful when pumping the PCMCIA_BASE_VERSION. May require remaking some patches, etc
30 # Ugly, but portage doesn't like more dynamics SRC_URIs.
31
32 PCMCIA_BASE_VERSION="pcmcia-cs-3.2.5"
33 PATCH_TO_3_2_6="pcmcia-cs-3.2.5-3.2.6.diff.gz"
34 PATCH_TO_3_2_7="pcmcia-cs-3.2.5-3.2.7.diff.gz"
35
36 SRC_URI="pcmcia? ( mirror://sourceforge/pcmcia-cs/${PCMCIA_BASE_VERSION}.tar.gz \
37 http://dev.gentoo.org/~latexer/files/patches/${PCMCIA_BASE_VERSION}-module-init-tools.diff.gz
38 http://dev.gentoo.org/~latexer/files/patches/${PCMCIA_BASE_VERSION}-SMP-fix.diff.gz
39 http://dev.gentoo.org/~latexer/files/patches/${PATCH_TO_3_2_6} \
40 http://dev.gentoo.org/~latexer/files/patches/${PATCH_TO_3_2_7} )"
41
42 # This shouldn't be needed, as it fixes pcmcia-cs *compilation* on new benh
43 # kernel's, but it's here to remind me in case it does become an issue
44 #ppc? ( http://dev.gentoo.org/~latexer/files/patches/${PCMCIA_BASE_VERSION}-ppc-fix.diff.gz ) )
45
46 DEPEND="pcmcia? ( >=sys-apps/${PCMCIA_BASE_VERSION} )"
47
48 pcmcia_src_unpack() {
49 # So while the two eclasses exist side-by-side and also the ebuilds inherit
50 # both we need to check for PCMCIA_SOURCE_DIR, and if we find it, then we
51 # bail out and assume pcmcia.eclass is working on it.
52 [[ -n ${PCMCIA_SOURCE_DIR} ]] && return 1
53
54 cd ${WORKDIR}
55 if use pcmcia ; then
56 if egrep '^CONFIG_PCMCIA=[ym]' /usr/src/linux/.config >&/dev/null
57 then
58 # Sadly, we still need to download these sources in SRC_URI
59 # til portage can handle more dynamic SRC_URIs
60 einfo "Kernel PCMCIA detected. Skipping external pcmcia-cs sources."
61 PCMCIA_VERSION=""
62 PCMCIA_SOURCE_DIR=""
63 else
64 PCMCIA_SOURCE_DIR="${WORKDIR}/${PCMCIA_BASE_VERSION}"
65
66 # We unpack the base version, figure out what is installed, then
67 # patch up to that version. Ugly hack to avoid messy SRC_URIs
68 unpack ${PCMCIA_BASE_VERSION}.tar.gz
69 cd ${PCMCIA_SOURCE_DIR}
70 epatch ${DISTDIR}/${PCMCIA_BASE_VERSION}-module-init-tools.diff.gz
71 epatch ${DISTDIR}/${PCMCIA_BASE_VERSION}-SMP-fix.diff.gz
72 PCMCIA_CS_EBUILD=(/var/db/pkg/sys-apps/pcmcia-cs-*/pcmcia-cs-*.ebuild) ## use bash globbing
73 if [ ! -f "${PCMCIA_CS_EBUILD}" ]; then
74 die "ERROR: pcmcia-cs ebuild (${PCMCIA_CS_EBUILD}) not found - are you sure pcmcia-cs is installed?"
75 fi
76 PCMCIA_CS_VER="${PCMCIA_CS_EBUILD##*/}" ## -> pcmcia-cs-VER.ebuild
77 PCMCIA_CS_VER="${PCMCIA_CS_VER/pcmcia-cs-/}" ## strip 'pcmcia-cs-'
78 PCMCIA_CS_VER="${PCMCIA_CS_VER/.ebuild/}" ## strip '.ebuild'
79 if [ "${PCMCIA_CS_VER/-*/}" = "3.2.7" ]; then
80 PCMCIA_VERSION=${PCMCIA_CS_VER}
81 einfo "Using pcmcia-cs-3.2.7"
82 epatch ${DISTDIR}/${PATCH_3_2_7}
83 elif [ "${PCMCIA_CS_VER/-*/}" = "3.2.6" ]; then
84 PCMCIA_VERSION=${PCMCIA_CS_VER}
85 einfo "Using pcmcia-cs-3.2.6"
86 epatch ${DISTDIR}/${PATCH_3_2_6}
87 else
88 PCMCIA_VERSION="${PCMCIA_BASE_VERSION}"
89 einfo "Using ${PCMCIA_BASE_VERSION}"
90 fi
91 fi
92 fi
93 cd ${S}
94 }
95
96 # Call this if you need the package configured for building to work
97 pcmcia_configure()
98 {
99 if use pcmcia ; then
100 if ! egrep '^CONFIG_PCMCIA=[ym]' /usr/src/linux/.config >&/dev/null
101 then
102 cd ${PCMCIA_SOURCE_DIR}
103 local myarch
104
105 # pcmcia-cs expects "i386" not "x86"
106 case "${ARCH}" in
107 x86) myarch="i386" ;;
108 *) myarch="${ARCH}" ;;
109 esac
110
111 #use $CFLAGS for user tools, but standard kernel optimizations for
112 #the kernel modules (for compatibility)
113 ./Configure -n \
114 --target=${D} \
115 --srctree \
116 --kernel=/usr/src/linux \
117 --kflags="-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer" \
118 --arch="${myarch}" \
119 --uflags="${CFLAGS}" || die "failed configuring pcmcia-cs"
120 fi
121 fi
122 cd ${S}
123 }
124
125 EXPORT_FUNCTIONS src_unpack configure

  ViewVC Help
Powered by ViewVC 1.1.20