# $Id: google-clang.build,v 1.1 2023/03/06 21:55:56 root Exp root $ # 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}" # Location to create the package needs to be empty: PKG2=$TMP/package-$PRGNAM2 rm -rf $PKG2 CURDIR="$(pwd)" # We need these directories: mkdir -p $PKG2/{etc/profile.d,install} mkdir -p $PKG2/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 $PKG2/opt/$PRGNAM2-$VERSION2/ rsync -a $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/third_party/llvm-build/Release+Asserts/include/llvm $PKG2/opt/$PRGNAM2-$VERSION2/include/ rsync -a $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/third_party/llvm-build/Release+Asserts/lib/*.a $PKG2/opt/$PRGNAM2-$VERSION2/lib/ rsync -a $TMP/tmp-$PRGNAM/$SRCNAM-$VERSION/third_party/llvm-build/Release+Asserts/lib/*.so* $PKG2/opt/$PRGNAM2-$VERSION2/lib/ # Add a package description: cat < $PKG2/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 < $PKG2/etc/profile.d/${PRGNAM2}.sh #!/bin/sh export PATH="/opt/$PRGNAM2-$VERSION2/bin:\${PATH}" EOT chmod 0644 $PKG2/etc/profile.d/${PRGNAM2}.sh # Create the package: cd $PKG2/ /sbin/makepkg --linkadd y --chown n $OUTPUT/$PRGNAM2-$VERSION2-$ARCH-1alien.txz \ 2>&1 | tee $OUTPUT/makepkg-${PRGNAM2}.log cd $OUTPUT md5sum ${PRGNAM2}-${VERSION2}-${PKGARCH}-${BUILD}${TAG}.${PKGTYPE:-txz} > ${PRGNAM2}-${VERSION2}-${PKGARCH}-${BUILD}${TAG}.${PKGTYPE:-txz}.md5 cd - 1>/dev/null cat $PKG2/install/slack-desc | grep "^${PRGNAM2}" > $OUTPUT/${PRGNAM2}-${VERSION2}-${PKGARCH}-${BUILD}${TAG}.txt # Back to original directory: cd "${CURDIR}"