Skip to content

Commit

Permalink
Build shared library for quicktree (bioconda#45326)
Browse files Browse the repository at this point in the history
* Build shared library for quicktree

* Make BSD mkdir happy
  • Loading branch information
twrightsman authored Jan 24, 2024
1 parent faf579b commit 820dc54
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
9 changes: 8 additions & 1 deletion recipes/quicktree/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

mkdir -p $PREFIX/bin
set -eux

mkdir -p "$PREFIX"/{bin,lib,include/quicktree}

make CC=$CC

cp quicktree $PREFIX/bin
cp libquicktree.so "${PREFIX}/lib/"
# some header files are named generic enough to warrant namespacing
cp include/*.h "${PREFIX}/include/quicktree/"
11 changes: 8 additions & 3 deletions recipes/quicktree/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
{% set name = "quicktree" %}
{% set version = "2.5" %}

package:
name: quicktree
name: {{ name }}
version: {{ version }}

source:
url: https://github.com/khowe/quicktree/archive/v{{ version }}.tar.gz
sha256: 731aa845ce3f1f0645bd0df2b54df75f78fce065d6a3ddc47fedf4bdcb11c248
patches:
- patches/0001-Add-rule-to-build-shared-library.patch

build:
number: 4
number: 5
run_exports:
- {{ pin_subpackage(name, max_pin="x") }}


requirements:
build:
- make
- {{ compiler('c') }}
run:

test:
commands:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From 390c2db84a0fd0ff3a05d77407d18da3b9c26d63 Mon Sep 17 00:00:00 2001
From: Travis Wrightsman <[email protected]>
Date: Sat, 20 Jan 2024 17:46:20 -0500
Subject: [PATCH] Add rule to build shared library

---
Makefile | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 14e42a4..7fe8385 100644
--- a/Makefile
+++ b/Makefile
@@ -15,15 +15,18 @@ QUICKTREEOBJ = $(COMMON) $(OBJ)/quicktree.o $(OBJ)/buildtree.o $(OBJ)/tree.o


CC = gcc
-CFLAGS = -c -I$(INC) -O2 -Wunused-result
+CFLAGS = -c -I$(INC) -O2 -Wunused-result -fPIC

LFLAGS = -g

-all: quicktree
+all: quicktree libquicktree.so

quicktree : $(QUICKTREEOBJ)
$(CC) $(LFLAGS) -o $@ $(QUICKTREEOBJ) -lm

+libquicktree.so: $(QUICKTREEOBJ)
+ $(CC) -shared $(LFLAGS) -o $@ $(QUICKTREEOBJ) -lm
+
$(OBJ)/quicktree.o : $(SRC)/quicktree.c $(INC)/version.h
$(CC) $(CFLAGS) -o $(OBJ)/quicktree.o $(SRC)/quicktree.c

@@ -52,4 +55,4 @@ $(OBJ)/options.o : $(SRC)/options.c $(INC)/options.h
$(CC) $(CFLAGS) -o $(OBJ)/options.o $(SRC)/options.c

clean:
- rm $(OBJ)/*.o quicktree
+ rm $(OBJ)/*.o quicktree libquicktree.so
--
2.39.2

0 comments on commit 820dc54

Please sign in to comment.