Added conda packaging script

This commit is contained in:
Bartek Kryza
2022-06-11 23:54:46 +02:00
parent 4724928c47
commit 4b1903e923
4 changed files with 86 additions and 1 deletions

2
.gitignore vendored
View File

@@ -21,7 +21,9 @@ bin/
docs/diagrams docs/diagrams
coverage*.info coverage*.info
packaging/_BUILD packaging/_BUILD
packaging/conda/meta.yaml
# CLion # CLion

View File

@@ -17,7 +17,7 @@
SHELL := /bin/bash SHELL := /bin/bash
.ONESHELL: .ONESHELL:
.PHONY: download deb clean .PHONY: download deb clean conda
NAME ?= clang-uml NAME ?= clang-uml
REBUILD ?= 1 REBUILD ?= 1
@@ -31,6 +31,8 @@ TAR_EXT ?= gz
build_dir = _BUILD/$(NAME)/$(OS)/$(DIST) build_dir = _BUILD/$(NAME)/$(OS)/$(DIST)
VERSION ?= $(shell git describe --tags --always --abbrev=7) VERSION ?= $(shell git describe --tags --always --abbrev=7)
COMMIT ?= $(shell git rev-parse HEAD)
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
# #
# Replace mustache template variable in all files in directory recursively, # Replace mustache template variable in all files in directory recursively,
@@ -41,6 +43,9 @@ define subst_template_dir
find $(3) -type f -exec sed -i "s/{{$(1)}}/$(2)/g" {} \; find $(3) -type f -exec sed -i "s/{{$(1)}}/$(2)/g" {} \;
endef endef
define subst_conda_meta_yaml
find $(3) -name meta.yaml -exec sed -i "s/{{$(1)}}/$(2)/g" {} \;
endef
deb: deb:
rm -rf $(build_dir) rm -rf $(build_dir)
@@ -67,3 +72,13 @@ deb:
debuild -S -sa -us -d -k$(GPG_KEY) #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession debuild -S -sa -us -d -k$(GPG_KEY) #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession
# BUILD LOCALLY BINARY PACKAGE # BUILD LOCALLY BINARY PACKAGE
#debuild -us -uc #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession #debuild -us -uc #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession
conda:
mkdir -p _BUILD/conda
git-archive-all --prefix=clang-uml-$(VERSION)/ _BUILD/conda/clang-uml-$(VERSION).tar.$(TAR_EXT)
cp conda/meta.yaml.in conda/meta.yaml
$(call subst_conda_meta_yaml,PKG_VERSION,${VERSION},conda)
$(call subst_conda_meta_yaml,PKG_SOURCE,..\/_BUILD\/conda\/clang-uml-$(VERSION).tar.$(TAR_EXT),conda)
$(call subst_conda_meta_yaml,GIT_COMMIT,${COMMIT},conda)
$(call subst_conda_meta_yaml,GIT_BRANCH,${BRANCH},conda)
conda build conda

23
packaging/conda/build.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
mkdir build && cd build
export PKG_CONFIG_PATH="$BUILD_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export CLANGUML_GIT_TOPLEVEL_DIR=${SRC_DIR}
cmake -DCMAKE_BUILD_TYPE=Release \
-DGIT_VERSION=${GIT_VERSION} \
-DCODE_COVERAGE=OFF \
-DWITH_TESTS=ON \
-DLLVM_CONFIG_PATH=${BUILD_PREFIX}/bin/llvm-config \
-DCONDA_BUILD_PREFIX=${BUILD_PREFIX} \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_EXE_LINKER_FLAGS="-lyaml-cpp" \
..
CTEST_OUTPUT_ON_FAILURE=1 make -j${CPU_COUNT}
CTEST_OUTPUT_ON_FAILURE=1 ctest -j${CPU_COUNT}
make install

View File

@@ -0,0 +1,45 @@
{% set name = "clang-uml" %}
{% set version = "{{PKG_VERSION}}" %}
package:
name: {{ name|lower }}
version: {{ version|replace('-', '.') }}
source:
url: "{{PKG_SOURCE}}"
build:
binary_relocation: true
script_env:
- PKG_VERSION
- CLANGUML_GIT_REVISION={{PKG_VERSION}}
- CLANGUML_GIT_BRANCH={{GIT_BRANCH}}
- CLANGUML_GIT_COMMIT={{GIT_COMMIT}}
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- conda-forge::pkg-config
- conda-forge::yaml-cpp 0.7.0
- conda-forge::clangdev 14.0.4
- conda-forge::libclang 14.0.4
- conda-forge::cmake
- conda-forge::git
- conda-forge::make # [unix]
run:
- conda-forge::yaml-cpp 0.7.0
- conda-forge::libclang 14.0.4
test:
commands:
- $PREFIX/bin/clang-uml --version
about:
home: https://github.com/bkryza/clang-uml
license: Apache 2.0
summary: clang-uml is an automatic C++ UML diagram generator based on Clang.
extra:
recipe-maintainers:
- bkryza