Mail archive
alpine-devel

Re: [alpine-devel] Porting Alpine scripts

From: Timo Teras <timo.teras_at_iki.fi>
Date: Sat, 23 Jul 2016 09:29:44 +0300

On Sat, 23 Jul 2016 05:43:49 +0700
"Tuan M. Hoang" <tmhoang_at_flatglobe.org> wrote:

> ---- On Fri, 22 Jul 2016 12:45:14 +0700 Timo Teras
> <timo.teras_at_iki.fi> wrote ----
> >
> > My scripts expect that you add CBUILD there. Though it's trivial
> > to get it from $(gcc -dumpmachine), I think that should be added
> > to abuild. I'll probably do that soon. I think most of the
> > environment variables set the cross .conf files should in fact be
> > set in abuild already. I'll look in to doing that as well.
> >
>
> For some commands, running without CBUILD being set is okay, some are
> not. I cannot remember which is which but If I see them again, I will
> tell you.

I just pushed few commits to abuild, that set CBUILD by default
properly. It also fixes dependency installation for host/target to not
run scripts, that would become error later on the build process too.

Please try latest abuild git version if it helps.

> > Though, we are currently looking into improving the build system a
> > bit more to support cross-building better, including supporting it
> > directly from abuild command line and building things
> > automatically in chroot. This needs a bit of design, but is on the
> > way.
>
> That's really good to know. I would like to help in that process, or
> try it out and give feedback.

I actually want first fix cross building to be supported properly. So
just doing "CHOST=aarch64 abuild -r" would to cross-compile aarch64
version of package on any build system.

I have first patch ready for this that makes all the cross-compile
script config entries built-in to abuild.

The second patch is make abuild properly aware of subpkg's arch. This
is tricky since when make cross toolchain we are generating packages
for the host and the target. But I got this almost done.

The above two will greatly simplify the bootstrap scripts, which I'll
probably dump to aports along with instructions. We've been getting lot
of questions for bootstrapping recently...

> > abuild will deduce CARCH from CHOST. You need to add s390x support
> > to abuild. See commit:
> > http://git.alpinelinux.org/cgit/abuild/commit/?id=580dd46c588ef71bc852d2b9a5bb4426a2c47665
>
> This one is very helpful. I had to set CARCH to some commands around
> for a while even though I do *guess* it should be deduced from CHOST,
> by reading /usr/bin/abuild.

Could you share what target triplet you are using? And what CARCH? I'll
be happy to push these to abuild early, even if everything is not
working.

> > The lib64 is gcc default, and on x86_64 and aarch64 it's similar.
> > We patch the lib location for these architectures, see:
> > http://git.alpinelinux.org/cgit/aports/tree/main/gcc/gcc-pure64.patch
> >
> > You probably need to add similar change for
> > gcc/config/s390/t-linux64.
>
> Looks like gold to me. Progressing on it.
>
> > > Question 2:
> > >
> > > So when you started porting armv7 and aarch, which files in the
> > > aports tree you had to make changes ? Theoretically I can check
> > > in the git log but that would be a lot, I think :(
> >
> > Not too many. You probably need (aarch64 commit referred):
> >
> > - abuild to recognize the triplet (the commit refferred earlier)
> > http://git.alpinelinux.org/cgit/abuild/commit/?id=580dd46c588ef71bc852d2b9a5bb4426a2c47665
> >
> > - apk-tools to use the same arch name
> > http://git.alpinelinux.org/cgit/apk-tools/commit/?id=06ae5fdfdccd0c8e6d5501d93666bd915d2604d1
> >
> > - gcc to be configured correct for the arch
> > http://git.alpinelinux.org/cgit/aports/commit/main/gcc?id=db1d2c069e66b3bf9962d76b0b48bfdcfc8d0384
> > (the ada change is generic, you'll need the _arch_configure +
> > gcc-pure64.patch update)
> >
> > And update APKBUILDs for the packages that are arch aware; for
> > minimal bootstrap it includes:
> >
> > - linux-headers
> > http://git.alpinelinux.org/cgit/aports/commit/?id=f483f49692b97950b680d987fe31f8ddb9277842
> >
> > - openssl
> > http://git.alpinelinux.org/cgit/aports/commit/?id=896f06e3b0b07200957d0389e2156d0ee4e099cb
> >
> > - linux-vanilla (or the kernel you need, including creating kernel
> > configuration)
> > http://git.alpinelinux.org/cgit/aports/commit/?id=baa04a75170112f9713dd5ad72a5732f9bfaeaac
> > Some packages might also need other kind of patching, e.g. if
> > configure does not recognize the new triplet.
> >
>
> It's much easier to have some existed work to follow. I have patched
> some APKBUILD myself along the way (gcc, musl, apk-tools, libfetch,
> openssl ...) and it is kind of painful, when you are new to Alpine. I
> will use your work and suggestion and come back after few days.

Understand. Porting things to new systems is usually not easy. It's
often done by few people only and the documentation is scarce.

This thread has been useful also for us to understand what questions
come across. I'll probably collect things from here and dump them to
the readme along with the enhanced bootstrap scripts.

Thanks,
Timo


---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Sat Jul 23 2016 - 09:29:44 GMT