Commit 3562db63 authored by Faustino E. Osuna's avatar Faustino E. Osuna Committed by Jean-Baptiste Kempf

VLCKit: make sure that the right archs exist

When preparing the framework, guarantee that the expected
architectures are present. If they are not present, or if an
unexpected architecture is present, then reconstruct the universal
binary.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 57b5204e
...@@ -148,34 +148,54 @@ vlc_install() { ...@@ -148,34 +148,54 @@ vlc_install() {
vlc_install_object "$main_build_dir/$src_dir/$src" "$dest_dir" "$type" $5 vlc_install_object "$main_build_dir/$src_dir/$src" "$dest_dir" "$type" $5
else else
local fatdest="$dest_dir/$2" local fatdest="$dest_dir/$2"
local shouldUpdateFat="no" local shouldUpdate="no"
local objects="" # Determine what architectures are available in the destination image
local fatdest_archs=""
if [ -e ${fatdest} ]; then
fatdest_archs=`lipo -info "${fatdest}" 2> /dev/null | sed -E -e 's/[[:space:]]+$//' -e 's/.+:[[:space:]]*//' -e 's/[^[:space:]]+/(&)/g'`
# Check to see if the destination image needs to be reconstructed
for arch in $ARCHS; do
# Only install if the new image is newer than the one we have installed or the required arch is missing.
if test $shouldUpdate = "no" && (! [[ "$fatdest_archs" =~ \($arch\) ]] || test "$VLC_BUILD_DIR/$arch/$src_dir/$src" -nt "${fatdest}"); then
shouldUpdate="yes"
fi
fatdest_archs=${fatdest_archs//\($arch\)/}
done
# Reconstruct the destination image, if the update flag is set or if there are more archs in the desintation then we need
fatdest_archs=${fatdest_archs// /}
else
# If the destination image does not exist, then we have to reconstruct it
shouldUpdate="yes"
fi
# If we should update the destination image or if there were unexpected archs in the destination image, then reconstruct it
if test "$shouldUpdate" = "yes" || test -n "${fatdest_archs}"; then
# If the destination image exists, get rid of it so we can copy over the newly constructed image
if test -e ${fatdest}; then
rm "$fatdest"
fi
# Create a temporary destination dir to store each ARCH object file # Create a temporary destination dir to store each ARCH object file
local tmp_dest_dir="$VLC_BUILD_DIR/tmp/$type" local tmp_dest_dir="$VLC_BUILD_DIR/tmp/$type"
rm -Rf "${tmp_dest_dir}/*" rm -Rf "${tmp_dest_dir}/*"
mkdir -p "$tmp_dest_dir" mkdir -p "$tmp_dest_dir"
# Search for each ARCH object file used to construct a fat image
local objects=""
for arch in $ARCHS; do for arch in $ARCHS; do
local arch_src="$VLC_BUILD_DIR/$arch/$src_dir/$src" local arch_src="$VLC_BUILD_DIR/$arch/$src_dir/$src"
# Only install if the new image is newer than the one we have installed.
if ( (! test -e ${fatdest}) || test ${arch_src} -nt ${fatdest} ); then
vlc_install_object "$arch_src" "$tmp_dest_dir" "$type" "$5" "" ".$arch" vlc_install_object "$arch_src" "$tmp_dest_dir" "$type" "$5" "" ".$arch"
local dest="$tmp_dest_dir/$src.$arch" local dest="$tmp_dest_dir/$src.$arch"
if test -e ${dest}; then if [ -e ${dest} ]; then
if (! test "$dest_dir/$arch_src" -nt "${dest}"); then
shouldUpdateFat="yes"
fi
objects="${dest} $objects" objects="${dest} $objects"
else else
echo "Warning: building $arch_src without $arch" echo "Warning: building $arch_src without $arch"
fi fi
fi
done; done;
if test "$shouldUpdateFat" = "yes"; then
echo "Creating fat $type $fatdest" echo "Creating fat $type $fatdest"
lipo $objects -output "$fatdest" -create lipo $objects -output "$fatdest" -create
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment