Marcel Telka
2024-04-05 e5e9b978d16f3a418fcae51695fb9398f0a160ed
commit | author | age
e842d8 1 #
F 2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
5 # 1.0 of the CDDL.
6 #
7 # A full copy of the text of the CDDL should have accompanied this
8 # source.  A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
10 #
11
12 #
13 # Copyright 2016 Aurelien Larcher.  All rights reserved.
14 # Copyright 2019 Alexander Pyhalov
15 # Copyright 2019 Michal Nowak
16 # Copyright 2019 Till Wegmüller
17 # Copyright 2022 Klaus Ziegler
18 # Copyright 2023 Friedrich Kink
19 #
20
5bafa3 21 BUILD_BITS= 64
AW 22 BUILD_STYLE= cmake
e842d8 23 include ../../../make-rules/shared-macros.mk
F 24
25 COMPONENT_MJR_VERSION=    17
26 COMPONENT_BASE_VERSION=    $(COMPONENT_MJR_VERSION).0
27 COMPONENT_NAME=        clang-$(COMPONENT_MJR_VERSION)
e8024d 28 COMPONENT_VERSION=    $(COMPONENT_BASE_VERSION).6
e842d8 29 COMPONENT_SUMMARY=    LLVM tools and Clang compiler
F 30 COMPONENT_PROJECT_URL=    https://llvm.org/
31 COMPONENT_SRC=        $(LLVM_NAME)-$(COMPONENT_VERSION).src
32 COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.xz
e8024d 33 COMPONENT_ARCHIVE_HASH= sha256:b638167da139126ca11917b6880207cc6e8f9d1cbb1a48d87d017f697ef78188
e842d8 34 COMPONENT_ARCHIVE_URL=  https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
F 35 COMPONENT_FMRI=        developer/$(COMPONENT_NAME)
36 COMPONENT_CLASSIFICATION=    Development/C
37 COMPONENT_LICENSE=    BSD
38 COMPONENT_LICENSE_FILE=    LICENSE.TXT
39
5bafa3 40 LLVM_NAME= llvm
AW 41 CLANG_NAME= clang
e842d8 42
F 43 COMPONENT_ARCHIVE_1=    $(CLANG_NAME)-$(COMPONENT_VERSION).src.tar.xz
e8024d 44 COMPONENT_ARCHIVE_HASH_1= sha256:a78f668a726ae1d3d9a7179996d97b12b90fb76ab9442a43110b972ff7ad9029
e842d8 45 COMPONENT_ARCHIVE_URL_1=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE_1)
F 46
47 COMPONENT_ARCHIVE_2=    cmake-$(COMPONENT_VERSION).src.tar.xz
e8024d 48 COMPONENT_ARCHIVE_HASH_2= sha256:807f069c54dc20cb47b21c1f6acafdd9c649f3ae015609040d6182cab01140f4
e842d8 49 COMPONENT_ARCHIVE_URL_2=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE_2)
F 50
51 COMPONENT_ARCHIVE_3=    third-party-$(COMPONENT_VERSION).src.tar.xz
e8024d 52 COMPONENT_ARCHIVE_HASH_3= sha256:3054d0a9c9375dab1a4539cc2cc45ab340341c5d71475f9599ba7752e222947b
e842d8 53 COMPONENT_ARCHIVE_URL_3=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE_3)
F 54
55 include $(WS_MAKE_RULES)/common.mk
56
57 CMAKE_PREFIX= /usr/clang/$(COMPONENT_BASE_VERSION)
58
59 PKG_MACROS += GCC_VERSION=$(GCC_VERSION)
60
61 COMPONENT_POST_UNPACK_ACTION += \
62   $(UNPACK) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE_1) && \
63     $(MV) $(CLANG_NAME)-$(COMPONENT_VERSION).src $(COMPONENT_SRC)/tools/clang && \
64   $(UNPACK) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE_2) && \
65     $(MV) cmake-$(COMPONENT_VERSION).src/Modules $(COMPONENT_SRC)/cmake/ && \
66   $(RM) -r cmake-$(COMPONENT_VERSION).src && \
67   $(UNPACK) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE_3) && \
68         $(MKDIR) $(COMPONENT_SRC)/third-party && \
69     $(MV) third-party-$(COMPONENT_VERSION).src/unittest $(COMPONENT_SRC)/third-party && \
70     $(MV) third-party-$(COMPONENT_VERSION).src/benchmark $(COMPONENT_SRC)/third-party && \
71   $(RM) -r third-party-$(COMPONENT_VERSION).src
72
73 COMPONENT_PRE_CONFIGURE_ACTION = ( $(CLONEY) $(SOURCE_DIR) $(@D); )
74
75 COMPONENT_POST_INSTALL_ACTION =  \
76         for file in `echo $(PROTO_DIR)/$(CMAKE_PREFIX)/bin/*`; do \
77                 /usr/bin/elfedit -e 'dyn:runpath $(GCC_LIBDIR):$(CMAKE_PREFIX)/lib' $$file ; \
78         done && \
79         for file in \
80                 `ggrep -rlh '^\#!*/usr/bin/env python' $(PROTO_DIR)/$(CMAKE_PREFIX)`; do \
81           sed -i -e 's:\#!/usr/bin/env.*:\#!$(PYTHON):' $$file; \
82         done
83
84 CMAKE_OPTIONS += -DCMAKE_C_COMPILER=$(CC)
85 CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX)
86 CMAKE_OPTIONS += -DGCC_INSTALL_PREFIX=$(GCC_ROOT)
87 CMAKE_OPTIONS += -DCMAKE_CXX_LINK_FLAGS="-L$(GCC_LIBDIR) -Wl,-rpath,$(GCC_LIBDIR)"
88 CMAKE_OPTIONS += -DCMAKE_BUILD_TYPE=Release
89 CMAKE_OPTIONS += -DCLANG_DEFAULT_LINKER="/usr/bin/ld"
90 CMAKE_OPTIONS += -DLLVM_ENABLE_EH=ON
91 CMAKE_OPTIONS += -DLLVM_ENABLE_RTTI=ON
92 CMAKE_OPTIONS += -DLLVM_LINK_LLVM_DYLIB=ON
93 CMAKE_OPTIONS += -DLLVM_INCLUDE_BENCHMARKS=OFF
94 CMAKE_OPTIONS += -DLLVM_INSTALL_UTILS=ON
95 CMAKE_OPTIONS += -DCLANG_DEFAULT_RTLIB=libgcc
96 CMAKE_OPTIONS += -DCLANG_DEFAULT_CXX_STDLIB=libstdc++
97 CMAKE_OPTIONS += -DPYTHON_EXECUTABLE="$(PYTHON)"
98 CMAKE_OPTIONS += -DCMAKE_MODULE_PATH="$(SOURCE_DIR)/$(COMPONENT_SRC)/cmake/Modules"
99
ff281c 100 unexport SHELLOPTS
AW 101
102 COMPONENT_TEST_CMD = $(GMAKE)
103 COMPONENT_TEST_TARGETS = check-all
104 COMPONENT_TEST_ENV += PATH=$(PATH.gnu)
105
106 # Do not change the order of these regexp transforms.
107 COMPONENT_TEST_TRANSFORMS += \
108     '-e "/^Testing Time: .*$$/d" ' \
109     '-e "/^make.*$$/d" ' \
110     '-e "/^Failed Tests /,/Unexpected Passed:/p" ' \
111     '-e "" ' \
112     '-e "/.*/d" '
113
114 TESTSUITE_MAKE = $(GMAKE)
115
e842d8 116 # Auto-generated dependencies
F 117 PYTHON_REQUIRED_PACKAGES += runtime/python
118 REQUIRED_PACKAGES += $(GCC_RUNTIME_PKG)
119 REQUIRED_PACKAGES += $(GXX_RUNTIME_PKG)
120 REQUIRED_PACKAGES += SUNWcs
121 REQUIRED_PACKAGES += compress/zstd
122 REQUIRED_PACKAGES += library/libedit
123 REQUIRED_PACKAGES += library/libxml2
124 REQUIRED_PACKAGES += library/zlib
125 REQUIRED_PACKAGES += system/library
126 REQUIRED_PACKAGES += system/library/math