Skip to content

Commit

Permalink
Adding build artifacts for darwin_amd64
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Feb 7, 2024
1 parent acb68f2 commit f69f4d0
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 35 deletions.
79 changes: 49 additions & 30 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ BUILD_DIR=$SRC/build
DIST_DIR=
SVT=ON
DUMP=
OSX_SDK=

OPTIND=1
while getopts "b:cC:d:p:s:D:x" opt; do
while getopts "b:cC:d:p:s:D:A:x" opt; do
case "$opt" in
b) BUILDS=$OPTARG ;;
c) CLEAN=1 ;;
Expand All @@ -35,33 +36,42 @@ case "$opt" in
p) DIST_DIR=$OPTARG ;;
s) SVT=$(tr '[a-z]' '[A-Z]' <<< "$OPTARG") ;;
D) DUMP=$(realpath "$OPTARG") ;;
A) OSX_SDK=$OPTARG ;;
x) EXIT=1 ;;
esac
done

CROSS_TRIPLE= CMAKE=cmake CC= CXX=
if [ ! -z "$OSX_SDK" ]; then
CROSS_TRIPLE="$(awk '{print $1}' <<< "$OSX_SDK")-apple-$(awk '{print $2}' <<< "$OSX_SDK")"
CMAKE="$CROSS_TRIPLE-cmake"
CC="$CROSS_TRIPLE-clang"
CXX="$CROSS_TRIPLE-clang++"
fi

mkdir -p $CACHE $BUILD_DIR

if [ -z "$DIST_DIR" ]; then
DIST_DIR=$(realpath $BUILD_DIR/dist)
fi

urlver() {
basename "$1" \
repourl() {
awk '{print $1}' <<< "${REPOS[$1]}"
}

repover() {
basename "$(repourl "$1")" \
| sed \
-e 's/\.tar\.gz$//' \
-e 's/^v\?//'
}

repourl() {
awk '{print $1}' <<< "${REPOS[$1]}"
}

repohash() {
awk '{print $2}' <<< "${REPOS[$1]}"
}

repofile() {
echo $CACHE/$1-$(urlver "$(repourl "$1")").tar.gz
echo $CACHE/$1-$(repover "$1").tar.gz
}

relname() {
Expand All @@ -73,6 +83,9 @@ grab() {
curl -4 -L -# -o $2 $1
}

# store version
echo "v$(repover libheif)" > $SRC/version.txt

for build in $BUILDS; do
# cache
file=$(repofile $build)
Expand Down Expand Up @@ -111,7 +124,7 @@ done
if [ ! -z "$DUMP" ]; then
echo "DUMPING: $DUMP"
pushd $BUILD_DIR/libheif &> /dev/null
cmake --preset release-noplugins -N|sed 1,2d > $DUMP
$CMAKE --preset release-noplugins -N|sed 1,2d > $DUMP
popd &> /dev/null
perl -pi -e 's/^\s*//' $DUMP
perl -pi -e 's/"//g' $DUMP
Expand Down Expand Up @@ -143,15 +156,18 @@ build_libde265() {
fi
pushd $1 &> /dev/null
(set -x;
./autogen.sh
./configure \
--prefix="$DIST_DIR" \
--enable-static \
--disable-shared \
--disable-dec265 \
--disable-sherlock265 \
$extra
make -j$((`nproc`+2)) install
CC=$CC CXX=$CXX \
./autogen.sh
CC=$CC CXX=$CXX \
./configure \
--prefix="$DIST_DIR" \
--enable-static \
--disable-shared \
--disable-dec265 \
--disable-sherlock265 \
$extra
CC=$CC CXX=$CXX \
make -j$((`nproc`+2)) install
)
popd &> /dev/null
}
Expand All @@ -160,7 +176,7 @@ build_x265() {
mkdir -p $1/build
pushd $1 &> /dev/null
(set -x;
cmake \
$CMAKE \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DIST_DIR" \
Expand All @@ -176,7 +192,7 @@ build_aom() {
mkdir -p $1/build
pushd $1 &> /dev/null
(set -x;
cmake \
$CMAKE \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DIST_DIR" \
Expand All @@ -195,7 +211,7 @@ build_libwebp() {
mkdir -p $1/build
pushd $1 &> /dev/null
(set -x;
cmake \
$CMAKE \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DIST_DIR" \
Expand All @@ -213,7 +229,7 @@ build_svt() {
mkdir -p $1/build
pushd $1 &> /dev/null
(set -x;
cmake \
$CMAKE \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DIST_DIR" \
Expand All @@ -229,36 +245,39 @@ build_svt() {
build_zlib() {
pushd $1 &> /dev/null
(set -x;
./configure \
--prefix="$DIST_DIR" \
--static
make -j$((`nproc`+2)) install
CC=$CC CXX=$CXX \
./configure \
--prefix="$DIST_DIR" \
--static
CC=$CC CXX=$CXX \
make -j$((`nproc`+2)) install
)
popd &> /dev/null
}

build_libheif() {
# hack for windows preset issue
local preset="--preset release-noplugins"
if [[ "$CROSS_TRIPLE" =~ "w64" ]]; then
if [[ "$CROSS_TRIPLE" =~ (w64|apple) ]]; then
preset=$(build_vars $CACHE/linux_amd64.preset)
fi

mkdir -p $1/build
pushd $1 &> /dev/null
(set -x;
PKG_CONFIG_PATH=$DIST_DIR/lib/pkgconfig \
cmake \
$CMAKE \
$preset \
-G "Ninja" \
-DCMAKE_INSTALL_PREFIX="$DIST_DIR" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DWITH_EXAMPLES=OFF \
-DWITH_GDK_PIXBUF=OFF \
-DWITH_SvtEnc="$SVT" \
-DWITH_SvtEnc=$SVT \
-B ./build
ninja -C ./build install
#ninja -C ./build install
cmake --install ./build
)
popd &> /dev/null
}
Expand Down
18 changes: 13 additions & 5 deletions gen.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

OSX_SDK="darwin20.4"

SRC=$(realpath $(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd))

set -e
Expand All @@ -11,8 +13,8 @@ UPDATE=0
mkdir -p $CACHE

declare -A TARGETS=(
# [darwin_amd64]=darwin_x86_64
# [darwin_arm64]=darwin_aarch64
[darwin_amd64]=darwin_x86_64
[darwin_arm64]=darwin_aarch64
[linux_amd64]=linux_x86_64-full
[linux_arm64]=linux_arm64-full
[linux_arm]=linux_armv7
Expand Down Expand Up @@ -40,7 +42,13 @@ relname() {
}

osxcross() {
echo osxcross
local target=$1
local build_target="${TARGETS[$target]}"
local platform=$(sed -e 's/[-_]/ /' <<< "$build_target"|awk '{print $1}')
local arch=$(sed -e 's/[-_]/ /' <<< "$build_target"|awk '{print $2}')

dockcross linux_amd64 ".cache/linux_amd64.preset"
$SRC/build.sh -d $SRC/.cache/$target -A "$arch $OSX_SDK"
}

dockcross() {
Expand Down Expand Up @@ -74,7 +82,7 @@ dockcross() {
> $CACHE/build-$target.sh
chmod +x $CACHE/build-$target.sh
$CACHE/build-$target.sh \
bash -c "./build.sh -d .cache/libheif/$target -s $svt $dump"
bash -c "./build.sh -d .cache/$target -s $svt $dump"
)
}

Expand All @@ -91,7 +99,7 @@ BUILD_TARGETS=$(sed -e 's/\s\+/\n/g' <<< "$BUILD_TARGETS"|sort -i|tr '\n' ' ')
echo "TARGETS: $BUILD_TARGETS"

for TARGET in $BUILD_TARGETS; do
BUILD_DIR=$CACHE/libheif/$TARGET
BUILD_DIR=$CACHE/$TARGET
BUILD_TARGET="${TARGETS[$TARGET]}"
PLATFORM=$(sed -e 's/[-_]/ /' <<< "$BUILD_TARGET"|awk '{print $1}')
ARCH=$(sed -e 's/[-_]/ /' <<< "$BUILD_TARGET"|awk '{print $2}')
Expand Down
Binary file added libheif/darwin_amd64/libSvtAv1Enc.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libaom.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libde265.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libheif.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libsharpyuv.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libwebp.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libwebpdecoder.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libwebpdemux.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libwebpmux.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libx265.a
Binary file not shown.
Binary file added libheif/darwin_amd64/libz.a
Binary file not shown.

0 comments on commit f69f4d0

Please sign in to comment.