forked from alisw/alidist
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmake.sh
More file actions
64 lines (56 loc) · 2.06 KB
/
cmake.sh
File metadata and controls
64 lines (56 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package: CMake
version: "%(tag_basename)s"
tag: "v3.31.6"
source: https://github.com/Kitware/CMake
requires:
- "OpenSSL:(?!osx)"
- "GCC-Toolchain:(?!osx)"
- zlib
- curl
build_requires:
- make
- alibuild-recipe-tools
prefer_system: osx.*
prefer_system_check: |
verge() { [[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]]; }
verle() { [[ "$1" = "$(echo -e "$1\n$2" | sort -V -r | head -n1)" ]]; }
current_version=$(cmake --version | sed -e 's/.* //' | cut -d. -f1,2,3)
echo alibuild_system_replace: cmake"$current_version"
type cmake && verge 3.28.1 $current_version && verle 3.99.99 $current_version
prefer_system_replacement_specs:
"cmake.*":
env:
CMAKE_VERSION: ""
---
#!/bin/bash -e
SONAME=so
case $ARCHITECTURE in
osx*) SONAME=dylib ;;
esac
cat > build-flags.cmake <<- EOF
# Disable Java capabilities; we don't need it and on OS X might miss the
# required /System/Library/Frameworks/JavaVM.framework/Headers/jni.h.
SET(JNI_H FALSE CACHE BOOL "" FORCE)
SET(Java_JAVA_EXECUTABLE FALSE CACHE BOOL "" FORCE)
SET(Java_JAVAC_EXECUTABLE FALSE CACHE BOOL "" FORCE)
SET(ZLIB_LIBRARY $ZLIB_ROOT/lib/libz.$SONAME)
SET(ZLIB_INCLUDE_DIR $ZLIB_ROOT/include)
SET(CURL_LIBRARY $CURL_ROOT/lib/libcurl.$SONAME)
SET(CURL_INCLUDE_DIR $CURL_ROOT/include)
SET(BUILD_TESTING OFF)
# SL6 with GCC 4.6.1 and LTO requires -ltinfo with -lcurses for link to succeed,
# but cmake is not smart enough to find it. We do not really need ccmake anyway,
# so just disable it.
SET(BUILD_CursesDialog FALSE CACHE BOOL "" FORCE)
EOF
rsync -a --chmod=ugo=rwX --delete --exclude '**/.git' --delete-excluded $SOURCEDIR/ ./
./bootstrap --prefix=$INSTALLROOT \
${ZLIB_ROOT:+--no-system-zlib} \
${CURL_ROOT:+--no-system-curl} \
--init=build-flags.cmake \
${JOBS:+--parallel=$JOBS}
make ${JOBS+-j $JOBS}
make install/strip
mkdir -p etc/modulefiles
alibuild-generate-module --bin --lib > etc/modulefiles/$PKGNAME
mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles