Skip to content

Commit

Permalink
added arm and aarch64 builds (#51184)
Browse files Browse the repository at this point in the history
* added arm and arch64 builds

* simplifying CMake command

* patch for S_ZEROFILL issue with asmlib on osx

* moved patch to sources section

* another patch to avoid asmlib on osx

* typo fixed

* forgotten modification in patch
  • Loading branch information
kowallus authored Oct 7, 2024
1 parent 65fcfee commit 83d2492
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 25 deletions.
113 changes: 113 additions & 0 deletions recipes/mbgc/asmlib_off.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
Subject: [PATCH] turned off asmlib for mac to avoid build problems
---
Index: mbgccoder/MBGC_Encoder.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/mbgccoder/MBGC_Encoder.cpp b/mbgccoder/MBGC_Encoder.cpp
--- a/mbgccoder/MBGC_Encoder.cpp (revision 3f75674bef8463fbfb38e5c13b2760001c82db2a)
+++ b/mbgccoder/MBGC_Encoder.cpp (date 1728303373036)
@@ -15,7 +15,7 @@
( params->checkIfDNAisWellFormed ? (seq->dnaLineLen == DNA_NOT_WELLFORMED ? 0 : seq->dnaLineLen ) \
: seq->maxLastDnaLineLen ) : 0)

-#if !defined(__arm__) && !defined(__aarch64__) && !defined(__ARM_ARCH)
+#if false
#include "../libs/asmlib.h"
#endif
#include "../coders/PropsLibrary.h"
Index: matching/SlidingWindowSparseEMMatcher.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/matching/SlidingWindowSparseEMMatcher.cpp b/matching/SlidingWindowSparseEMMatcher.cpp
--- a/matching/SlidingWindowSparseEMMatcher.cpp (revision 3f75674bef8463fbfb38e5c13b2760001c82db2a)
+++ b/matching/SlidingWindowSparseEMMatcher.cpp (date 1728303373000)
@@ -28,7 +28,7 @@
* ================================================================= */

#include "SlidingWindowSparseEMMatcher.h"
-#if !defined(__arm__) && !defined(__aarch64__) && !defined(__ARM_ARCH)
+#if false
#include "../libs/asmlib.h"
#endif
#include <algorithm>
Index: mbgccoder/MBGC_Decoder.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/mbgccoder/MBGC_Decoder.cpp b/mbgccoder/MBGC_Decoder.cpp
--- a/mbgccoder/MBGC_Decoder.cpp (revision 3f75674bef8463fbfb38e5c13b2760001c82db2a)
+++ b/mbgccoder/MBGC_Decoder.cpp (date 1728303418036)
@@ -1,7 +1,7 @@
#include "MBGC_Decoder.h"

#include "../coders/CodersLib.h"
-#if !defined(__arm__) && !defined(__aarch64__) && !defined(__ARM_ARCH)
+#if false
#include "../libs/asmlib.h"
#endif
#include "../matching/SimpleSequenceMatcher.h"
Index: utils/helper.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/utils/helper.h b/utils/helper.h
--- a/utils/helper.h (revision 3f75674bef8463fbfb38e5c13b2760001c82db2a)
+++ b/utils/helper.h (date 1728303373072)
@@ -338,7 +338,7 @@

}

-#if defined(__arm__) || defined(__aarch64__) || defined(__ARM_ARCH)
+#if true

void A_memcpy(void *dest, const void *src, size_t n);

Index: utils/helper.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/utils/helper.cpp b/utils/helper.cpp
--- a/utils/helper.cpp (revision 3f75674bef8463fbfb38e5c13b2760001c82db2a)
+++ b/utils/helper.cpp (date 1728303373058)
@@ -582,7 +582,7 @@
#endif
}

-#if defined(__arm__) || defined(__aarch64__) || defined(__ARM_ARCH)
+#if true

void A_memcpy(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
Index: CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt (revision 3f75674bef8463fbfb38e5c13b2760001c82db2a)
+++ b/CMakeLists.txt (date 1728303558182)
@@ -99,17 +99,6 @@
set(CMAKE_BUILD_TYPE Release)
endif()

-if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|AMD64)")
- if(CYGWIN OR MINGW)
- set(ASM_LIB ${CMAKE_SOURCE_DIR}/libs/libacof64.lib)
- elseif(UNIX AND NOT APPLE)
- set(ASM_LIB ${CMAKE_SOURCE_DIR}/libs/libaelf64.a)
- elseif(APPLE)
- set(ASM_LIB ${CMAKE_SOURCE_DIR}/libs/libamac64.a)
- endif()
- link_libraries(${ASM_LIB})
-endif()
-
link_libraries(pthread)

if(CYGWIN OR MINGW)
36 changes: 20 additions & 16 deletions recipes/mbgc/build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#! /bin/bash
#!/bin/bash

mkdir -p $PREFIX/bin
mkdir build
cd build
export CPATH=${BUILD_PREFIX}/include
export CXXPATH=${BUILD_PREFIX}/include
export CFLAGS="$CFLAGS -I$BUILD_PREFIX/include"
export CXXFLAGS="$CFLAGS -I$BUILD_PREFIX/include"
export LDFLAGS="$LDFLAGS -L$BUILD_PREFIX/lib"
cmake ..
if [[ "$(uname)" == "Linux" ]]; then
make mbgc
else
make mbgc-noavx
mv mbgc-noavx mbgc
fi
cp mbgc $PREFIX/bin

export INCLUDES="-I${PREFIX}/include"
export LIBPATH="-L${PREFIX}/lib"
export CXXFLAGS="${CXXFLAGS} -I${PREFIX}/include"
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"

if [[ `uname` == "Darwin" ]]; then
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
else
export CONFIG_ARGS=""
fi

cmake -S . -B build -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
"${CONFIG_ARGS}"
cmake --build build --target mbgc -j "${CPU_COUNT}" -v

chmod 0755 build/mbgc
cp -rf build/mbgc $PREFIX/bin
27 changes: 18 additions & 9 deletions recipes/mbgc/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ package:
version: {{ version }}

build:
number: 0
number: 1
run_exports:
- {{ pin_subpackage('mbgc', max_pin="x") }}

source:
url: https://github.com/kowallus/mbgc/archive/refs/tags/v{{ version }}.tar.gz
sha256: fb422fc89aa95d82dab0b1431b7f220d5f4cdab2dfc1141218e74668461fa530
sha256: fb422fc89aa95d82dab0b1431b7f220d5f4cdab2dfc1141218e74668461fa530
patches:
- asmlib_off.patch # [osx and x86_64]

requirements:
build:
Expand All @@ -20,21 +22,28 @@ requirements:
- make
host:
- llvm-openmp # [osx]
- libgomp # [linux]
run:
- llvm-openmp # [osx]

- llvm-openmp # [osx]
- libgomp # [linux]

test:
commands:
- mbgc -v 2>&1 | grep -F {{ version }}

about:
home: https://github.com/kowallus/mbgc
license: GPL3
license: "GPL-3.0-or-later"
license_file: LICENSE
license_family: GPL
summary: A tool for compressing collection of genomes in FASTA format
license_family: GPL3
summary: "A tool for compressing collection of genomes in FASTA format."
dev_url: https://github.com/kowallus/mbgc

extra:
maintainers:
additional-platforms:
- linux-aarch64
- osx-arm64
recipe-maintainers:
- kowallus

identifiers:
- doi:10.1093/gigascience/giab099

0 comments on commit 83d2492

Please sign in to comment.