Skip to content

Commit d3185a2

Browse files
authored
Require gmake in python bindings build for FreeBSD (#630)
1 parent cfc14e6 commit d3185a2

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ all: c csharp elixir go java nim nodejs python rust
33

44
.PHONY: c
55
c:
6-
@make -C src
6+
@$(MAKE) -C src
77

88
.PHONY: csharp
99
csharp:
10-
@make -C bindings/csharp
10+
@$(MAKE) -C bindings/csharp
1111

1212
.PHONY: elixir
1313
elixir:
@@ -19,19 +19,19 @@ go:
1919

2020
.PHONY: java
2121
java:
22-
@make -C bindings/java build test
22+
@$(MAKE) -C bindings/java build test
2323

2424
.PHONY: nim
2525
nim:
2626
@cd bindings/nim && nim test
2727

2828
.PHONY: nodejs
2929
nodejs:
30-
@make -C bindings/node.js
30+
@$(MAKE) -C bindings/node.js
3131

3232
.PHONY: python
3333
python:
34-
@make -C bindings/python
34+
@$(MAKE) -C bindings/python
3535

3636
.PHONY: rust
3737
rust:

setup.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1-
from os import chdir
1+
from os import chdir, environ
22
from pathlib import Path
33
from platform import system
4+
from shutil import which
45
from setuptools import setup, Extension
56
from setuptools.command.build_ext import build_ext
67
from subprocess import check_call
78

89

10+
def get_make():
11+
"""Get the GNU make command. Honors $MAKE if set."""
12+
if "MAKE" in environ:
13+
return environ["MAKE"]
14+
if system() == "FreeBSD":
15+
if not which("gmake"):
16+
raise RuntimeError("GNU make (gmake) is required on FreeBSD")
17+
return "gmake"
18+
return "make"
19+
20+
921
class CustomBuild(build_ext):
1022
def run(self):
1123
if system() == "Windows":
1224
try:
1325
check_call(["blst\\build.bat"])
1426
except Exception:
1527
pass
16-
check_call(["make", "-C", "src", "blst"])
28+
check_call([get_make(), "-C", "src", "blst"])
1729
super().run()
1830

1931

0 commit comments

Comments
 (0)