@@ -69,12 +69,21 @@ export PREFIX=${TARGETDIR}/carla${ARCH} | |||||
export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin | export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin | ||||
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig | export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig | ||||
export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections" | |||||
export CFLAGS="${CFLAGS} -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -m${ARCH} -mmacosx-version-min=10.12" | |||||
export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -std=gnu++11 -stdlib=libc++" | |||||
export CFLAGS="-O3 -mtune=generic -msse -msse2 -fvisibility=hidden -fdata-sections -ffunction-sections" | |||||
export CFLAGS="${CFLAGS} -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -mmacosx-version-min=10.12" | |||||
export LDFLAGS="-fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs" | export LDFLAGS="-fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs" | ||||
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -m${ARCH} -stdlib=libc++" | |||||
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -stdlib=libc++" | |||||
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||||
export CFLAGS="${CFLAGS} -arch x86_64 -arch arm64 -Wno-unused-command-line-argument" | |||||
export LDFLAGS="${LDFLAGS} -arch x86_64 -arch arm64" | |||||
else | |||||
export CFLAGS="${CFLAGS} -mfpmath=sse -m${ARCH}" | |||||
export LDFLAGS="${LDFLAGS} -m${ARCH}" | |||||
fi | |||||
export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -std=gnu++11 -stdlib=libc++" | |||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
# pkgconfig | # pkgconfig | ||||
@@ -318,11 +327,17 @@ if [ ! -f fftw-${FFTW3_VERSION}/build-done ]; then | |||||
export CFLAGS="${CFLAGS} -ffast-math" | export CFLAGS="${CFLAGS} -ffast-math" | ||||
export CXXFLAGS="${CXXFLAGS} -ffast-math" | export CXXFLAGS="${CXXFLAGS} -ffast-math" | ||||
cd fftw-${FFTW3_VERSION} | cd fftw-${FFTW3_VERSION} | ||||
./configure --enable-static --enable-sse2 --disable-shared --disable-debug --prefix=${PREFIX} | |||||
if [ "${MACOS_UNIVERSAL}" -eq 0 ]; then | |||||
FFTW_EXTRAFLAGS="--enable-sse2" | |||||
fi | |||||
./configure --enable-static ${FFTW_EXTRAFLAGS} --disable-shared --disable-debug --prefix=${PREFIX} | |||||
make | make | ||||
make install | make install | ||||
make clean | make clean | ||||
./configure --enable-static --enable-sse --enable-sse2 --enable-single --disable-shared --disable-debug --prefix=${PREFIX} | |||||
if [ "${MACOS_UNIVERSAL}" -eq 0 ]; then | |||||
FFTW_EXTRAFLAGS="${FFTW_EXTRAFLAGS} --enable-sse" | |||||
fi | |||||
./configure --enable-static ${FFTW_EXTRAFLAGS} --enable-single --disable-shared --disable-debug --prefix=${PREFIX} | |||||
make | make | ||||
make install | make install | ||||
make clean | make clean | ||||
@@ -353,9 +368,18 @@ export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin | |||||
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig | export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig | ||||
export PKG_CONFIG=${TARGETDIR}/carla64/bin/pkg-config | export PKG_CONFIG=${TARGETDIR}/carla64/bin/pkg-config | ||||
export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -m64 -mmacosx-version-min=10.12" | |||||
export CFLAGS="-O3 -mtune=generic -msse -msse2 -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -m64 -mmacosx-version-min=10.12" | |||||
export LDFLAGS="-L${PREFIX}/lib -stdlib=libc++" | |||||
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||||
export CFLAGS="${CFLAGS} -arch x86_64 -arch arm64 -Wno-unused-command-line-argument" | |||||
export LDFLAGS="${LDFLAGS} -arch x86_64 -arch arm64" | |||||
else | |||||
export CFLAGS="${CFLAGS} -mfpmath=sse -m${ARCH}" | |||||
export LDFLAGS="${LDFLAGS} -m${ARCH}" | |||||
fi | |||||
export CXXFLAGS="${CFLAGS} -std=gnu++11 -stdlib=libc++" | export CXXFLAGS="${CFLAGS} -std=gnu++11 -stdlib=libc++" | ||||
export LDFLAGS="-L${PREFIX}/lib -m64 -stdlib=libc++" | |||||
export MAKE=/usr/bin/make | export MAKE=/usr/bin/make | ||||
@@ -374,11 +398,18 @@ fi | |||||
if [ ! -f qtbase-everywhere-src-${QT5_VERSION}/build-done ]; then | if [ ! -f qtbase-everywhere-src-${QT5_VERSION}/build-done ]; then | ||||
cd qtbase-everywhere-src-${QT5_VERSION} | cd qtbase-everywhere-src-${QT5_VERSION} | ||||
if [ ! -f configured ]; then | if [ ! -f configured ]; then | ||||
sed -i -e "s/QT_MAC_SDK_VERSION_MIN = 10.13/QT_MAC_SDK_VERSION_MIN = 10.12/" mkspecs/common/macx.conf | |||||
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||||
sed -i -e "s/QMAKE_APPLE_DEVICE_ARCHS = x86_64/QMAKE_APPLE_DEVICE_ARCHS = arm64 x86_64/" mkspecs/common/macx.conf | |||||
QT5_EXTRAFLAGS="-no-sse2" | |||||
else | |||||
QT5_EXTRAFLAGS="-sse2" | |||||
fi | |||||
chmod +x configure | chmod +x configure | ||||
./configure -release -shared -opensource -confirm-license -platform macx-clang -framework \ | ./configure -release -shared -opensource -confirm-license -platform macx-clang -framework \ | ||||
-prefix ${PREFIX} -plugindir ${PREFIX}/lib/qt5/plugins -headerdir ${PREFIX}/include/qt5 \ | -prefix ${PREFIX} -plugindir ${PREFIX}/lib/qt5/plugins -headerdir ${PREFIX}/include/qt5 \ | ||||
-pkg-config -force-pkg-config -strip \ | -pkg-config -force-pkg-config -strip \ | ||||
-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-avx512 \ | |||||
${QT5_EXTRAFLAGS} -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-avx512 \ | |||||
-no-mips_dsp -no-mips_dspr2 \ | -no-mips_dsp -no-mips_dspr2 \ | ||||
-no-pch -pkg-config \ | -no-pch -pkg-config \ | ||||
-make libs -make tools \ | -make libs -make tools \ | ||||
@@ -397,7 +428,7 @@ if [ ! -f qtbase-everywhere-src-${QT5_VERSION}/build-done ]; then | |||||
touch configured | touch configured | ||||
fi | fi | ||||
make ${MAKE_ARGS} | make ${MAKE_ARGS} | ||||
make install | |||||
make install | |||||
ln -s ${PREFIX}/lib/QtCore.framework/Headers ${PREFIX}/include/qt5/QtCore | ln -s ${PREFIX}/lib/QtCore.framework/Headers ${PREFIX}/include/qt5/QtCore | ||||
ln -s ${PREFIX}/lib/QtGui.framework/Headers ${PREFIX}/include/qt5/QtGui | ln -s ${PREFIX}/lib/QtGui.framework/Headers ${PREFIX}/include/qt5/QtGui | ||||
ln -s ${PREFIX}/lib/QtWidgets.framework/Headers ${PREFIX}/include/qt5/QtWidgets | ln -s ${PREFIX}/lib/QtWidgets.framework/Headers ${PREFIX}/include/qt5/QtWidgets | ||||
@@ -451,8 +482,10 @@ fi | |||||
if [ ! -f Python-${PYTHON_VERSION}/build-done ]; then | if [ ! -f Python-${PYTHON_VERSION}/build-done ]; then | ||||
cd Python-${PYTHON_VERSION} | cd Python-${PYTHON_VERSION} | ||||
sed -i -e "s/#zlib zlibmodule.c/zlib zlibmodule.c/" Modules/Setup.dist | |||||
./configure --prefix=${PREFIX} --enable-optimizations --enable-shared | |||||
if [ "${MACOS_UNIVERSAL}" -ne 1 ]; then | |||||
sed -i -e "s/#zlib zlibmodule.c/zlib zlibmodule.c/" Modules/Setup.dist | |||||
fi | |||||
./configure --prefix=${PREFIX} ${PYTHON_EXTRAFLAGS} --enable-optimizations --enable-shared | |||||
make | make | ||||
make install | make install | ||||
touch build-done | touch build-done | ||||
@@ -38,9 +38,19 @@ unset CPPFLAGS | |||||
############################################################################################## | ############################################################################################## | ||||
# Complete 64bit build | # Complete 64bit build | ||||
export CFLAGS="-I${TARGETDIR}/carla64/include -m64 -mmacosx-version-min=${MACOS_VERSION_MIN}" | |||||
export CFLAGS="-I${TARGETDIR}/carla64/include -mmacosx-version-min=${MACOS_VERSION_MIN}" | |||||
export CFLAGS="${CFLAGS} -mtune=generic -msse -msse2" | |||||
export LDFLAGS="-L${TARGETDIR}/carla64/lib -mmacosx-version-min=${MACOS_VERSION_MIN} -stdlib=libc++" | |||||
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||||
export CFLAGS="${CFLAGS} -arch x86_64 -arch arm64" | |||||
export LDFLAGS="${LDFLAGS} -arch x86_64 -arch arm64" | |||||
else | |||||
export CFLAGS="${CFLAGS} -m${ARCH}" | |||||
export LDFLAGS="${LDFLAGS} -m${ARCH}" | |||||
fi | |||||
export CXXFLAGS="${CFLAGS} -stdlib=libc++ -Wno-unknown-pragmas -Wno-unused-private-field -Werror=auto-var-id" | export CXXFLAGS="${CFLAGS} -stdlib=libc++ -Wno-unknown-pragmas -Wno-unused-private-field -Werror=auto-var-id" | ||||
export LDFLAGS="-L${TARGETDIR}/carla64/lib -m64 -mmacosx-version-min=${MACOS_VERSION_MIN} -stdlib=libc++" | |||||
export PATH=${TARGETDIR}/carla/bin:${TARGETDIR}/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin | export PATH=${TARGETDIR}/carla/bin:${TARGETDIR}/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin | ||||
export PKG_CONFIG_PATH=${TARGETDIR}/carla/lib/pkgconfig:${TARGETDIR}/carla64/lib/pkgconfig | export PKG_CONFIG_PATH=${TARGETDIR}/carla/lib/pkgconfig:${TARGETDIR}/carla64/lib/pkgconfig | ||||
@@ -1,5 +1,11 @@ | |||||
#!/bin/bash | #!/bin/bash | ||||
if [ "$(uname -m)" = "arm64" ]; then | |||||
MACOS_UNIVERSAL=1 | |||||
else | |||||
MACOS_UNIVERSAL=0 | |||||
fi | |||||
PKG_CONFIG_VERSION=0.28 | PKG_CONFIG_VERSION=0.28 | ||||
LIBLO_VERSION=0.30 | LIBLO_VERSION=0.30 | ||||
ZLIB_VERSION=1.2.11 | ZLIB_VERSION=1.2.11 | ||||
@@ -17,7 +23,13 @@ PYTHON_VERSION=3.7.4 | |||||
PYLIBLO_VERSION=0.9.2 | PYLIBLO_VERSION=0.9.2 | ||||
CXFREEZE_VERSION=6.1 | CXFREEZE_VERSION=6.1 | ||||
if [ -n "$DEPS_NEW" ]; then | |||||
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||||
PYTHON_VERSION=3.9.1 | |||||
else | |||||
PYTHON_VERSION=3.7.4 | |||||
fi | |||||
if [ -n "${DEPS_NEW}" ]; then | |||||
QT5_VERSION=5.12.5 | QT5_VERSION=5.12.5 | ||||
QT5_MVERSION=5.12 | QT5_MVERSION=5.12 | ||||
PYQT5_VERSION=5.13.1 | PYQT5_VERSION=5.13.1 | ||||
@@ -13,11 +13,21 @@ fi | |||||
export CC=clang | export CC=clang | ||||
export CXX=clang++ | export CXX=clang++ | ||||
export CFLAGS="-I${TARGETDIR}/carla64/include -m64 -mmacosx-version-min=${MACOS_VERSION_MIN}" | |||||
export CXXFLAGS="${CFLAGS} -stdlib=libc++" | |||||
export LDFLAGS="-L${TARGETDIR}/carla64/lib -m64 -stdlib=libc++" | |||||
export CFLAGS="-I${TARGETDIR}/carla64/include -mmacosx-version-min=${MACOS_VERSION_MIN}" | |||||
export CFLAGS="${CFLAGS} -mtune=generic -msse -msse2" | |||||
export LDFLAGS="-L${TARGETDIR}/carla64/lib -stdlib=libc++" | |||||
unset CPPFLAGS | unset CPPFLAGS | ||||
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then | |||||
export CFLAGS="${CFLAGS} -arch x86_64 -arch arm64" | |||||
export LDFLAGS="${LDFLAGS} -arch x86_64 -arch arm64" | |||||
else | |||||
export CFLAGS="${CFLAGS} -m${ARCH}" | |||||
export LDFLAGS="${LDFLAGS} -m${ARCH}" | |||||
fi | |||||
export CXXFLAGS="${CFLAGS} -stdlib=libc++ -Wno-unknown-pragmas -Wno-unused-private-field -Werror=auto-var-id" | |||||
export MACOS="true" | export MACOS="true" | ||||
export PATH=${TARGETDIR}/carla/bin:${TARGETDIR}/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin | export PATH=${TARGETDIR}/carla/bin:${TARGETDIR}/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin | ||||
@@ -11,7 +11,6 @@ AR ?= ar | |||||
CC ?= gcc | CC ?= gcc | ||||
CXX ?= g++ | CXX ?= g++ | ||||
PKG_CONFIG ?= pkg-config | |||||
WINECC ?= winegcc | WINECC ?= winegcc | ||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
@@ -63,6 +62,42 @@ endif # HURD | |||||
endif # HAIKU | endif # HAIKU | ||||
endif # BSD | endif # BSD | ||||
# --------------------------------------------------------------------------------------------------------------------- | |||||
# Auto-detect the processor | |||||
TARGET_PROCESSOR := $(firstword $(subst -, ,$(TARGET_MACHINE))) | |||||
ifneq (,$(filter i%86,$(TARGET_PROCESSOR))) | |||||
CPU_I386=true | |||||
CPU_I386_OR_X86_64=true | |||||
endif | |||||
ifneq (,$(filter x86_64,$(TARGET_PROCESSOR))) | |||||
CPU_X86_64=true | |||||
CPU_I386_OR_X86_64=true | |||||
endif | |||||
ifneq (,$(filter arm%,$(TARGET_PROCESSOR))) | |||||
CPU_ARM=true | |||||
CPU_ARM_OR_AARCH64=true | |||||
endif | |||||
ifneq (,$(filter arm64%,$(TARGET_PROCESSOR))) | |||||
CPU_ARM64=true | |||||
CPU_ARM_OR_AARCH64=true | |||||
endif | |||||
ifneq (,$(filter aarch64%,$(TARGET_PROCESSOR))) | |||||
CPU_AARCH64=true | |||||
CPU_ARM_OR_AARCH64=true | |||||
endif | |||||
# --------------------------------------------------------------------------------------------------------------------- | |||||
# Set PKG_CONFIG (can be overridden by environment variable) | |||||
ifeq ($(WIN32),true) | |||||
# Build statically on Windows by default | |||||
PKG_CONFIG ?= pkg-config --static | |||||
else | |||||
PKG_CONFIG ?= pkg-config | |||||
endif | |||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
# Set LINUX_OR_MACOS | # Set LINUX_OR_MACOS | ||||
@@ -75,14 +110,20 @@ LINUX_OR_MACOS=true | |||||
endif | endif | ||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
# Set MACOS_OR_WIN32 | |||||
# Set MACOS_OR_WIN32 and HAIKU_OR_MACOS_OR_WINDOWS | |||||
ifeq ($(HAIKU),true) | |||||
HAIKU_OR_MACOS_OR_WIN32=true | |||||
endif | |||||
ifeq ($(MACOS),true) | ifeq ($(MACOS),true) | ||||
MACOS_OR_WIN32=true | MACOS_OR_WIN32=true | ||||
HAIKU_OR_MACOS_OR_WIN32=true | |||||
endif | endif | ||||
ifeq ($(WIN32),true) | ifeq ($(WIN32),true) | ||||
MACOS_OR_WIN32=true | MACOS_OR_WIN32=true | ||||
HAIKU_OR_MACOS_OR_WIN32=true | |||||
endif | endif | ||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
@@ -108,7 +149,17 @@ endif | |||||
# Set build and link flags | # Set build and link flags | ||||
BASE_FLAGS = -Wall -Wextra -pipe -DBUILDING_CARLA -DREAL_BUILD -MD -MP -fno-common | BASE_FLAGS = -Wall -Wextra -pipe -DBUILDING_CARLA -DREAL_BUILD -MD -MP -fno-common | ||||
BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections | |||||
BASE_OPTS = -O3 -ffast-math -fdata-sections -ffunction-sections | |||||
ifeq ($(CPU_I386_OR_X86_64),true) | |||||
BASE_OPTS += -mtune=generic -msse -msse2 -mfpmath=sse | |||||
endif | |||||
ifeq ($(CPU_ARM),true) | |||||
ifneq ($(CPU_ARM64),true) | |||||
BASE_OPTS += -mfpu=neon-vfpv4 -mfloat-abi=hard | |||||
endif | |||||
endif | |||||
ifeq ($(MACOS),true) | ifeq ($(MACOS),true) | ||||
# MacOS linker flags | # MacOS linker flags | ||||