Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libxml2: add enableStatic argument #42380

Merged
merged 1 commit into from Jun 24, 2018
Merged

Conversation

nlewo
Copy link
Member

@nlewo nlewo commented Jun 22, 2018

libxml2Static is built by overriding the enableStatic attribute of
libxml2.

Motivation for this change

Bring static version

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@nlewo
Copy link
Member Author

nlewo commented Jun 22, 2018

cc @orivej @matthewbauer @xeji
I've tryied to follow recommendations that emerged from #41935.

@@ -10708,6 +10708,10 @@ with pkgs;
'';
};

libxml2Static = appendToName "static" (libxml2.override {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to leave this out of all-packages.nix and just have people override it in their own configs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we typically build only a single version of a package.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libxml2Static

Partial log (click to expand)

checking for references to /build in /nix/store/gjavhbvx1wygrq8p3lr7dzd0f6ilq2sc-libxml2-2.9.8-py...
strip is /nix/store/4mf2xm9p32lzrim927yk92xhx35yaz62-binutils-2.30/bin/strip
Moving /nix/store/k8h9qa1nnqh2mqs4gmd70c8c4pk7dc76-libxml2-2.9.8-bin/bin/xml2-config to /nix/store/s5sisxnjjs75mwyd50j1dg1f4d3c9r01-libxml2-2.9.8-dev/bin/xml2-config
rmdir: failed to remove '/nix/store/k8h9qa1nnqh2mqs4gmd70c8c4pk7dc76-libxml2-2.9.8-bin/bin': Directory not empty
Moving /nix/store/1as40jjng7zhy7g05p8d3mhm3j9pakd5-libxml2-2.9.8/lib/xml2Conf.sh to /nix/store/s5sisxnjjs75mwyd50j1dg1f4d3c9r01-libxml2-2.9.8-dev/lib/xml2Conf.sh
rmdir: failed to remove '/nix/store/1as40jjng7zhy7g05p8d3mhm3j9pakd5-libxml2-2.9.8/lib': Directory not empty
Moving /nix/store/avrw2chp2wk9i4rrp6k3plak5hp53npb-libxml2-2.9.8-man/share/man/man1 to /nix/store/k8h9qa1nnqh2mqs4gmd70c8c4pk7dc76-libxml2-2.9.8-bin/share/man/man1
rmdir: failed to remove '/nix/store/avrw2chp2wk9i4rrp6k3plak5hp53npb-libxml2-2.9.8-man/share/man': Directory not empty
Moving /nix/store/1as40jjng7zhy7g05p8d3mhm3j9pakd5-libxml2-2.9.8/lib/libxml2.a to /nix/store/w0rzjl6sn1gpcqaa29hlczxn31s3z89f-libxml2-2.9.8-static/lib/libxml2.a
rmdir: failed to remove '/nix/store/1as40jjng7zhy7g05p8d3mhm3j9pakd5-libxml2-2.9.8/lib': Directory not empty

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libxml2Static

Partial log (click to expand)

strip is /nix/store/min150lkigznaayzpwvf8d4jdl1dqvx6-binutils-2.30/bin/strip
Moving /nix/store/zf7fhr3jib8g3jy2vwkxk7d6jh0f9vhy-libxml2-2.9.8-bin/bin/xml2-config to /nix/store/14n9ywkwm1k3bd31c59ck8nax66by5h1-libxml2-2.9.8-dev/bin/xml2-config
rmdir: failed to remove '/nix/store/zf7fhr3jib8g3jy2vwkxk7d6jh0f9vhy-libxml2-2.9.8-bin/bin': Directory not empty
Moving /nix/store/q1w8gd9kyz4rw17580gv2bxa24866bm3-libxml2-2.9.8/lib/xml2Conf.sh to /nix/store/14n9ywkwm1k3bd31c59ck8nax66by5h1-libxml2-2.9.8-dev/lib/xml2Conf.sh
rmdir: failed to remove '/nix/store/q1w8gd9kyz4rw17580gv2bxa24866bm3-libxml2-2.9.8/lib': Directory not empty
Moving /nix/store/6aycjaz1yh4v17z2gn522dwqg861n4yw-libxml2-2.9.8-man/share/man/man1 to /nix/store/zf7fhr3jib8g3jy2vwkxk7d6jh0f9vhy-libxml2-2.9.8-bin/share/man/man1
rmdir: failed to remove '/nix/store/6aycjaz1yh4v17z2gn522dwqg861n4yw-libxml2-2.9.8-man/share/man': Directory not empty
Moving /nix/store/q1w8gd9kyz4rw17580gv2bxa24866bm3-libxml2-2.9.8/lib/libxml2.a to /nix/store/hswwq0im1v9m2fk4h41c4q9km9iwhrvy-libxml2-2.9.8-static/lib/libxml2.a
rmdir: failed to remove '/nix/store/q1w8gd9kyz4rw17580gv2bxa24866bm3-libxml2-2.9.8/lib': Directory not empty
/nix/store/zf7fhr3jib8g3jy2vwkxk7d6jh0f9vhy-libxml2-2.9.8-bin

If `enableStatic` is set to true, the output `static` contains the
static library.
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libxml2

Partial log (click to expand)

/nix/store/5irzw6mdmk7g579sx0330nkcfjyg1gvb-libxml2-2.9.8-bin

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libxml2

Partial log (click to expand)

/nix/store/vldkhcgglfl7jprp6ppw0wazdc7c50zc-libxml2-2.9.8-bin

@nlewo
Copy link
Member Author

nlewo commented Jun 22, 2018

I've removed the libxml2Static attribute from all-packages.nix. This sound good to me.

This PR is a first step which is nice, but in the case of this library, I think it would be better to always build the static output and patch the libxml.la file (to remove the old_attribute). Outputs would stay identical and the build time almost unchanged. The end user would just have to use libxml2.static and would not have to find how to get the static version of this lib.
It seems this also works well for zlib/zlibStatic but I don't know if this could also be applied for all other static libraries.

@orivej orivej changed the title libxml2Static: init at libxml2 version (2.9.8) libxml2: add enableStatic argument Jun 22, 2018
@orivej
Copy link
Contributor

orivej commented Jun 22, 2018

I'm not sure about the best way to add static libraries to Nixpkgs… This PR is OK, but I would have also approved it if it did not move the static library into the static output.

@xeji xeji merged commit b98f20c into NixOS:master Jun 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants