Skip to content

Commit

Permalink
Merge pull request #66 from isuruf/shared
Browse files Browse the repository at this point in the history
Build shared libraries as well
  • Loading branch information
isuruf authored Aug 17, 2019
2 parents a6cea95 + a514e57 commit 9dca44b
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 32 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
About llvmdev
=============
About llvm
==========

Home: http://llvm.org/

Expand Down Expand Up @@ -63,27 +63,29 @@ Current release info

| Name | Downloads | Version | Platforms |
| --- | --- | --- | --- |
| [![Conda Recipe](https://img.shields.io/badge/recipe-libllvm8-green.svg)](https://anaconda.org/conda-forge/libllvm8) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libllvm8.svg)](https://anaconda.org/conda-forge/libllvm8) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libllvm8.svg)](https://anaconda.org/conda-forge/libllvm8) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libllvm8.svg)](https://anaconda.org/conda-forge/libllvm8) |
| [![Conda Recipe](https://img.shields.io/badge/recipe-llvm-green.svg)](https://anaconda.org/conda-forge/llvm) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/llvm.svg)](https://anaconda.org/conda-forge/llvm) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/llvm.svg)](https://anaconda.org/conda-forge/llvm) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/llvm.svg)](https://anaconda.org/conda-forge/llvm) |
| [![Conda Recipe](https://img.shields.io/badge/recipe-llvmdev-green.svg)](https://anaconda.org/conda-forge/llvmdev) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/llvmdev.svg)](https://anaconda.org/conda-forge/llvmdev) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/llvmdev.svg)](https://anaconda.org/conda-forge/llvmdev) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/llvmdev.svg)](https://anaconda.org/conda-forge/llvmdev) |

Installing llvmdev
==================
Installing llvm
===============

Installing `llvmdev` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with:
Installing `llvm` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with:

```
conda config --add channels conda-forge
```

Once the `conda-forge` channel has been enabled, `llvmdev` can be installed with:
Once the `conda-forge` channel has been enabled, `libllvm8, llvm, llvmdev` can be installed with:

```
conda install llvmdev
conda install libllvm8 llvm llvmdev
```

It is possible to list all of the versions of `llvmdev` available on your platform with:
It is possible to list all of the versions of `libllvm8` available on your platform with:

```
conda search llvmdev --channel conda-forge
conda search libllvm8 --channel conda-forge
```


Expand Down Expand Up @@ -125,17 +127,17 @@ Terminology
produce the finished article (built conda distributions)


Updating llvmdev-feedstock
==========================
Updating llvm-feedstock
=======================

If you would like to improve the llvmdev recipe or build a new
If you would like to improve the llvm recipe or build a new
package version, please fork this repository and submit a PR. Upon submission,
your changes will be run on the appropriate platforms to give the reviewer an
opportunity to confirm that the changes result in a successful build. Once
merged, the recipe will be re-built and uploaded automatically to the
`conda-forge` channel, whereupon the built conda packages will be available for
everybody to install and use from the `conda-forge` channel.
Note that all branches in the conda-forge/llvmdev-feedstock are
Note that all branches in the conda-forge/llvm-feedstock are
immediately built and any created packages are uploaded, so PRs should be based
on branches in forks and branches in the main repository should only be used to
build distinct package versions.
Expand Down
2 changes: 1 addition & 1 deletion conda-forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ appveyor:
compiler_stack: comp7
max_py_ver: '37'
max_r_ver: '35'
provider: {linux_aarch64: azure, linux_ppc64le: native, win: azure}
provider: {win: azure}
travis:
secure: {BINSTAR_TOKEN: N3PMgkCAbqBPMfgsDc04XUBaHmxaHPihY9xEn0oKBM9nLN+mX6FbFNDYOtMf3mjpvutfyt6C5+9C3Cp5ET6wEFirnSBkdDs74qp0L3P9felfWMwh+PqrLYcQxf1FkEukLa0C5KQvbsEs4Qj+IZzetUDHRPzvKswGVN62kW2U80lEnaAuFQEb6M0ou61JEKifhH40tvOGlAYbG2jEAV86A6ANZFQSFuxd97Y15Ql8a7AY/Xys4Tf5L0IYtmP12/EB7gS1TWJJVyUojbv+5yaK4plP0ta2GavIQ770HCb/aWZtg/oyrnKQ9drwSyZq9h9ystRXtflLvCXRMaycnPoIHubaHDTJzcRwZ49JzUr/gh923S+b6K+106nl6vfITzwjK6h9W+qaJzxdahge4JIXZQdZ6uKR46QH7ksAE3J/q283UkB8S1v2/d66SAmu0QeAczDYr7k5XKrz3GZDtA5gtN4w0z5pdIp53sQh9GVu09GSBh74/ZdRdoMb5jBLcOkvo5ZMMc7KJDPl0NttbdwxvN2PvnDwJQDpQK4KLm2U1JDldf1suSP7eUfy2aTBGA/Be917xClez77MiL8+GHy8/rzVygpnekdnIIjJPFthxglqY6b846Yo+SVDd9BPKDrjpvCU5xg+BeMjq6jcoDyFOB93JAoDl0+dVHrjzubtwuE=}
3 changes: 2 additions & 1 deletion recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ cmake -G "Ninja" ^
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON ^
-DLLVM_ENABLE_LIBXML2=OFF ^
-DLLVM_ENABLE_ZLIB=OFF ^
-DLLVM_BUILD_LLVM_C_DYLIB=no ^
%SRC_DIR%

if errorlevel 1 exit 1

cmake --build . --target install
cmake --build .
if errorlevel 1 exit 1

bin\opt -S -vector-library=SVML -mcpu=haswell -O3 %RECIPE_DIR%\numba-3016.ll | bin\FileCheck %RECIPE_DIR%\numba-3016.ll
Expand Down
19 changes: 18 additions & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
set -x

# Make osx work like linux.
sed -i.bak "s/NOT APPLE AND ARG_SONAME/ARG_SONAME/g" cmake/modules/AddLLVM.cmake
sed -i.bak "s/NOT APPLE AND NOT ARG_SONAME/NOT ARG_SONAME/g" cmake/modules/AddLLVM.cmake

mkdir build
cd build

[[ $(uname) == Linux ]] && conditional_args="
-DLLVM_USE_INTEL_JITEVENTS=ON
"

if [[ "$target_platform" == "osx-64" ]]; then
export CONDA_BUILD_SYSROOT_BACKUP=${CONDA_BUILD_SYSROOT}
conda install -p $BUILD_PREFIX --quiet --yes clangxx_osx-64=${cxx_compiler_version}
export CONDA_BUILD_SYSROOT=${CONDA_BUILD_SYSROOT_BACKUP}
export CFLAGS="$CFLAGS -isysroot $CONDA_BUILD_SYSROOT"
export CXXFLAGS="$CXXFLAGS -isysroot $CONDA_BUILD_SYSROOT"
export LDFLAGS="$LDFLAGS -isysroot $CONDA_BUILD_SYSROOT"
fi

cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_RTTI=ON \
Expand All @@ -16,11 +31,13 @@ cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_ZLIB=OFF \
-DHAVE_LIBEDIT=OFF \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \
-DLLVM_BUILD_LLVM_DYLIB=yes \
-DLLVM_LINK_LLVM_DYLIB=yes \
${conditional_args} ..

make -j${CPU_COUNT}
make install || exit $?

if [[ "${target_platform}" == "linux-64" || "${target_platform}" == "osx-64" ]]; then
export TEST_CPU_FLAG="-mcpu=haswell"
Expand Down
9 changes: 9 additions & 0 deletions recipe/install_llvm.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd build
cmake --build . --target install
if errorlevel 1 exit 1

if "%PKG_NAME%" == "llvm-tools" (
del /f %LIBRARY_BIN%\*.dll
rmdir /S /Q %LIBRARY_LIB%
rmdir /S /Q %LIBRARY_INC%
)
21 changes: 21 additions & 0 deletions recipe/install_llvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cd build
make install

IFS='.' read -ra VER_ARR <<< "$PKG_VERSION"

if [[ "${PKG_NAME}" == libllvm* ]]; then
rm -rf $PREFIX/bin
rm -rf $PREFIX/include
rm -rf $PREFIX/share
mv $PREFIX/lib $PREFIX/lib2
mkdir -p $PREFIX/lib
mv $PREFIX/lib2/libLLVM-${VER_ARR[0]}${SHLIB_EXT} $PREFIX/lib
mv $PREFIX/lib2/lib*.so.${VER_ARR[0]} $PREFIX/lib || true
mv $PREFIX/lib2/lib*.${VER_ARR[0]}.dylib $PREFIX/lib || true
rm -rf $PREFIX/lib2
elif [[ "${PKG_NAME}" == "llvm-tools" ]]; then
rm -rf $PREFIX/lib
rm -rf $PREFIX/include
rm $PREFIX/bin/llvm-config
fi

108 changes: 92 additions & 16 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
{% set sha256 = "8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c" %}

{% set build_number = 2 %}
{% set major_ver = version.split(".")[0] %}

package:
name: llvmdev
name: llvm-package
version: {{ version }}

source:
fn: llvm-{{ version }}.src.tar.xz
url: http://llvm.org/releases/{{ version }}/llvm-{{ version }}.src.tar.xz
sha256: {{ sha256 }}
patches:
- llvm-lto-static.patch # [win]
# TODO add back for sake of llvm-lit: - partial-testing.patch
# TODO add back for sake of llvm-lit - partial-testing.patch
- D47188-svml-VF.patch # Fixes vectorizer and extends SVML support
# Revert an upstream change for Numba
# ref: https://github.com/numba/llvmlite/blob/v0.29.0/conda-recipes/0001-Revert-Limit-size-of-non-GlobalValue-name.patch
Expand All @@ -23,31 +23,107 @@ source:
build:
number: {{ build_number }}
skip: true # [(win and vc<14) or aarch64 or ppc64le]
merge_build_host: False

requirements:
build:
- {{ compiler('cxx') }}
- {{ compiler('cxx') }} # [not osx]
- cmake
- ninja # [win]
- python 3.7
- make
- libcxx {{cxx_compiler_version}} # [osx]
host:
- libcxx 4.0.1 # [osx]
run_constrained:
- llvm-meta {{ version }}
- libcxx {{cxx_compiler_version}} # [osx]

test:
files:
- numba-3016.ll
outputs:
# Contains everything
- name: llvmdev
script: install_llvm.sh # [not win]
script: install_llvm.bat # [win]
build:
activate_in_script: True
requirements:
build:
- {{ compiler('cxx') }} # [not osx]
- cmake
- ninja # [win]
- python 3.7
host:
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }}
- {{ pin_subpackage("llvm-tools", exact=True) }}
run:
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }}
- {{ pin_subpackage("llvm-tools", exact=True) }}
- libcxx >={{ cxx_compiler_version }} # [osx]
test:
commands:
- $PREFIX/bin/llvm-config --libs # [not win]
- if not exist %LIBRARY_INC%\\llvm\\Pass.h exit 1 # [win]
- test -f $PREFIX/include/llvm/Pass.h # [unix]
- test -f $PREFIX/lib/libLLVMCore.a # [not win]

commands:
- $PREFIX/bin/llvm-config --libs # [not win]
- $PREFIX/bin/llc -version # [not win]
# Contains the shared libraries. To make different LLVM libraries co-installable
# soversion is appended to the package name.
- name: libllvm{{ major_ver }}
script: install_llvm.sh # [not win]
build:
activate_in_script: True
run_exports: # [not win]
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }} # [not win]
requirements:
build:
- {{ compiler('cxx') }} # [not (osx or win)]
- cmake # [not win]
- python 3.7 # [not win]
host:
run:
- libcxx >={{ cxx_compiler_version }} # [osx]
test:
commands:
- test -f $PREFIX/lib/libLLVM-{{ major_ver }}${SHLIB_EXT} # [unix]

- if not exist %LIBRARY_INC%\\llvm\\Pass.h exit 1 # [win]
# This is a meta package so that people can use the latest libllvm and also
# for run_exports
- name: llvm
build:
run_exports: # [not win]
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }} # [not win]
requirements:
build:
host:
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }} # [not win]
run: # [not win]
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }} # [not win]
run_constrained: # [not win]
- llvmdev {{ version }} # [not win]
test:
commands:
- echo "Hello World!"

- test -f $PREFIX/include/llvm/Pass.h # [unix]
- test -f $PREFIX/lib/libLLVMCore.a # [not win]
# Contains LLVM tools
- name: llvm-tools
script: install_llvm.sh # [not win]
script: install_llvm.bat # [win]
build:
activate_in_script: True
requirements:
build:
- {{ compiler('cxx') }} # [not osx]
- cmake
- ninja # [win]
- python 3.7
host:
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }}
run:
- {{ pin_subpackage("libllvm" + major_ver, exact=True) }}
run_constrained:
- llvmdev {{ version }}
test:
commands:
- $PREFIX/bin/llc -version # [not win]
- if not exist "%LIBRARY_BIN%"\\llc.exe exit 1 # [win]
- llc -version # [win]

about:
home: http://llvm.org/
Expand Down

0 comments on commit 9dca44b

Please sign in to comment.