summaryrefslogtreecommitdiff
path: root/external/libffi/ExternalProject_libffi.mk
blob: 0ff625ea3e20ffa192fa674a78c659e96e163f0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

$(eval $(call gb_ExternalProject_ExternalProject,libffi))

$(eval $(call gb_ExternalProject_register_targets,libffi,\
	build \
))

# set prefix so that it ends up in libffi.pc so that pkg-config in python3 works
# For a static Windows build, change CPPFLAGS to include -D_LIB and --disable-static
# Also remove the ExternalPackage in that case

libffi_WIN_PLATFORM := $(strip \
    $(if $(filter INTEL,$(CPUNAME)),32) \
    $(if $(filter X86_64,$(CPUNAME)),64) \
    $(if $(filter ARM64,$(CPUNAME)),arm64) \
    )

$(call gb_ExternalProject_get_state_target,libffi,build):
	$(call gb_ExternalProject_run,build,\
		export LIB="$(ILIB)" && \
		./configure \
			--enable-option-checking=fatal \
			--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
			$(if $(filter LINUX,$(OS)), \
			    --disable-shared \
			    CC="$(CC) -fvisibility=hidden" \
				--with-pic \
				--enable-portable-binary) \
			$(if $(filter WNT,$(OS)), \
			    --disable-static \
			    CC="$(call gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(libffi_WIN_PLATFORM)" \
			    CXX="$(call gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(libffi_WIN_PLATFORM)" \
				LD='link' \
				CPP='cl -nologo -EP' \
				CXXCPP='cl -nologo -EP' \
				CPPFLAGS="-DFFI_BUILDING_DLL $(SOLARINC)") \
			--prefix=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM) \
			--disable-docs \
		&& $(MAKE) \
	)

# vim: set noet sw=4 ts=4: