File: makefile.cargo

package info (click to toggle)
rust-harfbuzz-sys 0.5.0%2Breally.0.4.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 280 kB
  • sloc: makefile: 8
file content (55 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download
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
51
52
53
54
55
FLAGS = -fPIC

ifeq (armv7-linux-androideabi,$(TARGET))
	# Reset TARGET variable because armv7 target name used by Rust is not 
	# the same as the target name needed for the CXX toolchain.
	TARGET = arm-linux-androideabi
	FLAGS += -march=armv7-a -mfpu=neon --target=$(TARGET)
endif

ifneq ($(HOST),$(TARGET))
  CXX ?= $(TARGET)-g++
  CC ?= $(TARGET)-gcc
  AR ?= $(TARGET)-ar
else
  CXX ?= g++
  CC ?= gcc
  AR ?= ar
endif

ifeq ($(DEBUG),true)
  FLAGS += -g
else
  FLAGS += -O2
endif

CFLAGS += $(FLAGS)
CXXFLAGS += $(FLAGS)

CONFIGURE_FLAGS = \
	--prefix=$(OUT_DIR) \
	--host=$(TARGET) \
	--enable-static \
	--disable-shared \
	--without-icu \
	--without-freetype \
	--without-glib \
	--with-coretext=auto

# Create a unique temporary build directory
BUILD_DIR := $(shell mktemp -d $(OUT_DIR)/rust_build.XXXXX)

all:
	# Copy source files to BUILD_DIR to avoid changing originals.
	cp -a $(CARGO_MANIFEST_DIR)/harfbuzz/* $(BUILD_DIR)
	# Touch in BUILD_DIR avoid regenerating files.
	$(MAKE) -f $(CARGO_MANIFEST_DIR)/makefile.touch touch HARFBUZZ="$(BUILD_DIR)"
	# Configure and build in BUILD_DIR, install from BUILD_DIR into OUT_DIR.
	cd $(BUILD_DIR) && \
	  ./configure $(CONFIGURE_FLAGS) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" && \
	  make -j$(NUM_JOBS) && \
	  make install
	# Remove the no-longer-needed BUILD_DIR to save space.
	rm -rf $(BUILD_DIR)

.PHONY: all