Merge pull request #136009 from angustrau/pygame-2.0.2-dev

This commit is contained in:
Sandro
2021-11-08 16:14:07 +01:00
committed by GitHub
5 changed files with 42 additions and 37 deletions

View File

@@ -1,15 +1,17 @@
{ stdenv, lib, substituteAll, fetchPypi, buildPythonPackage, python, pkg-config, libX11
{ stdenv, lib, substituteAll, fetchFromGitHub, buildPythonPackage, python, pkg-config, libX11
, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, libpng, libjpeg, portmidi, freetype, fontconfig
, AppKit, CoreMIDI
, AppKit
}:
buildPythonPackage rec {
pname = "pygame";
version = "2.0.1";
version = "2.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "8b1e7b63f47aafcdd8849933b206778747ef1802bd3d526aca45ed77141e4001";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = version;
sha256 = "GrfNaowlD2L5umiFwj7DgtHGBg9a4WVfe3RlMjK3ElU=";
};
patches = [
@@ -41,11 +43,11 @@ buildPythonPackage rec {
SDL2 SDL2_image SDL2_mixer SDL2_ttf libpng libjpeg
portmidi libX11 freetype
] ++ lib.optionals stdenv.isDarwin [
AppKit CoreMIDI
AppKit
];
preConfigure = ''
LOCALBASE=/ ${python.interpreter} buildconfig/config.py
${python.interpreter} buildconfig/config.py
'';
checkPhase = ''

View File

@@ -1,29 +1,13 @@
diff --git a/buildconfig/config_darwin.py b/buildconfig/config_darwin.py
index 8d84683f..70df8f9c 100644
index c785e183..37d5cea4 100644
--- a/buildconfig/config_darwin.py
+++ b/buildconfig/config_darwin.py
@@ -56,10 +56,10 @@ class Dependency:
class FrameworkDependency(Dependency):
def configure(self, incdirs, libdirs):
BASE_DIRS = '/', os.path.expanduser('~/'), '/System/'
- for n in BASE_DIRS:
+ for n in incdirs + libdirs:
n += 'Library/Frameworks/'
fmwk = n + self.libs + '.framework/Versions/Current/'
- if os.path.isfile(fmwk + self.libs):
+ if os.path.isfile(fmwk + self.libs + '.tbd'):
print ('Framework ' + self.libs + ' found')
self.found = 1
self.inc_dir = fmwk + 'Headers'
@@ -158,19 +158,8 @@ def main(sdl2=False):
@@ -146,16 +146,8 @@ def main():
])
print ('Hunting dependencies...')
- incdirs = ['/usr/local/include']
- if sdl2:
- incdirs.append('/usr/local/include/SDL2')
- else:
- incdirs.append('/usr/local/include/SDL')
- incdirs = ['/usr/local/include', '/opt/homebrew/include']
- incdirs.extend(['/usr/local/include/SDL2', '/opt/homebrew/include/SDL2', '/opt/local/include/SDL2'])
-
- incdirs.extend([
- #'/usr/X11/include',
@@ -31,17 +15,17 @@ index 8d84683f..70df8f9c 100644
- '/opt/local/include/freetype2/freetype']
- )
- #libdirs = ['/usr/local/lib', '/usr/X11/lib', '/opt/local/lib']
- libdirs = ['/usr/local/lib', '/opt/local/lib']
- libdirs = ['/usr/local/lib', '/opt/local/lib', '/opt/homebrew/lib']
+ incdirs = @buildinputs_include@
+ libdirs = @buildinputs_lib@
for d in DEPS:
if isinstance(d, (list, tuple)):
diff --git a/buildconfig/config_unix.py b/buildconfig/config_unix.py
index f6a4ea4b..f7f5be76 100644
index 5c50bcdc..2fd69e2d 100644
--- a/buildconfig/config_unix.py
+++ b/buildconfig/config_unix.py
@@ -224,18 +224,8 @@ def main(sdl2=False):
@@ -210,18 +210,8 @@ def main():
if not DEPS[0].found:
raise RuntimeError('Unable to run "sdl-config". Please make sure a development version of SDL is installed.')

View File

@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, alsa-lib, libjack2, ncurses, pkg-config }:
{ lib, stdenv, fetchurl, alsa-lib, libjack2, CoreAudio, ncurses, pkg-config }:
stdenv.mkDerivation rec {
pname = "timidity";
@@ -12,9 +12,24 @@ stdenv.mkDerivation rec {
patches = [ ./timidity-iA-Oj.patch ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ alsa-lib libjack2 ncurses ];
buildInputs = [
libjack2
ncurses
] ++ lib.optionals stdenv.isLinux [
alsa-lib
] ++ lib.optionals stdenv.isDarwin [
CoreAudio
];
configureFlags = [ "--enable-audio=oss,alsa,jack" "--enable-alsaseq" "--with-default-output=alsa" "--enable-ncurses" ];
configureFlags = [
"--enable-ncurses"
] ++ lib.optionals stdenv.isLinux [
"--enable-audio=oss,alsa,jack"
"--enable-alsaseq"
"--with-default-output=alsa"
] ++ lib.optionals stdenv.isDarwin [
"--enable-audio=darwin,jack"
];
NIX_LDFLAGS = "-ljack -L${libjack2}/lib";
@@ -29,12 +44,14 @@ stdenv.mkDerivation rec {
cp ${./timidity.cfg} $out/share/timidity/timidity.cfg
tar --strip-components=1 -xf $instruments -C $out/share/timidity/
'';
# This fixup step is unnecessary and fails on Darwin
dontRewriteSymlinks = stdenv.isDarwin;
meta = with lib; {
homepage = "https://sourceforge.net/projects/timidity/";
license = licenses.gpl2;
description = "A software MIDI renderer";
maintainers = [ maintainers.marcweber ];
platforms = platforms.linux;
platforms = platforms.unix;
};
}

View File

@@ -28343,7 +28343,9 @@ with pkgs;
timg = callPackage ../tools/graphics/timg { };
timidity = callPackage ../tools/misc/timidity { };
timidity = callPackage ../tools/misc/timidity {
inherit (darwin.apple_sdk.frameworks) CoreAudio;
};
tint2 = callPackage ../applications/misc/tint2 { };

View File

@@ -6419,7 +6419,7 @@ in {
pygal = callPackage ../development/python-modules/pygal { };
pygame = callPackage ../development/python-modules/pygame {
inherit (pkgs.darwin.apple_sdk.frameworks) AppKit CoreMIDI;
inherit (pkgs.darwin.apple_sdk.frameworks) AppKit;
};
pygame_sdl2 = callPackage ../development/python-modules/pygame_sdl2 { };