Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 934015 - sys-devel/llvm-mingw ebuild skell
Summary: sys-devel/llvm-mingw ebuild skell
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-10 19:06 UTC by necrose99
Modified: 2024-06-12 21:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description necrose99 2024-06-10 19:06:32 UTC
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit pax-utils readme.gentoo-r1 unpacker

DESCRIPTION="An LLVM/Clang/LLD-based mingw-w64 toolchain"
HOMEPAGE="https://github.com/mstorsjo/llvm-mingw"
LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="msvcrt ucrt"
RESTRICT="bindist mirror"

QA_PREBUILT="/opt/llvm-mingw/${MY_PV}/*"

# Map versions of llvm-mingw to system LLVM versions
declare -A LLVM_VERSIONS
LLVM_VERSIONS=(
    ["20240606"]="18.1.7"
    ["20240518"]="18.1.6"
    ["20231128"]="17.0.6"
    ["20230614"]="16.0.6"
)

# Set my_pv based on the release date
MY_PV="20231128"  # Set this to the desired version date

LLVM_VERSION="${LLVM_VERSIONS[${MY_PV}]}"
if [[ -z "${LLVM_VERSION}" ]]; then
    die "Unknown MY_PV: ${MY_PV}"
fi

BASE_URI="https://github.com/mstorsjo/llvm-mingw/releases/download/${MY_PV}"
SUFFIX="ubuntu-20.04"

# Determine the correct tarball based on USE flags
if use msvcrt; then
    FLAG="msvcrt"
elif use ucrt; then
    FLAG="ucrt"
else
    die "Either 'msvcrt' or 'ucrt' USE flag must be set"
fi

SRC_URI="amd64? ( ${BASE_URI}/llvm-mingw-${MY_PV}-${FLAG}-${SUFFIX}-x86_64.tar.xz )
         arm64? ( ${BASE_URI}/llvm-mingw-${MY_PV}-${FLAG}-${SUFFIX}-aarch64.tar.xz )"

DOC_URI="https://raw.githubusercontent.com/mstorsjo/llvm-mingw/master/README.md"

DEPEND=""
RDEPEND="${DEPEND}"

src_prepare() {
    wget "${DOC_URI}" -P "${WORKDIR}"
}

src_install() {
    cd "${S}"

    # Install llvm-mingw binaries
    insinto "/opt/llvm-mingw/${MY_PV}"
    doins -r "${S}"/*

    # Create relative symlinks for clang mingw binaries
    find "${ED}/opt/llvm-mingw/${MY_PV}/bin" -type f -executable -exec ln -s "../../../../../opt/llvm-mingw/${MY_PV}/bin/{}" "/usr/lib/llvm/${LLVM_VERSION}/bin/{}" \;

    # Install licenses
    insinto "/usr/share/licenses/llvm-mingw"
    doins "LICENSE"

    # Install documentation
    insinto "/usr/share/doc/llvm-mingw"
    doins "README.md"
}
Comment 1 necrose99 2024-06-12 21:10:58 UTC
https://github.com/Infrasonics/eselect-llvm or gcc-config alike all the  easier 
seems they canned the  eslect-llvm idea ??? ... else like crossdev 
gcc-config/eselect-llvm  /opt/rpi5-genpi , chroot bang out bins rsync binhost n done .. 
eselect-llvm seems it could have in theory handled  swapping from systems-llvm/clang  to llvm-mingw and back to systemsset ...

forgoing need of doing symlinks etc ie # Create relative symlinks for clang mingw binaries for system clang folders etc ...  

 

but as i gathered registry file in each $pv llvm ... seen article mentioning or new updates on emerge eons ago... 

# Create relative symlinks for clang mingw binaries  

this likely would need filtering as to not clober the system clang but symlink libs , and commandeered items to extend the system-llvm/clang appropriately 

ie clang-mingw-$pv into system clang 

else a bash script derivation of sys-devel/clang-toolchain-symlinks
as sys-devel/clang-toolchain-symlinks-mingw  for arm64 gcc crossdev styled symlinks for GCC if wanted /fix clang-llvm--mingw-gcc symlinks as needed 

FLAG="msvcrt  FLAG="ucrt" some time ago this was quite Arch specific ie arm64/AMD64 @@@@ a Caveat i might have forgotten ? @@@@

# Determine the correct tarball based on USE flags

### Enjoy ... .