aboutsummaryrefslogblamecommitdiffstats
path: root/main/clang/APKBUILD
blob: d3cb24303367bef448cd68418f91cf14b0d5a18e (plain) (tree)
1
2
3
4
5
6
7
8
9
                                             


                                                   
                                  

            
                      
                                                
          
                      
              
             

               
                   
                       

                     


                                  
             
               
         
                             
                                       

                                                                    



                                                                    
                                  

         


                                  
                                    



                                                                     
                                             
                                              
                                       




                                            
                                     
                                     
 

                          

 


                            


                                                     
                                                                                                

 
           

                            
                                       
                                                       


          

                                            



                                                      
            
                                                      
                                                        


                    

                                          
                                       

                                                           
                                                   

 


                                                                                                                                                                                              
# Contributor Eric Molitor <eric@molitor.org>
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=clang
# Note: Update together with llvm.
pkgver=8.0.0
pkgrel=0
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
url="http://llvm.org/"
license="NCSA"
makedepends="
	cmake
	isl-dev
	libedit-dev
	libexecinfo-dev
	libxml2-dev
	libxml2-utils
	llvm${_llvmver}-dev
	llvm${_llvmver}-static
	llvm${_llvmver}-test-utils
	ninja
	python3
	"
checkdepends="diffutils bash"
depends_dev="$pkgname=$pkgver-r$pkgrel"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
	$pkgname-analyzer::noarch"
source="https://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz
	10-add-musl-triples.patch
	20-Enable-stack-protector-by-default-for-Alpine-Linux.patch"

builddir="$srcdir/cfe-$pkgver.src"

build() {
	mkdir -p "$builddir"/build
	cd "$builddir"/build

	cmake .. -G Ninja -Wno-dev \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_C_FLAGS_MINSIZEREL_INIT="$CFLAGS" \
		-DCMAKE_CXX_FLAGS_MINSIZEREL_INIT="$CXXFLAGS" \
		-DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT="$LDFLAGS" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=OFF \
		-DCLANG_VENDOR=Alpine \
		-DCLANG_BUILD_EXAMPLES=OFF \
		-DCLANG_INCLUDE_DOCS=ON \
		-DCLANG_INCLUDE_TESTS=ON \
		-DCLANG_PLUGIN_SUPPORT=ON \
		-DLIBCLANG_BUILD_STATIC=ON \
		-DLLVM_ENABLE_EH=ON \
		-DLLVM_ENABLE_RTTI=ON

	ninja clang-tblgen
	ninja
}

check() {
	cd "$builddir"/build

	case "$CARCH" in
	armhf) return;; # FIXME: tests fails on armhf
	esac
	lit -sv --param clang_site_config=$builddir/build/test/lib.site.cfg $builddir/build/test
}

package() {
	cd "$builddir"/build

	DESTDIR="$pkgdir" ninja install
	install -m 644 lib/libclang.a "$pkgdir"/usr/lib
}

static() {
	pkgdesc="Static libraries for clang"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

analyzer() {
	pkgdesc="Clang source code analysis framework"
	depends="$pkgname=$pkgver-r$pkgrel perl python2"

	cd "$pkgdir"

	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/libexec \
		"$subpkgdir"/usr/share/
	mv usr/bin/scan-* "$subpkgdir"/usr/bin/
	mv usr/libexec/*-analyzer "$subpkgdir"/usr/libexec/
	mv usr/share/scan-* "$subpkgdir"/usr/share/
}

sha512sums="98e540222719716985e5d8439116e47469cb01201ea91d1da7e46cb6633da099688d9352c3b65e5c5f660cbbae353b3d79bb803fc66b3be663f2b04b1feed1c3  cfe-8.0.0.src.tar.xz
367dcd43b42570b5688c4bb41daf2498447e9fa4384896e2b91782017a8ce15b1e6e15cb3a465595d69e681420fce170a6f9a57ea5268e21f0dec7d4605e4c4c  10-add-musl-triples.patch
97633748b8cb125d606dbbf22381a4371abf0f49a1632cc19e84a361f16677ca3bc1a7c87943a2875cb6d39e6b72728aa21f09a49ca435558841f53b44568727  20-Enable-stack-protector-by-default-for-Alpine-Linux.patch"