Skip to content

Instantly share code, notes, and snippets.

@wmanth
Last active January 21, 2018 17:54
Show Gist options
  • Save wmanth/908ae784d32ab572033b50b2289c6e20 to your computer and use it in GitHub Desktop.
Save wmanth/908ae784d32ab572033b50b2289c6e20 to your computer and use it in GitHub Desktop.
Makefile to build ICU 58.1 for tvOS
ROOT = ${PWD}
DIST_DIR = ${ROOT}/dist
BUILD_DIR = ${ROOT}/build2
HOST_DIR = ${BUILD_DIR}/host
TVOS_DIR = ${BUILD_DIR}/tvos
TVSIMULATOR_DIR = ${BUILD_DIR}/tvsimulator
LIBS = libicui18n.a libicuio.a libicuuc.a
TVOS_LIBS = $(addprefix ${TVOS_DIR}/,${LIBS})
TVSIMULATOR_LIBS = $(addprefix ${TVSIMULATOR_DIR}/,${LIBS})
DIST_LIBS = $(addprefix ${DIST_DIR}/,${LIBS})
all: ${DIST_LIBS}
${DIST_LIBS}: ${TVOS_LIBS} ${TVSIMULATOR_LIBS}
mkdir -p ${DIST_DIR}
for LIB in ${LIBS}; do \
lipo -create -output ${DIST_DIR}/$${LIB} ${TVOS_DIR}/lib/$${LIB} ${TVSIMULATOR_DIR}/lib/$${LIB} ; \
done
${HOST_DIR}/bin/icupkg: ${HOST_DIR}/Makefile
$(MAKE) -C ${HOST_DIR} -j $(shell sysctl -n hw.ncpu)
${HOST_DIR}/Makefile:
mkdir -p ${HOST_DIR}
cd ${HOST_DIR} && ${ROOT}/source/configure
${TVOS_DIR}/Makefile: ${HOST_DIR}/bin/icupkg
mkdir -p ${TVOS_DIR}
cd ${TVOS_DIR} && \
CC="xcrun --sdk appletvos clang -arch arm64" \
CFLAGS="-fembed-bitcode -mtvos-version-min=10.0" \
CXX="xcrun --sdk appletvos clang++ -arch arm64" \
CXXFLAGS="-fembed-bitcode -mtvos-version-min=10.0" \
${ROOT}/source/configure \
--host=x86_64-apple-darwin \
--with-cross-build=${HOST_DIR} \
--enable-static \
--disable-shared \
--disable-tools
${TVSIMULATOR_DIR}/Makefile: ${HOST_DIR}/bin/icupkg
mkdir -p ${TVSIMULATOR_DIR}
cd ${TVSIMULATOR_DIR} && \
CC="xcrun --sdk appletvsimulator clang -arch x86_64" \
CFLAGS="-fembed-bitcode -mtvos-version-min=10.0" \
CXX="xcrun --sdk appletvsimulator clang++ -arch x86_64" \
CXXFLAGS="-fembed-bitcode -mtvos-version-min=10.0" \
${ROOT}/source/configure \
--host=x86_64-apple-darwin \
--with-cross-build=${HOST_DIR} \
--enable-static \
--disable-shared \
--disable-tools
${TVOS_LIBS}: tvos.libs
${TVSIMULATOR_LIBS}: tvsimulator.libs
.INTERMEDIATE: tvos.libs tvsimulator.libs
tvos.libs: ${TVOS_DIR}/Makefile
$(MAKE) -C ${TVOS_DIR} -j $(shell sysctl -n hw.ncpu)
tvsimulator.libs: ${TVSIMULATOR_DIR}/Makefile
$(MAKE) -C ${TVSIMULATOR_DIR} -j $(shell sysctl -n hw.ncpu)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment