Skip to content

Commit

Permalink
Merge pull request #26 from kcleal/gw_dev
Browse files Browse the repository at this point in the history
GW v0.10.0
  • Loading branch information
kcleal authored Jul 8, 2024
2 parents 36a0c9f + d4f52d6 commit 7609a87
Show file tree
Hide file tree
Showing 44 changed files with 6,093 additions and 2,415 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
pull_request:

env:
version: 0.9.3
version: 0.10.0

jobs:
mingw:
strategy:
fail-fast: false
matrix:
sys: [clang64, ucrt64]
sys: [ucrt64] # clang64,
name: ${{ matrix.sys }}
runs-on: windows-latest
defaults:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
run: |
sudo apt update
sudo apt-get install dh-make build-essential debhelper dh-virtualenv
sudo apt-get install devscripts fakeroot debootstrap pbuilder autotools-dev
sudo apt-get install debugedit devscripts fakeroot debootstrap pbuilder autotools-dev
sudo apt install zlib1g-dev libbz2-dev liblzma-dev libncurses5-dev libncursesw5-dev libssl-dev
sudo apt install libgl1-mesa-dev libfontconfig-dev libcurl4-openssl-dev libglfw3 libglfw3-dev
- name: build
Expand All @@ -140,9 +140,10 @@ jobs:
echo "LIBDEFLATE BUILT" && pwd
cd ${BUILD_DIR}
wget -O htslib.tar.bz2 https://github.com/samtools/htslib/releases/download/1.17/htslib-1.17.tar.bz2
wget -O htslib.tar.bz2 https://github.com/samtools/htslib/releases/download/1.20/htslib-1.20.tar.bz2
tar -xvf htslib.tar.bz2
mv htslib-1.17 htslib && rm htslib.tar.bz2 && cd htslib
mv htslib-1.20 htslib && rm htslib.tar.bz2 && cd htslib
sed -i 's/ -g -Wall/ -Wall/' Makefile # strip debug information
./configure --enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate
make -j3
echo "HTSLIB BUILT" && pwd
Expand All @@ -164,21 +165,24 @@ jobs:
- name: package
run: |
dh_make --single --createorig --packagename gw_${version} --email clealk@cardiff.ac.uk --yes --native
printf "usr/bin/gw\nusr/share/icons/gw_icon.png\nusr/share/applications/gw.desktop\nusr/lib/gwhts/\nusr/lib/x86_64-linux-gnu/libglfw.so.3\nusr/lib/x86_64-linux-gnu/libglfw.so.3.3" > debian/install
export LDFLAGS="$LDFLAGS -L./lib/skia/out/Release-x64 -L/usr/local/lib -L/usr/lib -L./usr/lib/gwhts -Wl,-rpath,'$ORIGIN/../lib/gwhts'"
sed -i '/^Section/c\Section: Bioinformatics' debian/control
sed -i '/^Homepage/c\Homepage: https://github.com/kcleal/gw' debian/control
sed -i '/^Description/c\Description: Genome browser and variant annotation' debian/control
sed -i '/<insert long/d' debian/control
printf "Conflicts: libglfw3 (<< 3.3)\nReplaces: libglfw3\n" >> debian/control
printf "Conflicts: libglfw3 (<< 3.3)\n" >> debian/control
printf "Replaces: libglfw3 \n" >> debian/control
# Override dh_shlibdeps to include /usr/lib/gwhts
printf '#!/usr/bin/make -f\n%%:\n\tdh $@\n\nclean:\n\tdh_clean\n\noverride_dh_shlibdeps:\n\tdh_shlibdeps -l/usr/lib/gwhts\n' > debian/rules
chmod +x debian/rules
dpkg-buildpackage
dpkg-buildpackage -us -uc
- name: upload
uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@
/lib/libBigWig/bwValues.o
/lib/libBigWig/bwWrite.o
/lib/libBigWig/io.o
/lib/libgw/
libgw.so
/libgw.dylib
/gw.wasm
/wasm_libs
/src/plot_commands.o
8 changes: 6 additions & 2 deletions .gw.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ saccer3=https://github.com/kcleal/ref_genomes/releases/download/v0.1.0/sacCer3.f

[general]
theme=dark
dimensions=3000x1000
dimensions=1366x800
indel_length=10
ylim=50
coverage=true
Expand All @@ -37,12 +37,16 @@ tabix_track_height=0.3
font=Menlo
font_size=14
sv_arcs=true
mods=false
mods_qual_threshold=50
session_file=

[view_thresholds]
soft_clip=20000
small_indel=100000
snp=500000
edge_highlights=100000
mod=250000
edge_highlights=1000000
variant_distance=100000
low_memory=1500000

Expand Down
127 changes: 69 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ debug: default

# set system
PLATFORM=
UNAME_S := $(shell uname -s)
ifeq ($(OS),Windows_NT) # assume we are using msys2-ucrt64 env
PLATFORM = "Windows"
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
ifdef EMSCRIPTEN
PLATFORM = "Emscripten"
else ifeq ($(UNAME_S),Linux)
PLATFORM = "Linux"
else ifeq ($(UNAME_S),Darwin)
ifeq ($(shell uname -m), arm64)
Expand All @@ -23,66 +25,63 @@ else
endif
endif
endif

# try and add conda environment
ifdef CONDA_PREFIX
CPPFLAGS += -I$(CONDA_PREFIX)/include
LDFLAGS += -L$(CONDA_PREFIX)/lib
endif

# Options to use target htslib or skia
ifdef HTSLIB
CPPFLAGS += -I$(HTSLIB)
LDFLAGS += -L$(HTSLIB)
ifneq ($(PLATFORM),"Emscripten")
# try and add conda environment
ifdef CONDA_PREFIX
CPPFLAGS += -I$(CONDA_PREFIX)/include
LDFLAGS += -L$(CONDA_PREFIX)/lib
endif
ifdef HTSLIB # Options to use target htslib or skia
CPPFLAGS += -I$(HTSLIB)
LDFLAGS += -L$(HTSLIB)
endif
endif

SKIA ?= ""
SKIA_PATH=""
ifneq ($(PLATFORM), "Windows")
ifneq ($(SKIA),"")
CPPFLAGS += -I$(SKIA)
LDFLAGS += -L $(wildcard $(SKIA)/out/Rel*)
else ifeq ($(PLATFORM),"Darwin")
CPPFLAGS += -I./lib/skia
LDFLAGS += -L./lib/skia/out/Release-x64
SKIA_PATH = $(wildcard $(SKIA)/out/Rel*)
else ifeq ($(PLATFORM),"Arm64")
CPPFLAGS += -I./lib/skia
LDFLAGS += -L./lib/skia/out/Release-arm64
else
SKIA_PATH = ./lib/skia/out/Release-arm64
else ifeq ($(PLATFORM),"Emscripten")
CPPFLAGS += -I./wasm_libs/skia -I./wasm_libs/htslib
SKIA_PATH = ./wasm_libs/skia/out/canvaskit_wasm
else # Darwin / Linux
CPPFLAGS += -I./lib/skia
LDFLAGS += -L./lib/skia/out/Release-x64
SKIA_PATH = ./lib/skia/out/Release-x64
LDFLAGS=
endif
endif

LDFLAGS += -L$(SKIA_PATH)
SKIA_LINK=""
USE_GL ?= "" # Else use EGL backend for Linux only

prep:
@if [ "$(PLATFORM)" = "Darwin" ]; then \
SKIA_LINK=""; \
echo "Downloading pre-built skia for MacOS-Intel"; mkdir -p lib/skia; \
cd lib/skia && wget -O skia.zip "https://github.com/JetBrains/skia-build/releases/download/m93-87e8842e8c/Skia-m93-87e8842e8c-macos-Release-x64.zip" && unzip -o skia.zip && rm skia.zip && cd ../../; \
cd lib/skia && curl -L -o skia.zip "https://github.com/JetBrains/skia-build/releases/download/m93-87e8842e8c/Skia-m93-87e8842e8c-macos-Release-x64.zip" && unzip -o skia.zip && rm skia.zip && cd ../../; \
elif [ "$(PLATFORM)" = "Arm64" ]; then \
echo "Downloading pre-built skia for MacOS-Arm64"; mkdir -p lib/skia; \
cd lib/skia && wget -O skia.tar.gz "https://github.com/kcleal/skia_build_arm64/releases/download/v0.0.1/skia.zip" && tar -xvf skia.tar.gz && rm skia.tar.gz && cd ../../; \
cd lib/skia && curl -L -o skia.tar.gz "https://github.com/kcleal/skia_build_arm64/releases/download/v0.0.1/skia.zip" && tar -xvf skia.tar.gz && rm skia.tar.gz && cd ../../; \
elif [ "$(PLATFORM)" = "Linux" ] && [ "$(USE_GL)" = "1" ]; then \
echo "Downloading pre-built skia for Linux with GL"; mkdir -p lib/skia; \
cd lib/skia && wget -O skia.zip "https://github.com/JetBrains/skia-build/releases/download/m93-87e8842e8c/Skia-m93-87e8842e8c-linux-Release-x64.zip" && unzip -o skia.zip && rm skia.zip && cd ../../; \
cd lib/skia && curl -L -o skia.zip "https://github.com/JetBrains/skia-build/releases/download/m93-87e8842e8c/Skia-m93-87e8842e8c-linux-Release-x64.zip" && unzip -o skia.zip && rm skia.zip && cd ../../; \
elif [ "$(PLATFORM)" = "Linux" ]; then \
echo "Downloading pre-built skia for Linux with EGL"; mkdir -p lib/skia; \
cd lib/skia && wget -O skia.tar.gz "https://github.com/kcleal/skia_build_arm64/releases/download/v0.0.1/skia-m93-linux-Release-x64.tar.gz" && tar -xvf skia.tar.gz && rm skia.tar.gz && cd ../../; \
cd lib/skia && curl -L -o skia.tar.gz "https://github.com/kcleal/skia_build_arm64/releases/download/v0.0.1/skia-m93-linux-Release-x64.tar.gz" && tar -xvf skia.tar.gz && rm skia.tar.gz && cd ../../; \
fi


CXXFLAGS += -Wall -std=c++17 -fno-common -fwrapv -fno-omit-frame-pointer -O3 -DNDEBUG

CPPFLAGS += -I./lib/libBigWig -I./include -I./src -I.

LDLIBS += -lskia -lm -ljpeg -lpng -lsvg -lhts -lfontconfig -lpthread



# set platform flags and libs
ifeq ($(PLATFORM),"Linux")
CXXFLAGS += -Wall -std=c++17 -fno-common -fwrapv -fno-omit-frame-pointer -O3 -DNDEBUG -g
LIBGW_INCLUDE=
shared: LIBGW_INCLUDE=-I./libgw
CPPFLAGS += -I./lib/libBigWig -I./include -I. $(LIBGW_INCLUDE) -I./src
LDLIBS += -lskia -lm -ljpeg -lpng -lpthread
ifeq ($(PLATFORM),"Linux") # set platform flags and libs
ifeq (${XDG_SESSION_TYPE},"wayland") # wayland is untested!
LDLIBS += -lwayland-client
else
Expand All @@ -92,60 +91,72 @@ ifeq ($(PLATFORM),"Linux")
CXXFLAGS += -D LINUX -D __STDC_FORMAT_MACROS
LDFLAGS += -L/usr/local/lib
# If installed from conda, glfw3 is named glfw, therefore if glfw3 is installed by another means use this:
# LDLIBS += -lGL -lfreetype -lfontconfig -luuid -lzlib -licu -ldl $(shell pkg-config --static --libs x11 xrandr xi xxf86vm glfw3)
# LDLIBS += -lGL -lfreetype -lfontconfig -luuid -lzlib -licu -ldl $(shell pkg-config --static --libs x11 xrandr xi xxf86vm glfw3)
# LDLIBS += -lEGL -lGLESv2 -lfreetype -lfontconfig -luuid -lz -lcurl -licu -ldl -lglfw #$(shell pkg-config --static --libs x11 xrandr xi xxf86vm glfw3)
# LDLIBS += -lGL -lfreetype -lfontconfig -luuid -lz -lcurl -licu -ldl -lglfw
ifeq ($(USE_GL),"1")
LDLIBS += -lGL
else
LDLIBS += -lEGL -lGLESv2
endif
LDLIBS += -lfreetype -lfontconfig -luuid -lz -lcurl -licu -ldl -lglfw

LDLIBS += -lhts -lfreetype -luuid -lz -lcurl -licu -ldl -lglfw -lsvg -lfontconfig
else ifeq ($(PLATFORM),"Darwin")
CPPFLAGS += -I/usr/local/include
CXXFLAGS += -D OSX -stdlib=libc++ -arch x86_64 -fvisibility=hidden -mmacosx-version-min=10.15 -Wno-deprecated-declarations
CXXFLAGS += -D OSX -stdlib=libc++ -arch x86_64 -fvisibility=hidden -mmacosx-version-min=11 -Wno-deprecated-declarations
LDFLAGS += -undefined dynamic_lookup -framework OpenGL -framework AppKit -framework ApplicationServices -mmacosx-version-min=10.15 -L/usr/local/lib
LDLIBS += -lglfw -lzlib -lcurl -licu -ldl

LDLIBS += -lhts -lglfw -lzlib -lcurl -licu -ldl -lsvg -lfontconfig
else ifeq ($(PLATFORM),"Arm64")
CPPFLAGS += -I/usr/local/include
CXXFLAGS += -D OSX -stdlib=libc++ -arch arm64 -fvisibility=hidden -mmacosx-version-min=10.15 -Wno-deprecated-declarations
CXXFLAGS += -D OSX -stdlib=libc++ -arch arm64 -fvisibility=hidden -mmacosx-version-min=11 -Wno-deprecated-declarations
LDFLAGS += -undefined dynamic_lookup -framework OpenGL -framework AppKit -framework ApplicationServices -mmacosx-version-min=10.15 -L/usr/local/lib
LDLIBS += -lglfw -lzlib -lcurl -licu -ldl

LDLIBS += -lhts -lglfw -lzlib -lcurl -licu -ldl -lsvg -lfontconfig
else ifeq ($(PLATFORM),"Windows")
CXXFLAGS += -D WIN32
CPPFLAGS += $(shell pkgconf -cflags skia) $(shell ncursesw6-config --cflags)
LDLIBS += $(shell pkgconf -libs skia)
LDLIBS += -lharfbuzz-subset -lglfw3 -lcurl
LDLIBS += -lhts -lharfbuzz-subset -lglfw3 -lcurl -lsvg -lfontconfig
else ifeq ($(PLATFORM),"Emscripten")
CPPFLAGS += -v --use-port=contrib.glfw3 -sUSE_ZLIB=1 -sUSE_FREETYPE=1 -sUSE_ICU=1 -I/usr/local/include
CFLAGS += -fPIC
CXXFLAGS += -DBUILDING_LIBGW -D__STDC_FORMAT_MACROS -fPIC
LDFLAGS += -v -L./wasm_libs/htslib -s RELOCATABLE=1 --no-entry -s STANDALONE_WASM
LDLIBS += -lwebgl.js -l:libhts.a
endif

OBJECTS = $(patsubst %.cpp, %.o, $(wildcard ./src/*.cpp))
OBJECTS += $(patsubst %.c, %.o, $(wildcard ./lib/libBigWig/*.c))


debug: CXXFLAGS += -g
debug: LDFLAGS += -fsanitize=address -fsanitize=undefined

$(TARGET): $(OBJECTS)
$(CXX) -g $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@
$(TARGET): $(OBJECTS) # line 131
$(CXX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@


clean:
-rm -f *.o ./src/*.o ./src/*.o.tmp ./lib/libBigWig/*.o
-rm -f $(TARGET)
-rm -rf libgw
-rm -rf libgw.* *.wasm


SHARED_TARGET = libgw/libgw.so
ifeq ($(PLATFORM),"Darwin")
SHARED_TARGET = libgw/libgw.dylib

ifeq ($(UNAME_S),Linux)
SHARED_TARGET = libgw.so
endif
ifeq ($(UNAME_S),Darwin)
SHARED_TARGET = libgw.dylib
endif

shared: CXXFLAGS += -fPIC
shared: CXXFLAGS += -fPIC -DBUILDING_LIBGW
shared: CFLAGS += -fPIC
shared: $(OBJECTS)
-mkdir -p libgw/include
-cp src/*.h libgw/include
-cp include/*.h libgw/include
$(CXX) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -shared -o $(SHARED_TARGET)

ifeq ($(UNAME_S),Darwin)
$(CXX) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -dynamiclib -DBUILDING_LIBGW -o $(SHARED_TARGET)
else
$(CXX) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -shared -DBUILDING_LIBGW -o $(SHARED_TARGET)
endif
-mkdir -p lib/libgw/include lib/libgw/out
-cp $(SKIA_PATH)/libskia.a lib/libgw/out
-cp src/*.h lib/libgw/include
-cp include/*.h* lib/libgw/include
-mv $(SHARED_TARGET) lib/libgw/out
49 changes: 49 additions & 0 deletions deps/compile_wasm_libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# Run this in the gw top-level directory (same as Makefile)
# Also dont forget to source emsdk environment
# source ~/Tools/emsdk/emsdk_env.sh

emcc --version
mkdir -p wasm_libs
cd wasm_libs

sudo apt-get install -y zlib1g-dev libbz2-dev libcurl4-gnutls-dev libssl-dev autoconf


# Compile LZMA to WebAssembly
LZMA_VERSION="5.2.5"
curl -LO "https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.gz"
tar -xvf xz-${LZMA_VERSION}.tar.gz && rm xz*.gz
cd xz-${LZMA_VERSION}
emconfigure ./configure --disable-shared --disable-threads
emmake make -j4 CFLAGS="-Oz -fPIC -s USE_PTHREADS=0 -s EXPORT_ALL=1 -s ASSERTIONS=1"
cd ..


# Run ./configure
CFLAGS="-s USE_ZLIB=1 -s USE_BZIP2=1 ${CFLAGS_LZMA} -I./xz-${LZMA_VERSION}/src/liblzma/api/"
LDFLAGS="$LDFLAGS_LZMA -L./xz-${LZMA_VERSION}/src/liblzma/.libs/"
make clean
autoheader
autoconf
emconfigure ./configure CFLAGS="$CFLAGS -fPIC" LDFLAGS="$LDFLAGS --relocatable"


# Build htslib
curl -L -o htslib.tar.bz2 https://github.com/samtools/htslib/releases/download/1.20/htslib-1.20.tar.bz2
tar -xvf htslib.tar.bz2 && rm htslib.tar.bz2 && mv htslib-1.20 htslib
cd htslib
emmake make -j4 CC=emcc AR=emar \
CFLAGS="-O2 -fPIC $CFLAGS" \
LDFLAGS="$EM_FLAGS -O2 -s ERROR_ON_UNDEFINED_SYMBOLS=0 $LDFLAGS --relocatable"


git clone https://github.com/google/skia.git
cd skia
VERSION=m93
git checkout origin/chrome/${VERSION}
python3 tools/git-sync-deps
cd modules/canvaskit/
sed -i 's/-s LLD_REPORT_UNDEFINED//g' compile.sh
make release -j4
2 changes: 1 addition & 1 deletion deps/gw.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Encoding=UTF-8
Version=0.9.3
Version=0.10.0
Type=Application
Terminal=true
Exec=bash -c "/usr/bin/gw"
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/install/Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For best performance, install GW as a desktop application on (Intel debian syste
Use the installer below, or head over to the GitHub [Releases page](https://github.com/kcleal/gw/releases).


[GW Intel x86_64 debian installer](https://github.com/kcleal/gw/releases/download/v0.9.3/gw_0.9.3_amd64.deb)
[GW Intel x86_64 debian installer](https://github.com/kcleal/gw/releases/download/v0.10.0/gw_0.10.0_amd64.deb)



Expand Down
2 changes: 1 addition & 1 deletion docs/docs/install/MacOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For best performance, install GW as a desktop application (Intel or Apple silico
installers below, or head over to the GitHub [Releases page](https://github.com/kcleal/gw/releases).


[GW Intel x86_64 mac dmg installer](https://github.com/kcleal/gw/releases/download/v0.9.3/gw_macos_intel.dmg)
[GW Intel x86_64 mac dmg installer](https://github.com/kcleal/gw/releases/download/v0.10.0/gw_macos_intel.dmg)

[GW Apple arm64 mac dmg installer](https://github.com/kcleal/gw/releases/download/v0.9.3/gw-macos-arm.dmg)

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/install/Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Follow the installation instructions on the website to set up MSYS2 on your Wind
Download the GW installer script below:


[GW Intel x86_64 Windows installer](https://github.com/kcleal/gw/releases/download/v0.9.3/gw-windows-installer.vbs)
[GW Intel x86_64 Windows installer](https://github.com/kcleal/gw/releases/download/v0.10.0/gw-windows-installer.vbs)


Run the downloaded visual-basic script by double-clicking, or right-clicking and selecting Run as program.
Expand Down
File renamed without changes.
Loading

0 comments on commit 7609a87

Please sign in to comment.