summaryrefslogtreecommitdiffstats
path: root/chromium/build/google-clang.build
blob: 8117495e4d36e5df164111c6a51dd5649437cfae (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# $Id$
# Copyright 2023  Eric Hameleers, Eindhoven, NL
# All rights reserved.
#
#   Permission to use, copy, modify, and distribute this software for
#   any purpose with or without fee is hereby granted, provided that
#   the above copyright notice and this permission notice appear in all
#   copies.
#
#   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
#   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#   IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
#
# -----------------------------------------------------------------------------
# Extract the custom-built clang into its own package;
# this script must be sourced from within chromium.SlackBuild.
# -----------------------------------------------------------------------------

# Determine clang and associated chromium major versions:
CLANGMAJ=$(grep "^ *RELEASE_VERSION *=" $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/tools/clang/scripts/update.py  |cut -d= -f2 |tr -d "' ")
CHRMAJ=$(echo $VERSION |cut -d. -f1)

# Name and version of our packaged compiler:
PRGNAM2="google-clang"
VERSION2="${CLANGMAJ}_chromium${CHRMAJ}"

CURDIR="$(pwd)"

# We need these directories:
mkdir -p $TMP/package-${PRGNAM2}/{etc/profile.d,install}
mkdir -p $TMP/package-${PRGNAM2}/opt/$PRGNAM2-$VERSION2/{include,lib}

# Copy the binaries to the package directory:
rsync -a $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/third_party/llvm-build/Release+Asserts/bin $TMP/package-${PRGNAM2}/opt/$PRGNAM2-$VERSION2/
rsync -a $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/third_party/llvm-build/Release+Asserts/include/llvm $TMP/package-${PRGNAM2}/opt/$PRGNAM2-$VERSION2/include/
rsync -a $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/third_party/llvm-build/Release+Asserts/lib/*.a $TMP/package-${PRGNAM2}/opt/$PRGNAM2-$VERSION2/lib/
rsync -a $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/third_party/llvm-build/Release+Asserts/lib/*.so* $TMP/package-${PRGNAM2}/opt/$PRGNAM2-$VERSION2/lib/

# Add a package description:
cat <<EOT > $TMP/package-${PRGNAM2}/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.

            |-----handy-ruler------------------------------------------------------|
google-clang: google-clang (LLVM compiler toolkit)
google-clang:
google-clang: google-clang is a custom LLVM ${CLANGMAJ} clang compiler
google-clang: patched by Google and the only supported compiler
google-clang: for building Chromium ${CHRMAJ}.
google-clang:
google-clang:
google-clang: See:
google-clang: https://chromium.googlesource.com/chromium/src/+/main/docs/clang.md
google-clang: LLVM homepage: http://llvm.org/
google-clang:
EOT
cat <<EOT > $TMP/package-${PRGNAM2}/etc/profile.d/${PRGNAM2}.sh 
#!/bin/sh
export PATH="/opt/$PRGNAM2-$VERSION2/bin:\${PATH}"
EOT
chmod 0644 $TMP/package-${PRGNAM2}/etc/profile.d/${PRGNAM2}.sh 

# Create the package:
cd $TMP/package-${PRGNAM2}/
/sbin/makepkg --linkadd y --chown n $TMP/$PRGNAM2-$VERSION2-$ARCH-1alien.txz

# Back to original directory:
cd "${CURDIR}"