media-libs/libsdl2: amd64 stable wrt bug #646364
[gentoo.git] / media-libs / libsdl2 / libsdl2-2.0.8-r1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit autotools flag-o-matic ltprune toolchain-funcs multilib-minimal
6
7 MY_P="SDL2-${PV}"
8 DESCRIPTION="Simple Direct Media Layer"
9 HOMEPAGE="http://www.libsdl.org"
10 SRC_URI="http://www.libsdl.org/release/${MY_P}.tar.gz"
11
12 LICENSE="ZLIB"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~ppc ~ppc64 ~sparc x86"
15
16 IUSE="cpu_flags_x86_3dnow alsa altivec custom-cflags dbus gles haptic libsamplerate +joystick cpu_flags_x86_mmx nas opengl oss pulseaudio +sound cpu_flags_x86_sse cpu_flags_x86_sse2 static-libs +threads tslib udev +video wayland X xinerama xscreensaver"
17 REQUIRED_USE="
18         alsa? ( sound )
19         gles? ( video )
20         nas? ( sound )
21         opengl? ( video )
22         pulseaudio? ( sound )
23         wayland? ( gles )
24         xinerama? ( X )
25         xscreensaver? ( X )"
26
27 RDEPEND="
28         alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
29         dbus? ( >=sys-apps/dbus-1.6.18-r1[${MULTILIB_USEDEP}] )
30         gles? ( >=media-libs/mesa-9.1.6[${MULTILIB_USEDEP},gles2] )
31         libsamplerate? ( media-libs/libsamplerate[${MULTILIB_USEDEP}] )
32         nas? (
33                 >=media-libs/nas-1.9.4[${MULTILIB_USEDEP}]
34                 >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}] )
35         opengl? (
36                 >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}]
37                 >=virtual/glu-9.0-r1[${MULTILIB_USEDEP}]
38         )
39         pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
40         tslib? ( >=x11-libs/tslib-1.0-r3[${MULTILIB_USEDEP}] )
41         udev? ( >=virtual/libudev-208:=[${MULTILIB_USEDEP}] )
42         wayland? (
43                 >=dev-libs/wayland-1.0.6[${MULTILIB_USEDEP}]
44                 >=media-libs/mesa-9.1.6[${MULTILIB_USEDEP},egl,gles2,wayland]
45                 >=x11-libs/libxkbcommon-0.2.0[${MULTILIB_USEDEP}]
46         )
47         X? (
48                 >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
49                 >=x11-libs/libXcursor-1.1.14[${MULTILIB_USEDEP}]
50                 >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
51                 >=x11-libs/libXi-1.7.2[${MULTILIB_USEDEP}]
52                 >=x11-libs/libXrandr-1.4.2[${MULTILIB_USEDEP}]
53                 >=x11-libs/libXxf86vm-1.1.3[${MULTILIB_USEDEP}]
54                 xinerama? ( >=x11-libs/libXinerama-1.1.3[${MULTILIB_USEDEP}] )
55                 xscreensaver? ( >=x11-libs/libXScrnSaver-1.2.2-r1[${MULTILIB_USEDEP}] )
56         )"
57 DEPEND="${RDEPEND}
58         X? (
59                 >=x11-proto/xextproto-7.2.1-r1[${MULTILIB_USEDEP}]
60                 >=x11-proto/xproto-7.0.24[${MULTILIB_USEDEP}]
61         )
62         virtual/pkgconfig"
63
64 MULTILIB_WRAPPED_HEADERS=(
65         /usr/include/SDL2/SDL_config.h
66 )
67
68 PATCHES=(
69         # https://bugzilla.libsdl.org/show_bug.cgi?id=1431
70         "${FILESDIR}"/${PN}-2.0.6-static-libs.patch
71 )
72
73 S="${WORKDIR}/${MY_P}"
74
75 src_prepare() {
76         default
77         sed -i -e 's/configure.in/configure.ac/' Makefile.in || die
78         mv configure.{in,ac} || die
79         AT_M4DIR="/usr/share/aclocal acinclude" eautoreconf
80 }
81
82 multilib_src_configure() {
83         use custom-cflags || strip-flags
84
85         # sorted by `./configure --help`
86         local myeconfargs=(
87                 $(use_enable static-libs static)
88                 --enable-atomic
89                 $(use_enable sound audio)
90                 $(use_enable video)
91                 --enable-render
92                 --enable-events
93                 $(use_enable joystick)
94                 $(use_enable haptic)
95                 --enable-power
96                 --enable-filesystem
97                 $(use_enable threads)
98                 --enable-timers
99                 --enable-file
100                 $(use_enable kernel_Winnt loadso)
101                 --enable-cpuinfo
102                 --enable-assembly
103                 $(use_enable cpu_flags_x86_sse ssemath)
104                 $(use_enable cpu_flags_x86_mmx mmx)
105                 $(use_enable cpu_flags_x86_3dnow 3dnow)
106                 $(use_enable cpu_flags_x86_sse sse)
107                 $(use_enable cpu_flags_x86_sse2 sse2)
108                 $(use_enable altivec)
109                 $(use_enable oss)
110                 $(use_enable alsa)
111                 --disable-alsa-shared
112                 --disable-esd
113                 $(use_enable pulseaudio)
114                 --disable-pulseaudio-shared
115                 --disable-arts
116                 $(use_enable libsamplerate)
117                 $(use_enable nas)
118                 --disable-nas-shared
119                 --disable-sndio
120                 --disable-sndio-shared
121                 $(use_enable sound diskaudio)
122                 $(use_enable sound dummyaudio)
123                 $(use_enable wayland video-wayland)
124                 --disable-wayland-shared
125                 --disable-video-mir
126                 $(use_enable X video-x11)
127                 --disable-x11-shared
128                 $(use_enable X video-x11-xcursor)
129                 $(use_enable X video-x11-xdbe)
130                 $(use_enable xinerama video-x11-xinerama)
131                 $(use_enable X video-x11-xinput)
132                 $(use_enable X video-x11-xrandr)
133                 $(use_enable xscreensaver video-x11-scrnsaver)
134                 $(use_enable X video-x11-xshape)
135                 $(use_enable X video-x11-vm)
136                 --disable-video-cocoa
137                 --disable-video-directfb
138                 --disable-fusionsound
139                 --disable-fusionsound-shared
140                 $(use_enable video video-dummy)
141                 $(use_enable opengl video-opengl)
142                 --disable-video-opengles1
143                 $(use_enable gles video-opengles2)
144                 --disable-video-vulkan
145                 $(use_enable udev libudev)
146                 $(use_enable dbus)
147                 --disable-ibus
148                 $(use_enable tslib input-tslib)
149                 --disable-directx
150                 --disable-rpath
151                 --disable-render-d3d
152                 $(use_with X x)
153         )
154
155         ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
156 }
157
158 multilib_src_compile() {
159         emake V=1
160 }
161
162 multilib_src_install() {
163         emake DESTDIR="${D}" install
164 }
165
166 multilib_src_install_all() {
167         prune_libtool_files
168         dodoc {BUGS,CREDITS,README,README-SDL,TODO,WhatsNew}.txt docs/README*.md
169 }