git.iko.soy/typeable/nixpkgs
on master help sign in
uwsgi: the php plugin needs to link with session.so

On NixOS the session.so php extension is a separate package (and not builtin in libphp.so). But since the uwsgi php plugin uses the session mechanisms, we need to link the plugin to that library too. With this change uwsgipluginpy is hacked to take an additional UWSGICONFIG_PHP_LDFLAGS environment variable and add it to its LDFLAGS, and then in the nix expression the UWSGICONFIG_PHP_LDFLAGS is set to point to php.extensions.session

commit87bed6c86aa9abb434b18d4e5e4aa47133eac666 authorДамјан Георгиевски <gdamjan@gmail.com> dateWed 9 Sep 2020, 12:51 (6 years ago) parent6dd858d
3 files changed+27−1
pkgs/servers/uwsgi/additional-php-ldflags.patch+13 pkgs/servers/uwsgi/default.nix+14−1 pkgs/servers/uwsgi/0001-no-ext-session-php_session.h-on-NixOS.patch → pkgs/servers/uwsgi/no-ext-session-php_session.h-on-NixOS.patch
pkgs/servers/uwsgi/additional-php-ldflags.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/plugins/php/uwsgiplugin.py b/plugins/php/uwsgiplugin.py
2+index d930c44e..2fcbc22a 100644
3+--- a/plugins/php/uwsgiplugin.py
4++++ b/plugins/php/uwsgiplugin.py
5+@@ -17,6 +17,8 @@ php_version = os.popen(PHPPATH + ' --version').read().rstrip().split('.')[0]
6+ CFLAGS = [os.popen(PHPPATH + ' --includes').read().rstrip(), '-Wno-sign-compare']
7+ LDFLAGS = os.popen(PHPPATH + ' --ldflags').read().rstrip().split()
8+
9++LDFLAGS.append(os.environ.get('UWSGICONFIG_PHP_LDFLAGS', []))
10++
11+ if ld_run_path:
12+ LDFLAGS.append('-L%s' % ld_run_path)
13+ os.environ['LD_RUN_PATH'] = ld_run_path
pkgs/servers/uwsgi/default.nix+14−1
@@ -65,7 +65,10 @@ stdenv.mkDerivation rec {
6565 sha256 = "0256v72b7zr6ds4srpaawk1px3bp0djdwm239w3wrxpw7dzk1gjn";
6666 };
6767
68− patches = [ ./0001-no-ext-session-php_session.h-on-NixOS.patch ];
68+ patches = [
69+ ./no-ext-session-php_session.h-on-NixOS.patch
70+ ./additional-php-ldflags.patch
71+ ];
6972
7073 nativeBuildInputs = [ python3 pkgconfig ];
7174
@@ -89,6 +92,16 @@ stdenv.mkDerivation rec {
8992 substituteAll ${./nixos.ini} buildconf/nixos.ini
9093 '';
9194
95+ # this is a hack to make the php plugin link with session.so (which on nixos is a separate package)
96+ # the hack works in coordination with ./additional-php-ldflags.patch
97+ UWSGICONFIG_PHP_LDFLAGS = lib.optionalString (builtins.any (x: x.name == "php") needed)
98+ (lib.concatStringsSep "," [
99+ "-Wl"
100+ "-rpath=${php-embed.extensions.session}/lib/php/extensions/"
101+ "--library-path=${php-embed.extensions.session}/lib/php/extensions/"
102+ "-l:session.so"
103+ ]);
104+
92105 buildPhase = ''
93106 mkdir -p $pluginDir
94107 python3 uwsgiconfig.py --build nixos
pkgs/servers/uwsgi/0001-no-ext-session-php_session.h-on-NixOS.patch → pkgs/servers/uwsgi/no-ext-session-php_session.h-on-NixOS.patchrenamed

The content is the same.