mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
doc: update Nix code snippets format
Command: `mdcr --config doc/tests/mdcr-config.toml doc/`
This commit is contained in:
parent
5d979e79ce
commit
bcea0cf344
86 changed files with 2485 additions and 1478 deletions
|
@ -41,56 +41,58 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update
|
|||
(pkgs.zlib.override {
|
||||
stdenv = pkgs.emscriptenStdenv;
|
||||
}).overrideAttrs
|
||||
(old: rec {
|
||||
buildInputs = old.buildInputs ++ [ pkg-config ];
|
||||
# we need to reset this setting!
|
||||
env = (old.env or { }) // { NIX_CFLAGS_COMPILE = ""; };
|
||||
configurePhase = ''
|
||||
# FIXME: Some tests require writing at $HOME
|
||||
HOME=$TMPDIR
|
||||
runHook preConfigure
|
||||
(old: rec {
|
||||
buildInputs = old.buildInputs ++ [ pkg-config ];
|
||||
# we need to reset this setting!
|
||||
env = (old.env or { }) // {
|
||||
NIX_CFLAGS_COMPILE = "";
|
||||
};
|
||||
configurePhase = ''
|
||||
# FIXME: Some tests require writing at $HOME
|
||||
HOME=$TMPDIR
|
||||
runHook preConfigure
|
||||
|
||||
#export EMCC_DEBUG=2
|
||||
emconfigure ./configure --prefix=$out --shared
|
||||
#export EMCC_DEBUG=2
|
||||
emconfigure ./configure --prefix=$out --shared
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
dontStrip = true;
|
||||
outputs = [ "out" ];
|
||||
buildPhase = ''
|
||||
emmake make
|
||||
'';
|
||||
installPhase = ''
|
||||
emmake make install
|
||||
'';
|
||||
checkPhase = ''
|
||||
echo "================= testing zlib using node ================="
|
||||
runHook postConfigure
|
||||
'';
|
||||
dontStrip = true;
|
||||
outputs = [ "out" ];
|
||||
buildPhase = ''
|
||||
emmake make
|
||||
'';
|
||||
installPhase = ''
|
||||
emmake make install
|
||||
'';
|
||||
checkPhase = ''
|
||||
echo "================= testing zlib using node ================="
|
||||
|
||||
echo "Compiling a custom test"
|
||||
set -x
|
||||
emcc -O2 -s EMULATE_FUNCTION_POINTER_CASTS=1 test/example.c -DZ_SOLO \
|
||||
libz.so.${old.version} -I . -o example.js
|
||||
echo "Compiling a custom test"
|
||||
set -x
|
||||
emcc -O2 -s EMULATE_FUNCTION_POINTER_CASTS=1 test/example.c -DZ_SOLO \
|
||||
libz.so.${old.version} -I . -o example.js
|
||||
|
||||
echo "Using node to execute the test"
|
||||
${pkgs.nodejs}/bin/node ./example.js
|
||||
echo "Using node to execute the test"
|
||||
${pkgs.nodejs}/bin/node ./example.js
|
||||
|
||||
set +x
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "test failed for some reason"
|
||||
exit 1;
|
||||
else
|
||||
echo "it seems to work! very good."
|
||||
fi
|
||||
echo "================= /testing zlib using node ================="
|
||||
'';
|
||||
set +x
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "test failed for some reason"
|
||||
exit 1;
|
||||
else
|
||||
echo "it seems to work! very good."
|
||||
fi
|
||||
echo "================= /testing zlib using node ================="
|
||||
'';
|
||||
|
||||
postPatch = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace configure \
|
||||
--replace-fail '/usr/bin/libtool' 'ar' \
|
||||
--replace-fail 'AR="libtool"' 'AR="ar"' \
|
||||
--replace-fail 'ARFLAGS="-o"' 'ARFLAGS="-r"'
|
||||
'';
|
||||
})
|
||||
postPatch = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace configure \
|
||||
--replace-fail '/usr/bin/libtool' 'ar' \
|
||||
--replace-fail 'AR="libtool"' 'AR="ar"' \
|
||||
--replace-fail 'ARFLAGS="-o"' 'ARFLAGS="-r"'
|
||||
'';
|
||||
})
|
||||
```
|
||||
|
||||
:::{.example #usage-2-pkgs.buildemscriptenpackage}
|
||||
|
@ -103,8 +105,21 @@ This `xmlmirror` example features an Emscripten package that is defined complete
|
|||
pkgs.buildEmscriptenPackage rec {
|
||||
name = "xmlmirror";
|
||||
|
||||
buildInputs = [ pkg-config autoconf automake libtool gnumake libxml2 nodejs openjdk json_c ];
|
||||
nativeBuildInputs = [ pkg-config zlib ];
|
||||
buildInputs = [
|
||||
pkg-config
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
gnumake
|
||||
libxml2
|
||||
nodejs
|
||||
openjdk
|
||||
json_c
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
zlib
|
||||
];
|
||||
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gitlab.com/odfplugfest/xmlmirror.git";
|
||||
|
@ -129,7 +144,10 @@ pkgs.buildEmscriptenPackage rec {
|
|||
make -f Makefile.emEnv
|
||||
'';
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
outputs = [
|
||||
"out"
|
||||
"doc"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue