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

gflags: fix build on case-insensitive filesystems #38157

Merged
merged 1 commit into from Apr 1, 2018

Conversation

aperiodic
Copy link
Contributor

@aperiodic aperiodic commented Mar 30, 2018

Motivation for this change

Darwin machines come with a case-insensitive filesystem by default. The
gflags package's source contains a file 'BUILD' and the build process
attempts to create a directory called 'build', which fails on
case-insensitive filesystems.

Things done

Add a prePatch hook to rename the BUILD file (which is for use with an unrelated build tool).

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)

  • Built on platform(s)

    • NixOS
    • macOS
    • other Linux distributions
  • I did not test compilation of all pkgs that depend on this change because this should not produce a change to any machine code

  • Tested execution of the bash completion script in bin

  • Fits CONTRIBUTING.md.


@aperiodic aperiodic changed the title gflags: now builds on case-insensitive filesystems gflags: fix build on case-insensitive filesystems Mar 30, 2018
@LnL7
Copy link
Member

LnL7 commented Mar 31, 2018

@GrahamcOfBorg build gflags

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: gflags

Partial log (click to expand)

-- Installing: /nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1/lib/cmake/gflags/gflags-targets.cmake
-- Installing: /nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1/lib/cmake/gflags/gflags-targets-release.cmake
-- Installing: /nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1/bin/gflags_completions.sh
-- Installing: /nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1/lib/pkgconfig/gflags.pc
post-installation fixup
strip is /nix/store/0fzpxnsanc02i4jsb1yhchjp4p62b2n3-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1/lib  /nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1/bin
patching script interpreter paths in /nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1
/nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1/bin/gflags_completions.sh: interpreter directive changed from "/bin/bash" to "/nix/store/x030a63qdilnv02pkivfjg44pdxsh5km-bash-4.4-p19/bin/bash"
/nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: gflags

Partial log (click to expand)

-- Installing: /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/bin/gflags_completions.sh
-- Installing: /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/lib/pkgconfig/gflags.pc
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1
strip is /nix/store/3zq400fri5dv7d30lpxlqm2v9y1iis6j-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/lib  /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/bin
patching script interpreter paths in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1
/nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/bin/gflags_completions.sh: interpreter directive changed from "/bin/bash" to "/nix/store/3gg2p6n4kv2f0lsxd41f5iz1ivkbzyzr-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1...
/nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: gflags

Partial log (click to expand)

-- Installing: /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/bin/gflags_completions.sh
-- Installing: /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/lib/pkgconfig/gflags.pc
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1
strip is /nix/store/fzcs0fn6bb04m82frhlb78nc03ny3w55-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/lib  /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/bin
patching script interpreter paths in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1
/nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/bin/gflags_completions.sh: interpreter directive changed from "/bin/bash" to "/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1...
/nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1

# a directory called 'build'. To fix building on the case-insensitive
# filesystems commonly seen on darwin machines, rename 'BUILD' so it won't
# conflict with the directory (it's for the unrelated build tool "bazel").
prePatch = "mv BUILD BUILD.bazel";
}
Copy link
Member

Choose a reason for hiding this comment

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

Could you also add meta.platforms, otherwise this won't get built by hydra.

@aperiodic
Copy link
Contributor Author

@LnL7 Added platforms along with some other metadata.

@aperiodic
Copy link
Contributor Author

Uh sorry for the review pings everyone, I forgot I rebased against 17.09 locally to try my changes out.

@LnL7
Copy link
Member

LnL7 commented Mar 31, 2018

looks like you forgot a semicolon after one of the attributes.

Darwin machines come with a case-insensitive filesystem by default. The
gflags package's source contains a file 'BUILD' and the build process
attempts to create a directory called 'build', which fails on
case-insensitive filesystems.

Add a prePatch hook to rename the BUILD file (which is for use with an
unrelated build tool) to something that doesn't conflict with the
'build' directory. This hook allows this derivation to be built on
case-insensitive filesystems.

Add metadata to the derivation because previously it had none.
@LnL7
Copy link
Member

LnL7 commented Apr 1, 2018

@GrahamcOfBorg build gflags

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: gflags

Partial log (click to expand)

/nix/store/ycgmwjyysv01a0lg9livxdjvrc7j237s-gflags-2.2.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: gflags

Partial log (click to expand)

-- Installing: /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/bin/gflags_completions.sh
-- Installing: /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/lib/pkgconfig/gflags.pc
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1
strip is /nix/store/fzcs0fn6bb04m82frhlb78nc03ny3w55-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/lib  /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/bin
patching script interpreter paths in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1
/nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1/bin/gflags_completions.sh: interpreter directive changed from "/bin/bash" to "/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash"
checking for references to /tmp/nix-build-gflags-2.2.1.drv-0 in /nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1...
/nix/store/kbs71v6py5155axxx6d9wc02gvgfa4z7-gflags-2.2.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: gflags

Partial log (click to expand)

-- Installing: /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/bin/gflags_completions.sh
-- Installing: /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/lib/pkgconfig/gflags.pc
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1
strip is /nix/store/3zq400fri5dv7d30lpxlqm2v9y1iis6j-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/lib  /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/bin
patching script interpreter paths in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1
/nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1/bin/gflags_completions.sh: interpreter directive changed from "/bin/bash" to "/nix/store/3gg2p6n4kv2f0lsxd41f5iz1ivkbzyzr-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1...
/nix/store/rkxs7y2qs4nb7bk277whsg5zg345mnlc-gflags-2.2.1

Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

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

Thanks!

@LnL7 LnL7 merged commit 7a33e57 into NixOS:master Apr 1, 2018
@LnL7
Copy link
Member

LnL7 commented Apr 1, 2018

Also ported to release in 021ee7d.

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

4 participants