You are not logged in.

#1 2017-05-29 09:46:38

xaoc
Member
Registered: 2017-05-29
Posts: 3

[PGKBUILD] Create PKGBUILD that confilts with libc in /usr/lib/

Wiki say:

If you are unsure in any way about the package or the build/submission process even after reading this section twice, submit the PKGBUILD to the AUR mailing list, the AUR forum on the Arch forums, or ask on our IRC channel for public review before adding it to the AUR.

So I need help. Because I want to create a cross-compiler that use musl insted of glibc but if I would install it under /usr there will be conflicts. (libc, libm etc..) The system will be for certain dead. So I would prefer as suggested by musl install it in /opt/cross/. Is it allowed to push that kind of PKGBIULD do AUR?

Here is my PKGBUILD in creating mode.

# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.


# Maintainer: Sylwester Rąpała <sywester.rapala@igrid.tech>
_target="arm-linux-musleabihf"
pkgname="${_target}-gcc"
pkgver=6.3.0
pkgrel=1
_comit=b854a42fc1ea19b8c4ec7104848f9d1a6d7995f0 
# epoch=
pkgdesc="The GNU Compiler Collection with musl for ${_target}"
arch=('i686' 'x86_64')  # could it ba any?
url="http://gcc.gnu.org"
license=('GPL' 'LGPL' 'custom')
#groups=()
#depends=()
makedepends=('cmake')
#checkdepends=()
#optdepends=()
#provides=()
#conflicts=()
#replaces=()
#backup=()
options=('!libtool' '!buildflags' '!strip') 
#install=
#changelog=
source=(https://github.com/richfelker/musl-cross-make/archive/${_comit}.zip)
#noextract=()
md5sums=('e6cba37bc2dea601f51aa3ac5b77f517')
# validpgpkeys=()

_configfile="config.mak"
_output="/opt/cross2"
prepare() {

	mv ${srcdir}/musl-cross-make-${_commit}* ${srcdir}/"$pkgname-$pkgver"
	cd ${srcdir}/"$pkgname-$pkgver"
	
	# GENERAL CONFIG
	echo "  TARGET = ${_target}" > ${_configfile}
	echo "  OUTPUT = ${_output}" >> ${_configfile}
    # GCC_CONFIG
    echo "  GCC_CONFIG += --enable-languages=c,c++" >> ${_configfile}
    echo "  GCC_CONFIG += --disable-libquadmath --disable-decimal-float" >> ${_configfile}
    echo "  GCC_CONFIG += --disable-multilib" >> ${_configfile}
    echo "  GCC_CONFIG += --prefix=${_output}/${_target}
            GCC_CONFIG += --with-local-prefix=${_output}/${_target} 
            GCC_CONFIG += --with-sysroot=${_output}/${_target} 
            GCC_CONFIG += --with-build-sysroot=/${_output}/${_target} 
            GCC_CONFIG += --with-as=${_output}/bin/${_target}-as 
            GCC_CONFIG += --with-ld=${_output}/bin/${_target}-ld 
            GCC_CONFIG += --libdir=${_output}/lib --libexecdir=${_output}/lib 
            GCC_CONFIG += --target=${_target}" >> ${_configfile}
    
    if [ "$_target" = "arm-linux-musleabihf" ] ; then
        echo "  GCC_CONFIG += --with-arch=armv7-a --with-float=hard" >> ${_configfile}
    fi
    
    # COMMON_CONFIG
    echo "  COMMON_CONFIG += --disable-nls" >> ${_configfile}
    echo "  COMMON_CONFIG += CFLAGS=\"-g0 -O2\" CXXFLAGS=\"-g0 -O2\" LDFLAGS=\"-s\"" >> ${_configfile}
}

build() {
	cd ${srcdir}/"$pkgname-$pkgver"
	make
}

# check() {
#	cd "$pkgname-$pkgver"
#	make -k check
#}

package() {
	cd ${srcdir}/"$pkgname-$pkgver"
	make DESTDIR=${pkgdir} install
}

Second question
I use a musel-cross-make to install that package. So this download and install(?) more than just gcc (BINUTILS_VER = 2.27, MUSL_VER = 1.1.16, GMP_VER = 6.1.1, MPC_VER = 1.0.3, MPFR_VER = 3.1.4 and a linux headers) . So I should add it in
provides=()?

On my skill level I don't know how to install them separately.

Offline

#2 2017-05-29 10:04:22

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [PGKBUILD] Create PKGBUILD that confilts with libc in /usr/lib/

That won't be easy , as you'll have to build an entire toolchain .

https://wiki.archlinux.org/index.php/Cr … guidelines should help to get you started.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2017-05-29 15:22:38

xaoc
Member
Registered: 2017-05-29
Posts: 3

Re: [PGKBUILD] Create PKGBUILD that confilts with libc in /usr/lib/

But this musl-cross-make build everything. So the PKGBUILD work and create working gcc 6.3.0. But the question is. Am I allowed to add this PKGBUILD to AUR?!

Last edited by xaoc (2017-05-29 22:12:25)

Offline

#4 2017-05-30 13:13:33

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [PGKBUILD] Create PKGBUILD that confilts with libc in /usr/lib/

musl-cross-make readme.md wrote:

Automatic download of source packages, including GCC prerequisites (GMP, MPC, MPFR), using https and checking hashes.

Automatic patching with canonical musl support patches and patches which provide bug fixes and features musl depends on for some arch targets.

That suggests it's better suited for a manual install in a user folder to keep it separate from the normal system.

Creating a pkgbuild that installs in /opt/musl-cross-make/ should be doable though, assuming it's run as root or with a user that has write-access to that folder tree.

Theoretically it could be installed in /usr and replace the normal arch linux toolchain.
For many things the installed version needs to be close to / the same as the version used to built it .
The kernel is one of them.
To keep things working, you'd probably need a skill level comparable to that needed for creating an AL derivative distribution.

TL;DR :
you have 3 options :
A. build manually
B. put everything  under /opt
C. replace AL toolchain

If you choose A : start a wiki page to detail the needed steps

If you choose C : that's way above my skill level, it's unlikely i'll able to help further.

If you choose B , the PKGBUILD you posted needs improvements.
I suggest something like musl-cross-make-arm-eabihf    as pkgname .
The source you want is found here : https://github.com/richfelker/musl-cros … 9.6.tar.gz
No need to download a specific  _commit.

Last edited by Lone_Wolf (2017-05-30 13:14:30)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2017-05-31 22:13:32

xaoc
Member
Registered: 2017-05-29
Posts: 3

Re: [PGKBUILD] Create PKGBUILD that confilts with libc in /usr/lib/

In official repository there is a musl lib that install under /usr/lib/musl it also contains gcc-wraper under /usr/bin/musl-gcc

$ cd /usr/bin && musl-gcc -v                                                                                                                                     
Using built-in specs.
Reading specs from /usr/lib/musl/lib/musl-gcc.specs
rename spec cpp_options to old_cpp_options
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 6.3.1 20170306 (GCC) 

This is probably the correct why I should choose. But for now it's above my skill level. So I hope in the further I manage it.
For now I decide to host this PKGBUILD on my own repository.

Offline

Board footer

Powered by FluxBB