Skip to content

Commit

Permalink
Merge pull request #134 from mammo0/arm_support
Browse files Browse the repository at this point in the history
support for ARM builds
  • Loading branch information
rougier authored May 17, 2021
2 parents fa3f188 + db24d14 commit b38d309
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions setup-build-freetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import urllib
from os import path
from urllib.request import urlopen
import platform

# Needed for the GitHub Actions macOS CI runner, which appears to come without CAs.
import certifi
Expand Down Expand Up @@ -78,27 +79,37 @@
bitness = 64

if "linux" in sys.platform:
if (
os.environ.get("PYTHON_ARCH", "") == "32"
or os.environ.get("PLAT", "") == "i686"
):
print("# Making a 32 bit build.")
# On a 64 bit Debian/Ubuntu, this needs gcc-multilib and g++-multilib.
# On a 64 bit Fedora, install glibc-devel and libstdc++-devel.
CMAKE_GLOBAL_SWITCHES += (
'-DCMAKE_C_FLAGS="-m32 -O2" '
'-DCMAKE_CXX_FLAGS="-m32 -O2" '
'-DCMAKE_LD_FLAGS="-m32" '
)
bitness = 32
c_flags = cxx_flags = "-O2"
ld_flags = ""
if platform.machine() == "x86_64":
if (
os.environ.get("PYTHON_ARCH", "") == "32"
or platform.architecture() == "32bit"
):
print("# Making a 32 bit build.")
# On a 64 bit Debian/Ubuntu, this needs gcc-multilib and g++-multilib.
# On a 64 bit Fedora, install glibc-devel and libstdc++-devel.
c_flags = "-m32 {}".format(c_flags)
cxx_flags = "-m32 {}".format(cxx_flags)
ld_flags = "-m32"
bitness = 32
else:
print("# Making a 64 bit build.")
c_flags = "-m64 {}".format(c_flags)
cxx_flags = "-m64 {}".format(cxx_flags)
ld_flags = "-m64"
bitness = 64
else:
print("# Making a 64 bit build.")
CMAKE_GLOBAL_SWITCHES += (
'-DCMAKE_C_FLAGS="-m64 -O2" '
'-DCMAKE_CXX_FLAGS="-m64 -O2" '
'-DCMAKE_LD_FLAGS="-m64" '
)
bitness = 64
print("# Making a '{}' build.".format(platform.machine()))
if platform.architecture() == "32bit":
bitness = 32
else:
bitness = 64
CMAKE_GLOBAL_SWITCHES += (
'-DCMAKE_C_FLAGS="{}" '.format(c_flags) +
'-DCMAKE_CXX_FLAGS="{}" '.format(cxx_flags) +
'-DCMAKE_LD_FLAGS="{}" '.format(ld_flags)
)


def shell(cmd, cwd=None):
Expand Down

0 comments on commit b38d309

Please sign in to comment.