emacs: replace cd with pushd/popd in buildPhase of melpaBuild
It is better to not change the working directory. One example showing the benefit is the rewriting[1] of lspce, where the Rust build hook assumes the working directory is unchanged. [1]: https://github.com/NixOS/nixpkgs/pull/334476
This commit is contained in:
@@ -111,7 +111,7 @@ genericBuild ({
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cd "$NIX_BUILD_TOP"
|
||||
pushd "$NIX_BUILD_TOP"
|
||||
|
||||
emacs --batch -Q \
|
||||
-L "$NIX_BUILD_TOP/package-build" \
|
||||
@@ -119,6 +119,8 @@ genericBuild ({
|
||||
-f melpa2nix-build-package \
|
||||
$ename $melpaVersion $commit
|
||||
|
||||
popd
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ melpaBuild {
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
cd "$sourceRoot"
|
||||
mkfifo test.log
|
||||
cat < test.log &
|
||||
HOME=$(mktemp -d) python -m test.test
|
||||
|
||||
@@ -186,13 +186,13 @@ let
|
||||
buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
|
||||
|
||||
postBuild = ''
|
||||
cd source/sqlite
|
||||
pushd sqlite
|
||||
make
|
||||
cd -
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
install -m=755 -D source/sqlite/emacsql-sqlite \
|
||||
install -m=755 -D sqlite/emacsql-sqlite \
|
||||
$out/share/emacs/site-lisp/elpa/emacsql-${old.version}/sqlite/emacsql-sqlite
|
||||
'';
|
||||
|
||||
@@ -203,13 +203,13 @@ let
|
||||
buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
|
||||
|
||||
postBuild = ''
|
||||
cd source/sqlite
|
||||
pushd sqlite
|
||||
make
|
||||
cd -
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
install -m=755 -D source/sqlite/emacsql-sqlite \
|
||||
install -m=755 -D sqlite/emacsql-sqlite \
|
||||
$out/share/emacs/site-lisp/elpa/emacsql-sqlite-${old.version}/sqlite/emacsql-sqlite
|
||||
'';
|
||||
|
||||
@@ -296,7 +296,7 @@ let
|
||||
'';
|
||||
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
install source/hotfuzz-module.so $out/share/emacs/site-lisp/elpa/hotfuzz-*
|
||||
install hotfuzz-module.so $out/share/emacs/site-lisp/elpa/hotfuzz-*
|
||||
'';
|
||||
});
|
||||
|
||||
@@ -304,17 +304,17 @@ let
|
||||
cmakeFlags = old.cmakeFlags or [ ] ++ [ "-DCMAKE_INSTALL_BINDIR=bin" ];
|
||||
env.NIX_CFLAGS_COMPILE = "-UCLANG_RESOURCE_DIR";
|
||||
preConfigure = ''
|
||||
cd server
|
||||
pushd server
|
||||
'';
|
||||
preBuild = ''
|
||||
make
|
||||
install -D bin/irony-server $out/bin/irony-server
|
||||
cd ..
|
||||
popd
|
||||
'';
|
||||
checkPhase = ''
|
||||
cd source/server
|
||||
pushd server
|
||||
make check
|
||||
cd ../..
|
||||
popd
|
||||
'';
|
||||
preFixup = ''
|
||||
rm -rf $out/share/emacs/site-lisp/elpa/*/server
|
||||
@@ -343,18 +343,14 @@ let
|
||||
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.enchant2 ];
|
||||
|
||||
postBuild = ''
|
||||
pushd working/jinx
|
||||
NIX_CFLAGS_COMPILE="$($PKG_CONFIG --cflags enchant-2) $NIX_CFLAGS_COMPILE"
|
||||
$CC -shared -o jinx-mod${libExt} jinx-mod.c -lenchant-2
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
pushd source
|
||||
outd=$(echo $out/share/emacs/site-lisp/elpa/jinx-*)
|
||||
install -m444 --target-directory=$outd jinx-mod${libExt}
|
||||
rm $outd/jinx-mod.c $outd/emacs-module.h
|
||||
popd
|
||||
'';
|
||||
|
||||
meta = old.meta // {
|
||||
@@ -366,17 +362,13 @@ let
|
||||
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.sqlite ];
|
||||
|
||||
postBuild = ''
|
||||
pushd working/sqlite3
|
||||
make
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
pushd source
|
||||
outd=$out/share/emacs/site-lisp/elpa/sqlite3-*
|
||||
install -m444 -t $outd sqlite3-api.so
|
||||
rm $outd/*.c $outd/*.h
|
||||
popd
|
||||
'';
|
||||
|
||||
meta = old.meta // {
|
||||
@@ -539,14 +531,14 @@ let
|
||||
'';
|
||||
|
||||
postBuild = ''
|
||||
cd source/server
|
||||
pushd server
|
||||
make
|
||||
cd -
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
mkdir -p $out/bin
|
||||
install -m755 -Dt $out/bin ./source/server/telega-server
|
||||
install -m755 -Dt $out/bin server/telega-server
|
||||
'';
|
||||
});
|
||||
|
||||
@@ -676,10 +668,8 @@ let
|
||||
# we need the proper out directory to exist, so we do this in the
|
||||
# postInstall instead of postBuild
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
pushd source/build >/dev/null
|
||||
make
|
||||
install -m444 -t $out/share/emacs/site-lisp/elpa/vterm-** ../*.so
|
||||
popd > /dev/null
|
||||
rm -rf $out/share/emacs/site-lisp/elpa/vterm-**/{CMake*,build,*.c,*.h}
|
||||
'';
|
||||
});
|
||||
@@ -717,8 +707,7 @@ let
|
||||
buildInputs =
|
||||
old.buildInputs ++
|
||||
(with pkgs.darwin.apple_sdk.frameworks; [CoreServices Foundation]);
|
||||
buildPhase = (old.buildPhase or "") + ''
|
||||
cd source
|
||||
postBuild = (old.postBuild or "") + ''
|
||||
$CXX -O3 -framework CoreServices -framework Foundation osx-dictionary.m -o osx-dictionary-cli
|
||||
'';
|
||||
postInstall = (old.postInstall or "") + "\n" + ''
|
||||
|
||||
Reference in New Issue
Block a user