summaryrefslogtreecommitdiff
blob: 07a15f575b092af04ba5540b4651398b378c70e0 (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
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
175
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

# EAPI Version
EAPI="5"

#//------------------------------------------------------------------------------

# Version Data
GITDATE="20160123"			# Date of diff between kernel.org and lmo GIT
GENPATCHREV="2"				# Tarball revision for patches

# Directories
S="${WORKDIR}/linux-${OKV}-${GITDATE}"
MIPS_PATCHES="${WORKDIR}/mips-patches"

# Kernel-2 Vars
K_SECURITY_UNSUPPORTED="yes"
K_NOUSENAME="yes"
K_NOSETEXTRAVERSION="yes"
K_NOUSEPR="yes"
K_BASE_VER="4.3"
K_FROM_GIT="yes"
ETYPE="sources"

# Inherit Eclasses
inherit kernel-2 eutils
detect_version

# EPATCH Vars
# XXX: Required to properly apply Impact/Odyssey driver patches.
EPATCH_OPTS="-F3"

# Version Data
F_KV="${PVR}"
BASE_KV="$(get_version_component_range 1-2).0"
[[ "${EXTRAVERSION}" = -rc* ]] && KVE="${EXTRAVERSION}"

# Portage Vars
HOMEPAGE="http://www.linux-mips.org/ http://www.gentoo.org/"
KEYWORDS="-* ~mips"
IUSE="experimental ip27 ip28 ip30"
RDEPEND=""
DEPEND="${RDEPEND}
	>=sys-devel/gcc-4.7.0
	>=sys-devel/patch-2.7.4"

# Specify any patches or patch familes to NOT apply here.
# Use only the 4-digit number followed by a '*'.
P_EXCLUDE=""

# Machine Support Control Variables
DO_IP22="test"				# If "yes", enable IP22 support		(SGI Indy, Indigo2 R4x00)
DO_IP27="yes"				# 		   IP27 support		(SGI Origin)
DO_IP28="test"				# 		   IP28 support		(SGI Indigo2 Impact R10000)
DO_IP30="yes"				# 		   IP30 support		(SGI Octane)
DO_IP32="yes"				# 		   IP32 support		(SGI O2, R5000/RM5200 Only)

# Machine Stable Version Variables
SV_IP22=""				# If set && DO_IP22 == "no", indicates last "good" IP22 version
SV_IP27=""				# 	    DO_IP27 == "no", 			   IP27
SV_IP28=""				# 	    DO_IP28 == "no", 			   IP28
SV_IP30=""				# 	    DO_IP30 == "no", 			   IP30
SV_IP32=""				# 	    DO_IP32 == "no", 			   IP32

DESCRIPTION="Linux-Mips GIT sources for MIPS-based machines, dated ${GITDATE}"
SRC_URI="${KERNEL_URI}
	 mirror://gentoo/mipsgit-${BASE_KV}${KVE}-${GITDATE}.diff.xz
	 mirror://gentoo/${PN}-${BASE_KV}-patches-v${GENPATCHREV}.tar.xz"

UNIPATCH_STRICTORDER="yes"
UNIPATCH_LIST="${DISTDIR}/mipsgit-${BASE_KV}${KVE}-${GITDATE}.diff.xz"

#//------------------------------------------------------------------------------

# Eblit Handling Functions
#
# They'll likely be superseded someday by better ideas, possibly elibs.

# eblit-core
# Usage: <function> [version]
# Main eblit engine
eblit-core() {
	local e v func=$1 ver=$2
	for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
		e="${FILESDIR}/eblits/${func}${v}.eblit"
		if [[ -e ${e} ]] ; then
			. "${e}"
			[[ ${func} == pkg_* ]] && eval "${func}() { eblit-run ${func} ${ver} ; }"
			return 0
		fi
	done
	return 1
}

# eblit-include
# Usage: [--skip] <function> [version]
# Includes an "eblit" -- a chunk of common code among ebuilds in a given
# package so that its functions can be sourced and utilized within the
# ebuild.
eblit-include() {
	local skipable=false r=0
	[[ $1 == "--skip" ]] && skipable=true && shift
	[[ $1 == pkg_* ]] && skipable=true

	[[ -z $1 ]] && die "Usage: eblit-include <function> [version]"
	eblit-core $1 $2
	r="$?"
	${skipable} && return 0
	[[ "$r" -gt "0" ]] && die "Could not locate requested eblit '$1' in ${FILESDIR}/eblits/"
}

# eblit-run-maybe
# Usage: <function>
# Runs a function if it is defined in an eblit
eblit-run-maybe() {
	[[ $(type -t "$@") == "function" ]] && "$@"
}

# eblit-run
# Usage: <function> [version]
# Runs a function defined in an eblit
eblit-run() {
	eblit-include --skip common "${*:2}"
	eblit-include "$@"
	eblit-run-maybe eblit-$1-pre
	eblit-${PN}-$1
	eblit-run-maybe eblit-$1-post
}

# eblit-pkg
# Usage: <phase> [version]
# Runs the pkg_* functions AND evals them so they're included in the binpkgs
eblit-pkg() {
	[[ -z $1 ]] && die "Usage: eblit-pkg <phase> [version]"
	eblit-core pkg_$1 $2
}

#//------------------------------------------------------------------------------

load_eblit_funcs() {
	# This is a sanity check to avoid QA issues.  It prevents
	# eblits from being referenced during metadata operations.
	[ -n "${MIPS_SOURCES_EBLITS_LOADED}" ] && return

	# All are in ${FILESDIR}/eblits
	# If a message for a given machine needs to change,
	# then we create a new eblit and increment the
	# version and reference it here.
	eblit-include err_disabled_mach v1
	eblit-include err_only_one_mach_allowed v1
	eblit-include show_ip22_info v3
	eblit-include show_ip27_info v4
	eblit-include show_ip28_info v1
	eblit-include show_ip30_info v5
	eblit-include show_ip32_info v5

	# This makes sure pkg_setup & pkg_postinst gets into any binpkg.
	# Neccessary because we can't guarantee FILESDIR is around for binpkgs.
	eblit-pkg setup v2
	eblit-pkg postinst v2

	# Eblit load complete
	MIPS_SOURCES_EBLITS_LOADED=1
}

pkg_setup() {
	load_eblit_funcs
	pkg_setup
}

src_unpack() { eblit-run src_unpack v7 ; }

#//------------------------------------------------------------------------------