Skip to content

Commit 713101f

Browse files
committed
jpeg-quantsmooth: fix build with gcc and for ppc
1 parent 89c4e0c commit 713101f

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

graphics/jpeg-quantsmooth/Portfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ compiler.blacklist-append \
2727
depends_lib-append port:libjpeg-turbo
2828

2929
patchfiles-append patch-dynamic.patch
30+
31+
# See: https://github.com/ilyakurdyukov/jpeg-quantsmooth/pull/31
32+
patchfiles-append patch-Makefile.patch
33+
3034
post-patch {
3135
reinplace "s|LDFLAGS :=|LDFLAGS ?=|g" Makefile
3236
reinplace "s|CFLAGS :=|CFLAGS ?=|g" Makefile
@@ -35,10 +39,12 @@ post-patch {
3539
}
3640
}
3741

38-
configure.cflags-append \
42+
if {[string match *clang* ${configure.compiler}]} {
43+
configure.cflags-append \
3944
-I${prefix}/include/libomp
40-
configure.ldflags-append \
45+
configure.ldflags-append \
4146
-L${prefix}/lib/libomp
47+
}
4248

4349
destroot {
4450
xinstall -m 755 ${worksrcpath}/jpegqs ${destroot}${prefix}/bin
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
diff --git a/Makefile b/Makefile
2+
index 97c9461..cbc7c4e 100644
3+
--- Makefile
4+
+++ Makefile
5+
@@ -25,10 +25,10 @@ SIMDOBJ := jpegqs_base.o jpegqs_sse2.o jpegqs_avx2.o jpegqs_avx512.o
6+
else ifeq ($(SIMD),none)
7+
SIMDFLG := -DNO_SIMD
8+
else ifeq ($(SIMD),native)
9+
-ifneq (,$(filter arm% aarch64,$(ARCH)))
10+
-SIMDFLG := -mcpu=native
11+
+ifneq (,$(filter arm% aarch64 ppc% Power\ Macintosh,$(ARCH)))
12+
+SIMDFLG := -mcpu=native -mtune=native
13+
else
14+
-SIMDFLG := -march=native
15+
+SIMDFLG := -march=native -mtune=native
16+
endif
17+
else ifeq ($(SIMD),avx512)
18+
SIMDFLG := $(SIMD_AVX512)
19+
@@ -49,14 +49,20 @@ CFLAGS := -Wall -O2
20+
ifneq (,$(filter e2k,$(ARCH)))
21+
CFLAGS := $(filter-out -O2,$(CFLAGS)) -O3
22+
endif
23+
+OMPLINK :=
24+
ifeq ($(OS),Darwin)
25+
LDFLAGS := -Wl,-dead_strip
26+
ifeq ($(LIBMINIOMP),)
27+
-LDFLAGS += -lomp
28+
+ifneq (,$(filter gcc%,$(notdir $(CC))))
29+
+OMPLINK := -lgomp
30+
+else
31+
+OMPLINK := -lomp
32+
+endif
33+
endif
34+
else
35+
LDFLAGS := -Wl,--gc-sections -s
36+
endif
37+
+LDFLAGS += $(OMPLINK)
38+
39+
CFLAGS_LIB := $(CFLAGS) $(MFLAGS) $(SIMDFLG)
40+
CFLAGS_APP := $(CFLAGS_LIB) -Wextra -pedantic $(MTOPTS)

0 commit comments

Comments
 (0)