buildRubyGem: Provide manpages for Ruby gems (#49334)
This commit is contained in:
parent
56d2af6e98
commit
34e1fa4a50
@ -24,6 +24,7 @@
|
|||||||
, gemset ? null
|
, gemset ? null
|
||||||
, preferLocalBuild ? false
|
, preferLocalBuild ? false
|
||||||
, allowSubstitutes ? false
|
, allowSubstitutes ? false
|
||||||
|
, installManpages ? true
|
||||||
, meta ? {}
|
, meta ? {}
|
||||||
, postBuild ? ""
|
, postBuild ? ""
|
||||||
, gemConfig ? null
|
, gemConfig ? null
|
||||||
@ -36,7 +37,7 @@ let
|
|||||||
// { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
|
// { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
|
||||||
in
|
in
|
||||||
runCommand basicEnv.name cmdArgs ''
|
runCommand basicEnv.name cmdArgs ''
|
||||||
mkdir -p $out/bin;
|
mkdir -p $out/bin
|
||||||
${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' $out/bin/${x};\n") exes)}
|
${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' $out/bin/${x};\n") exes)}
|
||||||
${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " +
|
${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " +
|
||||||
"--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+
|
"--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+
|
||||||
@ -45,5 +46,13 @@ in
|
|||||||
"--set GEM_HOME ${basicEnv}/${ruby.gemPath} "+
|
"--set GEM_HOME ${basicEnv}/${ruby.gemPath} "+
|
||||||
"--set GEM_PATH ${basicEnv}/${ruby.gemPath} "+
|
"--set GEM_PATH ${basicEnv}/${ruby.gemPath} "+
|
||||||
"--run \"cd $srcdir\";\n") scripts)}
|
"--run \"cd $srcdir\";\n") scripts)}
|
||||||
|
|
||||||
|
${lib.optionalString installManpages ''
|
||||||
|
for section in {1..9}; do
|
||||||
|
mandir="$out/share/man/man$section"
|
||||||
|
find -L ${basicEnv}/${ruby.gemPath}/gems/${basicEnv.name} \( -wholename "*/man/*.$section" -o -wholename "*/man/man$section/*.$section" \) -print -execdir mkdir -p $mandir \; -execdir cp '{}' $mandir \;
|
||||||
|
done
|
||||||
|
''}
|
||||||
|
|
||||||
${postBuild}
|
${postBuild}
|
||||||
''
|
''
|
||||||
|
@ -44,6 +44,7 @@ lib.makeOverridable (
|
|||||||
# git checkout).
|
# git checkout).
|
||||||
# If you need to apply patches, make sure to set `dontBuild = false`;
|
# If you need to apply patches, make sure to set `dontBuild = false`;
|
||||||
, dontBuild ? true
|
, dontBuild ? true
|
||||||
|
, dontInstallManpages ? false
|
||||||
, propagatedBuildInputs ? []
|
, propagatedBuildInputs ? []
|
||||||
, propagatedUserEnvPkgs ? []
|
, propagatedUserEnvPkgs ? []
|
||||||
, buildFlags ? []
|
, buildFlags ? []
|
||||||
@ -206,6 +207,14 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
|
|||||||
ruby ${./gem-post-build.rb} "$spec"
|
ruby ${./gem-post-build.rb} "$spec"
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
${lib.optionalString (!dontInstallManpages) ''
|
||||||
|
for section in {1..9}; do
|
||||||
|
mandir="$out/share/man/man$section"
|
||||||
|
find $out/lib \( -wholename "*/man/*.$section" -o -wholename "*/man/man$section/*.$section" \) \
|
||||||
|
-execdir mkdir -p $mandir \; -execdir cp '{}' $mandir \;
|
||||||
|
done
|
||||||
|
''}
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user