vg: init at 1.74.1 (#522653)
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
From 27023ebb5e5b0fef98682c179889c3a9a799d2ae Mon Sep 17 00:00:00 2001
|
||||
From: eljamm <fedi.jamoussi@protonmail.ch>
|
||||
Date: Tue, 12 May 2026 18:02:52 +0200
|
||||
Subject: [PATCH] Use order-only prerequisite for making sure dirs exist
|
||||
|
||||
instead of using `.pre-build` with `-include`, which could cause a
|
||||
failure if targets start executing before it finishes.
|
||||
---
|
||||
Makefile | 23 ++++++++++++-----------
|
||||
1 file changed, 12 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 4436f14..8e66c66 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -47,20 +47,21 @@ test: all $(BIN_DIR)/test_libbdsg
|
||||
docs:
|
||||
cd $(DOC_DIR) && $(MAKE) html
|
||||
|
||||
-.pre-build:
|
||||
- @if [ ! -d $(LIB_DIR) ]; then mkdir -p $(LIB_DIR); fi
|
||||
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi
|
||||
- @if [ ! -d $(BIN_DIR) ]; then mkdir -p $(BIN_DIR); fi
|
||||
-
|
||||
-# run .pre-build before we make anything at all.
|
||||
--include .pre-build
|
||||
-
|
||||
# Make sure to pull in dependency files
|
||||
include $(wildcard $(OBJ_DIR)/*.d)
|
||||
|
||||
# Use a fake rule to build .d files, so we don't complain if they don't exist.
|
||||
$(OBJ_DIR)/%.d: ;
|
||||
|
||||
+$(OBJ_DIR):
|
||||
+ mkdir -p $(OBJ_DIR)
|
||||
+
|
||||
+$(LIB_DIR):
|
||||
+ mkdir -p $(LIB_DIR)
|
||||
+
|
||||
+$(BIN_DIR):
|
||||
+ mkdir -p $(BIN_DIR)
|
||||
+
|
||||
# Don't delete them.
|
||||
.PRECIOUS: $(OBJ_DIR)/%.d
|
||||
|
||||
@@ -69,16 +70,16 @@ $(OBJ_DIR)/%.d: ;
|
||||
# Make sure to touch the .o file after the compiler finishes so it is always newer than the .d file
|
||||
# Use static pattern rules so the dependency files will not be ignored if the output exists
|
||||
# See <https://stackoverflow.com/a/34983297>
|
||||
-$(OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.cpp $(OBJ_DIR)/%.d
|
||||
+$(OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.cpp $(OBJ_DIR)/%.d | $(OBJ_DIR)
|
||||
$(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
||||
@touch $@
|
||||
|
||||
|
||||
-$(LIB_DIR)/libbdsg.a: $(OBJS)
|
||||
+$(LIB_DIR)/libbdsg.a: $(OBJS) | $(LIB_DIR)
|
||||
rm -f $@
|
||||
ar rs $@ $(OBJS)
|
||||
|
||||
-$(BIN_DIR)/test_libbdsg: $(LIB_DIR)/libbdsg.a $(SRC_DIR)/test_libbdsg.cpp
|
||||
+$(BIN_DIR)/test_libbdsg: $(LIB_DIR)/libbdsg.a $(SRC_DIR)/test_libbdsg.cpp | $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)
|
||||
$(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -L $(LIB_DIR) $(SRC_DIR)/test_libbdsg.cpp -o $(BIN_DIR)/test_libbdsg $(LIB_FLAGS)
|
||||
chmod +x $(BIN_DIR)/test_libbdsg
|
||||
--
|
||||
2.51.2
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
runCommand,
|
||||
|
||||
# build-time
|
||||
autoconf,
|
||||
automake,
|
||||
bison,
|
||||
cmake,
|
||||
flex,
|
||||
gettext,
|
||||
hostname,
|
||||
libtool,
|
||||
perl,
|
||||
pkg-config,
|
||||
python3,
|
||||
util-linux,
|
||||
which,
|
||||
whoami,
|
||||
|
||||
# run-time
|
||||
boost,
|
||||
bzip2,
|
||||
cairo,
|
||||
curl,
|
||||
expat,
|
||||
jansson,
|
||||
libxdmcp,
|
||||
ncurses,
|
||||
openssl,
|
||||
protobuf,
|
||||
xz,
|
||||
zlib,
|
||||
zstd,
|
||||
|
||||
# test
|
||||
graphviz,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "vg";
|
||||
version = "1.74.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "vgteam";
|
||||
repo = "vg";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-CY4nUtVetdmoex/sRnoncEbvuQloV0WMZXtQpPksO1s=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace \
|
||||
Makefile \
|
||||
--replace-fail "/bin/bash" "${stdenv.shell}" \
|
||||
--replace-fail "\$(shell arch)" "${stdenv.hostPlatform.uname.processor}" \
|
||||
--replace-fail "vg_git_version.hpp]" "vg_git_version.hpp ]"
|
||||
|
||||
substituteInPlace \
|
||||
deps/libbdsg/bdsg/deps/pybind11/tests/CMakeLists.txt \
|
||||
deps/vcflib/CMakeLists.txt \
|
||||
--replace-fail \
|
||||
"find_package(pybind11 " \
|
||||
"set(PYBIND11_FINDPYTHON ON)
|
||||
find_package(pybind11 "
|
||||
|
||||
patchShebangs ./
|
||||
patchShebangs deps/
|
||||
|
||||
patch -p1 -d deps/libbdsg -i ${./0001-Use-order-only-prerequisite-for-making-sure-dirs-exi.patch}
|
||||
|
||||
pushd deps/htslib
|
||||
PACKAGE_VERSION=$(./version.sh)
|
||||
echo '#define HTSCODECS_VERSION_TEXT "$PACKAGE_VERSION"' > ./htscodecs/htscodecs/version.h
|
||||
popd
|
||||
'';
|
||||
|
||||
dontUseCmake = true; # cmake needed for deps, but not main package
|
||||
dontConfigure = true;
|
||||
enableParallelBuilding = true;
|
||||
|
||||
__structuredAttrs = true;
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoconf
|
||||
automake
|
||||
bison
|
||||
cmake
|
||||
finalAttrs.passthru.customPython
|
||||
flex
|
||||
gettext
|
||||
hostname
|
||||
libtool
|
||||
perl
|
||||
pkg-config
|
||||
which
|
||||
whoami
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
util-linux # rev, and possibly others
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
boost
|
||||
bzip2
|
||||
cairo
|
||||
curl
|
||||
expat
|
||||
jansson
|
||||
ncurses
|
||||
openssl
|
||||
protobuf
|
||||
xz
|
||||
zlib
|
||||
zstd
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
libxdmcp
|
||||
];
|
||||
|
||||
passthru.customPython = python3.withPackages (
|
||||
ps: with ps; [
|
||||
pybind11
|
||||
]
|
||||
);
|
||||
|
||||
# needed, else build fails
|
||||
env.VG_GIT_VERSION = finalAttrs.src.tag;
|
||||
|
||||
# deps/elfutils
|
||||
NIX_CFLAGS_COMPILE = toString [
|
||||
"-Wno-error=stringop-overflow"
|
||||
"-Wno-error=unterminated-string-initialization"
|
||||
];
|
||||
|
||||
makeFlags = [
|
||||
# don't build statically
|
||||
"START_STATIC="
|
||||
"END_STATIC="
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
# Install directories may not exist when parallel builds complete their
|
||||
# output steps, so we create them here to prevent build failures.
|
||||
mkdir -p lib include obj/{pic/algorithms,algorithms,config,io,subcommand,unittest/support}
|
||||
'';
|
||||
|
||||
# no install target
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{bin,lib}
|
||||
|
||||
cp bin/* $out/bin/
|
||||
cp -R lib/lib{handlegraph,vgio,hts,deflate}.so* $out/lib/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
fixupPhase = ''
|
||||
runHook preFixup
|
||||
|
||||
for bin in $out/bin/* ; do
|
||||
patchelf --allowed-rpath-prefixes /nix/store --shrink-rpath $bin
|
||||
patchelf --set-rpath "$out/lib:$(patchelf --print-rpath $bin)" $bin
|
||||
done
|
||||
|
||||
# remove debugging symbols that make the binary bloated in size
|
||||
strip -d $out/bin/vg
|
||||
|
||||
runHook postFixup
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
tests = runCommand "test-vg-basic" { } ''
|
||||
HOME=$(mktemp -d) # fontconfig cache
|
||||
|
||||
cp -R ${finalAttrs.src}/test .
|
||||
|
||||
# build graph
|
||||
${finalAttrs.finalPackage}/bin/vg construct \
|
||||
-r test/tiny/tiny.fa \
|
||||
-v test/tiny/tiny.vcf.gz \
|
||||
>x.vg
|
||||
|
||||
# convert graph to image
|
||||
${finalAttrs.finalPackage}/bin/vg view -d x.vg >x.dot
|
||||
${graphviz}/bin/dot -Tpng x.dot -o $out
|
||||
'';
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Tools for working with genome variation graphs";
|
||||
homepage = "https://github.com/vgteam/vg";
|
||||
changelog = "https://github.com/vgteam/vg/releases/tag/${finalAttrs.src.tag}";
|
||||
mainProgram = "vg";
|
||||
license = lib.licenses.mit;
|
||||
# TODO: build on darwin
|
||||
platforms = lib.platforms.linux;
|
||||
maintainers = with lib.maintainers; [ eljamm ];
|
||||
teams = with lib.teams; [ ngi ];
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user