Difference between revisions of "User:Drobbins/CLFS"

From Funtoo
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Self-Contained CLFS ==
== Isolated CLFS Script ==


Getting CLFS building entirely in your existing user's home directory should be possible.
Right now, CLFS as-is requires some changes to the host system -- the creation of {{f|/tools}} and {{f|/cross-tools}} symlinks on the root filesystem, as well as creation of a {{c|clfs}} user along with a custom {{c|.bash_profile}} and {{c|.bashrc}} for that user. Rather than do this, I'm working on getting each build working from a self-contained script as a regular user without these requirements.


I'm working on cleaning up some things in CLFS, and want to see if we can build everything inside someone's home directory -- creating the {{f|/tools}} and {{f|/cross-tools}} symlinks on the root filesystem is a bit messy. I also want to see if there is a simpler way to create a clean environment than creating a separate {{c|clfs}} user. In theory, this should not be necessary. We can create a clean-room shell environment like this:
The script below accomplishes the following things when it builds {{c|file-5.19}}:
* It creates a shell that is unpolluted with existing environment settings, setting just what is needed for the build, just like the {{c|clfs}} user environment does in CLFS.
* Directory structure is located inside the user's home directory: {{f|/home/drobbins/sexybeast}}.
* Cross-tools are located at {{f|/home/drobbins/sexybeast/cross-tools}}, and the build uses this path directly rather than {{f|/cross-tools}}. This is done by tweaking {{c|$DESTDIR}} for {{c|make install}} rather than {{c|--prefix}} for {{c|./configure}}. Should be fine using this approach.
 
So I think script essentially wraps the CLFS cross-tools build process in a self-contained build environment without the typical CLFS host-related tweaks described above.


{{file|lang=bash|body=
{{file|lang=bash|body=
Line 10: Line 15:
set +h
set +h
umask 022
umask 022
# ==========================================================
# Set up the environment variables:
# ==========================================================
export HOME=/home/drobbins
export HOME=/home/drobbins
export CLFS=$HOME/sexybeast
export CLFS=$HOME/sexybeast
Line 18: Line 26:
unset CFLAGS CXXFLAGS
unset CFLAGS CXXFLAGS
echo Hello.
echo Hello.
export CLFS_HOST=$(echo ${MACHTYPE} | sed -e 's/-[^-]*/-cross/')
export CLFS_HOST=$(echo ${MACHTYPE} {{!}} sed -e 's/-[^-]*/-cross/')
export CLFS_TARGET="powerpc64-unknown-linux-gnu"
export CLFS_TARGET="powerpc64-unknown-linux-gnu"
export BUILD64="-m64"
export BUILD64="-m64"
# ==========================================================
# The actual build steps go here:
# ==========================================================
cd file-5.19 && ./configure --prefix=/ --disable-static && \
cd file-5.19 && ./configure --prefix=/ --disable-static && \
make -j && \
make -j && \

Latest revision as of 04:17, February 9, 2022

Isolated CLFS Script

Right now, CLFS as-is requires some changes to the host system -- the creation of /tools and /cross-tools symlinks on the root filesystem, as well as creation of a clfs user along with a custom .bash_profile and .bashrc for that user. Rather than do this, I'm working on getting each build working from a self-contained script as a regular user without these requirements.

The script below accomplishes the following things when it builds file-5.19:

  • It creates a shell that is unpolluted with existing environment settings, setting just what is needed for the build, just like the clfs user environment does in CLFS.
  • Directory structure is located inside the user's home directory: /home/drobbins/sexybeast.
  • Cross-tools are located at /home/drobbins/sexybeast/cross-tools, and the build uses this path directly rather than /cross-tools. This is done by tweaking $DESTDIR for make install rather than --prefix for ./configure. Should be fine using this approach.

So I think script essentially wraps the CLFS cross-tools build process in a self-contained build environment without the typical CLFS host-related tweaks described above.

    (bash source code)
#!/bin/bash
exec /usr/bin/env -i /bin/bash --noprofile --norc << "EOF"
set +h
umask 022
# ==========================================================
# Set up the environment variables:
# ==========================================================
export HOME=/home/drobbins
export CLFS=$HOME/sexybeast
export CLFS_CROSS_TOOLS=${CLFS}/cross-tools
export D=${CLFS_CROSS_TOOLS}
export LC_ALL=POSIX
export PATH=$CLFS/cross-tools/bin:/bin:/usr/bin
unset CFLAGS CXXFLAGS
echo Hello.
export CLFS_HOST=$(echo ${MACHTYPE} | sed -e 's/-[^-]*/-cross/')
export CLFS_TARGET="powerpc64-unknown-linux-gnu"
export BUILD64="-m64"
# ==========================================================
# The actual build steps go here:
# ==========================================================
cd file-5.19 && ./configure --prefix=/ --disable-static && \
make -j && \
make DESTDIR=${D} install
EOF