mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-14 00:21:08 +00:00
Initial support for setting up cross-build chroots.
This commit is contained in:
commit
fd4dde338a
3
debian/changelog
vendored
3
debian/changelog
vendored
@ -41,6 +41,9 @@ ubuntu-dev-tools (0.144) experimental; urgency=low
|
||||
[ Colin Watson ]
|
||||
* syncpackage: Default to <current_series>-proposed.
|
||||
|
||||
[ Steve Langasek ]
|
||||
* Initial support for setting up cross-build chroots.
|
||||
|
||||
-- Stefano Rivera <stefanor@debian.org> Mon, 29 Oct 2012 09:02:29 +0100
|
||||
|
||||
ubuntu-dev-tools (0.143) unstable; urgency=low
|
||||
|
@ -15,6 +15,10 @@ Listed below are the command line options for mk\-sbuild:
|
||||
.B \-\-arch\fR=\fIARCH
|
||||
What architecture to select (defaults to the native architecture).
|
||||
.TP
|
||||
.B \-\-target\fR=\fRARCH
|
||||
Set up the chroot as a cross-building environment targeting the specified
|
||||
architecture.
|
||||
.TP
|
||||
.B \-\-name\fR=\fINAME
|
||||
Base name for the schroot (arch is appended).
|
||||
.TP
|
||||
|
79
mk-sbuild
79
mk-sbuild
@ -6,6 +6,7 @@
|
||||
# Emmet Hikory <persia@ubuntu.com>
|
||||
# Scott Moser <smoser@ubuntu.com>
|
||||
# Stefano Rivera <stefanor@ubuntu.com>
|
||||
# Steve Langasek <steve.langasek@ubuntu.com>
|
||||
#
|
||||
# ##################################################################
|
||||
#
|
||||
@ -57,6 +58,7 @@ function usage()
|
||||
echo " --distro=DISTRO Install specific distro:"
|
||||
echo " 'ubuntu' or 'debian' "
|
||||
echo " (defaults to determining from release name)"
|
||||
echo " --target=ARCH Target architecture for cross-building"
|
||||
echo " --type=SCHROOT_TYPE Define the schroot type:"
|
||||
echo " 'directory'(default), 'file', or 'btrfs-snapshot'"
|
||||
echo " 'lvm-snapshot' is selected via --vg"
|
||||
@ -86,7 +88,7 @@ function usage()
|
||||
if [ -z "$1" ]; then
|
||||
usage
|
||||
fi
|
||||
OPTS=`getopt -o 'h' --long "help,debug,skip-updates,eatmydata,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,debootstrap-proxy:,personality:,distro:,vg:,type:" -- "$@"`
|
||||
OPTS=`getopt -o 'h' --long "help,debug,skip-updates,eatmydata,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,debootstrap-proxy:,personality:,distro:,vg:,type:,target:" -- "$@"`
|
||||
eval set -- "$OPTS"
|
||||
|
||||
VG=""
|
||||
@ -161,6 +163,10 @@ while :; do
|
||||
SCHROOT_TYPE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--target)
|
||||
TARGET_ARCH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@ -440,6 +446,20 @@ ubuntu)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
# target chroots only supported in precise and later, so ignore
|
||||
# the fact that powerpc was once not on ports.
|
||||
case "$TARGET_ARCH" in
|
||||
amd64 | i386)
|
||||
TARGET_MIRROR="http://archive.ubuntu.com/ubuntu"
|
||||
TARGET_SOURCES_SECURITY_URL="http://security.ubuntu.com/ubuntu"
|
||||
;;
|
||||
armhf | armel | hppa | ia64 | lpia | powerpc | sparc)
|
||||
TARGET_MIRROR="http://ports.ubuntu.com/ubuntu-ports"
|
||||
TARGET_SOURCES_SECURITY_URL="http://ports.ubuntu.com/ubuntu-ports"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Add edgy+ buildd tools
|
||||
if [ "$RELEASE" != "breezy" ] && [ "$RELEASE" != "dapper" ]; then
|
||||
# Disable recommends for a smaller chroot (gutsy and later only)
|
||||
@ -463,6 +483,10 @@ debian)
|
||||
if [ -z "$SOURCES_SECURITY_URL" ]; then
|
||||
SOURCES_SECURITY_URL="http://security.debian.org/"
|
||||
fi
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
TARGET_MIRROR="$DEBOOTSTRAP_MIRROR"
|
||||
TARGET_SOURCES_SECURITY_URL="$SOURCES_SECURITY_URL"
|
||||
fi
|
||||
# Unstable (aka "sid") does not have a security repository
|
||||
if [ "$RELEASE" = 'unstable' ] || [ "$RELEASE" = 'sid' ]; then
|
||||
SKIP_SECURITY=1
|
||||
@ -476,6 +500,18 @@ debian)
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
# Ultimately we would like there to be a "cross-build-essential-$arch"
|
||||
# package. In practice, the cross-g++ package is sufficient to pull in
|
||||
# everything we need.
|
||||
if ! target_tuple=$(dpkg-architecture -a"$TARGET_ARCH" -qDEB_HOST_GNU_TYPE 2>/dev/null)
|
||||
then
|
||||
echo "Unknown target architecture $TARGET_ARCH" >&2
|
||||
exit 1
|
||||
fi
|
||||
BUILD_PKGS="$BUILD_PKGS g++-$target_tuple pkg-config-$target_tuple dpkg-cross libc-dev:$TARGET_ARCH"
|
||||
fi
|
||||
|
||||
debootstrap_opts="--components=$(echo $COMPONENTS | tr ' ' ,)"
|
||||
if [ -n "$DEBOOTSTRAP_INCLUDE" ] ; then
|
||||
debootstrap_opts="$debootstrap_opts --include=$DEBOOTSTRAP_INCLUDE"
|
||||
@ -565,30 +601,53 @@ TEMP_SOURCES=`mktemp -t sources-XXXXXX`
|
||||
if [ -z "$TEMPLATE_SOURCES" ]; then
|
||||
TEMPLATE_SOURCES=~/.mk-sbuild.sources
|
||||
fi
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
MIRROR_ARCHS="[arch=$CHROOT_ARCH] "
|
||||
fi
|
||||
if [ -r "$TEMPLATE_SOURCES" ]; then
|
||||
cat "$TEMPLATE_SOURCES" > "$TEMP_SOURCES"
|
||||
else
|
||||
cat > "$TEMP_SOURCES" <<EOM
|
||||
deb ${DEBOOTSTRAP_MIRROR} RELEASE ${COMPONENTS}
|
||||
deb ${MIRROR_ARCHS}${DEBOOTSTRAP_MIRROR} RELEASE ${COMPONENTS}
|
||||
deb-src ${DEBOOTSTRAP_MIRROR} RELEASE ${COMPONENTS}
|
||||
EOM
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb [arch=$TARGET_ARCH] $TARGET_MIRROR RELEASE $COMPONENTS
|
||||
EOM
|
||||
fi
|
||||
if [ "$EXPERIMENTAL" -eq 1 ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb ${DEBOOTSTRAP_MIRROR} experimental ${COMPONENTS}
|
||||
deb ${MIRROR_ARCHS}${DEBOOTSTRAP_MIRROR} experimental ${COMPONENTS}
|
||||
deb-src ${DEBOOTSTRAP_MIRROR} experimental ${COMPONENTS}
|
||||
EOM
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb [arch=$TARGET_ARCH] $TARGET_MIRROR experimental $COMPONENTS
|
||||
EOM
|
||||
fi
|
||||
fi
|
||||
if [ -z "$SKIP_UPDATES" ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb ${DEBOOTSTRAP_MIRROR} RELEASE-updates ${COMPONENTS}
|
||||
deb ${MIRROR_ARCHS}${DEBOOTSTRAP_MIRROR} RELEASE-updates ${COMPONENTS}
|
||||
deb-src ${DEBOOTSTRAP_MIRROR} RELEASE-updates ${COMPONENTS}
|
||||
EOM
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb [arch=$TARGET_ARCH] $TARGET_MIRROR RELEASE-updates $COMPONENTS
|
||||
EOM
|
||||
fi
|
||||
fi
|
||||
if [ -z "$SKIP_SECURITY" ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb ${SOURCES_SECURITY_URL} ${SOURCES_SECURITY_SUITE} ${COMPONENTS}
|
||||
deb ${MIRROR_ARCHS}${SOURCES_SECURITY_URL} ${SOURCES_SECURITY_SUITE} ${COMPONENTS}
|
||||
deb-src ${SOURCES_SECURITY_URL} ${SOURCES_SECURITY_SUITE} ${COMPONENTS}
|
||||
EOM
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb [arch=$TARGET_ARCH] $TARGET_SOURCES_SECURITY_URL $SOURCES_SECURITY_SUITE $COMPONENTS
|
||||
EOM
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
cat "$TEMP_SOURCES" | sed -e "s|RELEASE|$RELEASE|g" | \
|
||||
@ -693,6 +752,16 @@ if [ -n "$proxy" ]; then
|
||||
Acquire { HTTP { Proxy "$proxy"; }; };
|
||||
EOF
|
||||
fi
|
||||
EOM
|
||||
|
||||
if [ -n "$TARGET_ARCH" ]; then
|
||||
sudo bash -c "cat >> $MNT/finish.sh" <<EOM
|
||||
# Configure target architecture
|
||||
dpkg --add-architecture "$TARGET_ARCH"
|
||||
EOM
|
||||
fi
|
||||
|
||||
sudo bash -c "cat >> $MNT/finish.sh" <<EOM
|
||||
# Reload package lists
|
||||
apt-get update || true
|
||||
# Pull down signature requirements
|
||||
|
Loading…
x
Reference in New Issue
Block a user