Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Windows using MSYS2 #906

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: Compile 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
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions docs/content/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.msys2.org/>`_. 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
--------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion test/fisher/test-fisher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down