From 3f66c524608d2ee461320f90653ea57db1f113da Mon Sep 17 00:00:00 2001 From: Mikhail Kviatkovskii Date: Fri, 19 Mar 2021 13:47:53 +0300 Subject: [PATCH 1/2] Building on Windows via MSYS2 --- .github/workflows/main.yml | 37 +++++++++++++++++++++++++++++++++---- Makefile | 6 ++++++ docs/content/faq.rst | 14 ++++++++++++++ test/fisher/test-fisher.sh | 2 +- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index caaf9902b..77dbfb161 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,17 +3,46 @@ name: CI on: [push, pull_request] jobs: - build: + build-linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Compile and test Bedtools - run: make -j8 && make test + run: make -j $(nproc) && make test - name: Compile static binary - run: make -j8 static + run: make -j $(nproc) static - uses: actions/upload-artifact@v1 with: - name: bedtools.static + name: bedtools.static-linux path: bin/bedtools.static + + build-windows: + + runs-on: windows-latest + + defaults: + run: + shell: msys2 {0} + steps: + - name: Set proper line endings in git + shell: powershell + run: git config --global core.autocrlf false + - uses: actions/checkout@v1 + - uses: msys2/setup-msys2@v2 + with: + msystem: MSYS + install: gcc make python libbz2-devel liblzma-devel zlib-devel git diffutils + - name: CCompile and test Bedtools + run: make -j $(nproc) && make test + - name: Compile semi-static binary + run: make VERBOSE=1 -j $(nproc) static + - name: Copy msys-2.0.dll to bin + run: cp /usr/bin/msys-2.0.dll bin/ + - uses: actions/upload-artifact@v2 + with: + name: bedtools.static-windows + path: | + bin/bedtools.static + bin/msys-2.0.dll diff --git a/Makefile b/Makefile index a3b3baa4a..98c81ff57 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,12 @@ else BT_CXXFLAGS += -std=c++11 endif +# Support building on MSYS2 +UNAME := $(shell sh -c 'uname 2>/dev/null || echo Unknown') +ifeq (MSYS_NT,$(findstring MSYS_NT,$(UNAME))) +BT_CXXFLAGS += -D_GNU_SOURCE -D_DEFAULT_SOURCE +endif + BT_LDFLAGS = BT_LIBS = -lz -lm -lbz2 -llzma -lpthread diff --git a/docs/content/faq.rst b/docs/content/faq.rst index a0298f167..91730c4dc 100644 --- a/docs/content/faq.rst +++ b/docs/content/faq.rst @@ -39,6 +39,20 @@ and on Fedora/Centos this would be: yum install zlib yum install zlib1g-dev +-------------------------------------------------- +Is build on Windows possible? +-------------------------------------------------- +Yes. Currently build on Windows could be done via `MSYS2 `_. You need to: +- Install MSYS2 +- Open MSYS2 Bash shell +- Install build dependencies via command +.. code-block:: bash + pacman -S gcc make python libbz2-devel liblzma-devel zlib-devel git diffutils +- Run ``make`` command. +At the moment MSYS2 does not support fully static builds, so bedtools.static depends on file ``msys-2.0.dll`` +(could be found at ``C:\msys64\usr\bin\msys-2.0.dll`` if default install path is used). You need to distribute this file +together with main executable. + -------------------------------------------------- Compiling with a specific zlib library -------------------------------------------------- diff --git a/test/fisher/test-fisher.sh b/test/fisher/test-fisher.sh index d15c47d05..1a85b2b15 100644 --- a/test/fisher/test-fisher.sh +++ b/test/fisher/test-fisher.sh @@ -102,7 +102,7 @@ rm obs exp echo -e " fisher.t5...\c" $BT fisher -b test.bed -a tumor.gff -g dm6.fai > exp DIR="${TMPDIR:-/tmp}/Users/mvandenb/src/genomic_features_bardin_lab/build/modencode/dm6/bed/" -LONG_PATH="$DIR/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaS-\(phospho-S2\)_.bed" +LONG_PATH="$DIR/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaS-phospho-S2_.bed" mkdir -p "$DIR" cp test.bed "$LONG_PATH" $BT fisher -b "$LONG_PATH" -a tumor.gff -g dm6.fai > obs From 7f0b3a5899c972d764638787dfd7bc9b5b422d29 Mon Sep 17 00:00:00 2001 From: Mikhail Kviatkovskii Date: Fri, 19 Mar 2021 14:08:18 +0300 Subject: [PATCH 2/2] Typo fixed --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 77dbfb161..4b9d208b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,7 @@ jobs: with: msystem: MSYS install: gcc make python libbz2-devel liblzma-devel zlib-devel git diffutils - - name: CCompile and test Bedtools + - name: Compile and test Bedtools run: make -j $(nproc) && make test - name: Compile semi-static binary run: make VERBOSE=1 -j $(nproc) static