-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c030644
commit 85f28fd
Showing
2 changed files
with
223 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4 | ||
|
||
PortSystem 1.0 | ||
PortGroup github 1.0 | ||
PortGroup makefile 1.0 | ||
|
||
github.setup IlyaGrebnov libbsc 3.3.4 v | ||
github.tarball_from archive | ||
name bsc | ||
revision 0 | ||
categories archivers devel | ||
maintainers {i0ntempest @i0ntempest} openmaintainer | ||
license Apache-2 | ||
|
||
description High performance block-sorting data compressor | ||
long_description ${name} is a high performance file compressor based on lossless, block-sorting data\ | ||
compression algorithms. lib${name} is a library based on ${name}, it uses the same\ | ||
algorithms as ${name} and enables you to compress memory blocks. | ||
|
||
checksums rmd160 26b4333eef8ebca5c5d16de140d1ed1b9464b977 \ | ||
sha256 dad297ec3cd0fbaca63214746f6ae3f27a745642a2e0199c20b624fca3d04c53 \ | ||
size 189560 | ||
|
||
# https site has a misconfigured cert | ||
homepage http://${github.project}.com | ||
|
||
makefile.override-append \ | ||
PREFIX | ||
|
||
# See https://github.com/IlyaGrebnov/libbsc/pull/8 | ||
patchfiles-append patch-makefile.diff | ||
|
||
variant openmp description {enable parallelism support using OpenMP} { | ||
compiler.openmp_version \ | ||
4.5 | ||
compiler.blacklist-append \ | ||
{macports-clang-[0-9].*} | ||
|
||
build.args-append \ | ||
OPENMP=1 | ||
|
||
configure.ldflags-append \ | ||
-lc++ | ||
} | ||
|
||
variant debug description {Build debug binaries} { | ||
build.args-append \ | ||
DEBUG=1 | ||
} | ||
|
||
variant native description {Force local build and optimize for CPU} { | ||
build.args-append \ | ||
NATIVE=1 | ||
} | ||
|
||
default_variants +openmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
--- makefile.orig 2025-02-04 21:24:26 | ||
+++ makefile 2025-02-04 21:24:03 | ||
--- /Users/Admin/Downloads/libbsc-3.3.4/makefile copy 2025-02-04 21:24:26 | ||
+++ /Users/Admin/Downloads/libbsc-3.3.4/makefile 2025-02-05 00:18:18 | ||
@@ -1,11 +1,21 @@ | ||
SHELL = /bin/sh | ||
+OS := $(shell uname -s) | ||
+ARCH := $(shell uname -m) | ||
+MACHINE_ARCH := $(shell uname -p) | ||
|
||
-CC = clang++ | ||
-AR = ar | ||
-RANLIB = ranlib | ||
+ifeq ($(OS),Darwin) | ||
+ LIBEXT = dylib | ||
+else | ||
+ LIBEXT = so | ||
+endif | ||
|
||
-CFLAGS = -g -Wall | ||
+CC ?= clang | ||
+CXX ?= clang++ | ||
+AR ?= ar | ||
+RANLIB ?= ranlib | ||
|
||
+CFLAGS ?= -g -Wall | ||
+ | ||
# Comment out CFLAGS line below for compatability mode for 32bit file sizes | ||
# (less than 2GB) and systems that have compilers that treat int as 64bit | ||
# natively (ie: modern AIX) | ||
@@ -15,13 +25,21 @@ | ||
CFLAGS += -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math | ||
|
||
# Comment out CFLAGS line below to disable AVX2 instruction set (performance will suffer) | ||
-CFLAGS += -mavx2 | ||
+ifneq (,$(filter x86_64 i686 i386,$(ARCH))) | ||
+ CFLAGS += -mavx2 | ||
+endif | ||
|
||
# Comment out CFLAGS line below to disable OpenMP optimizations | ||
-CFLAGS += -fopenmp -DLIBBSC_OPENMP_SUPPORT | ||
+OPENMP ?= 0 | ||
+ifneq (,$(filter 1 true yes,$(OPENMP))) | ||
+ CFLAGS += -fopenmp -DLIBBSC_OPENMP_SUPPORT | ||
+endif | ||
|
||
# Comment out CFLAGS line below to enable debug output | ||
-CFLAGS += -DNDEBUG | ||
+DEBUG ?= 0 | ||
+ifneq (,$(filter 0 false no,$(DEBUG))) | ||
+ CFLAGS += -DNDEBUG | ||
+endif | ||
|
||
# Comment out CFLAGS line below to disable Sort Transform | ||
CFLAGS += -DLIBBSC_SORT_TRANSFORM_SUPPORT | ||
@@ -30,8 +48,19 @@ | ||
CFLAGS += -DLIBBSC_ALLOW_UNALIGNED_ACCESS | ||
|
||
# Where you want bsc installed when you do 'make install' | ||
-PREFIX = /usr | ||
+PREFIX ?= /usr | ||
|
||
+NATIVE ?= 0 | ||
+ifneq (,$(filter 1 true yes,$(NATIVE))) | ||
+ ifneq (,$(filter arm% aarch64,$(ARCH))) | ||
+ CFLAGS += -mcpu=native | ||
+ else ifneq (,$(filter powerpc,$(MACHINE_ARCH))) | ||
+ CFLAGS += -mtune=native | ||
+ else | ||
+ CFLAGS += -march=native | ||
+ endif | ||
+endif | ||
+ | ||
OBJS = \ | ||
adler32.o \ | ||
libsais.o \ | ||
@@ -46,21 +75,25 @@ | ||
st.o \ | ||
bwt.o \ | ||
|
||
-all: libbsc.a bsc | ||
+all: libbsc.a bsc libbsc.$(LIBEXT) | ||
|
||
bsc: libbsc.a bsc.cpp | ||
- $(CC) $(CFLAGS) bsc.cpp -o bsc -L. -lbsc | ||
+ $(CXX) $(CFLAGS) $(LDFLAGS) bsc.cpp -o $@ $< | ||
|
||
libbsc.a: $(OBJS) | ||
- rm -f libbsc.a | ||
- $(AR) cq libbsc.a $(OBJS) | ||
+ rm -f $@ | ||
+ $(AR) cq $@ $(OBJS) | ||
@if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ | ||
-f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ | ||
- echo $(RANLIB) libbsc.a ; \ | ||
- $(RANLIB) libbsc.a ; \ | ||
+ echo $(RANLIB) $@ ; \ | ||
+ $(RANLIB) $@ ; \ | ||
fi | ||
|
||
-install: libbsc.a bsc | ||
+libbsc.$(LIBEXT): $(OBJS) | ||
+ rm -f $@ | ||
+ $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) -o $@ $(OBJS) | ||
+ | ||
+install: libbsc.a bsc libbsc.$(LIBEXT) | ||
if ( test ! -d $(DESTDIR)$(PREFIX)/bin ) ; then mkdir -p $(DESTDIR)$(PREFIX)/bin ; fi | ||
if ( test ! -d $(DESTDIR)$(PREFIX)/lib ) ; then mkdir -p $(DESTDIR)$(PREFIX)/lib ; fi | ||
if ( test ! -d $(DESTDIR)$(PREFIX)/include ) ; then mkdir -p $(DESTDIR)$(PREFIX)/include ; fi | ||
@@ -70,42 +103,44 @@ | ||
chmod a+r $(DESTDIR)$(PREFIX)/include/libbsc.h | ||
cp -f libbsc.a $(DESTDIR)$(PREFIX)/lib | ||
chmod a+r $(DESTDIR)$(PREFIX)/lib/libbsc.a | ||
+ cp -f libbsc.$(LIBEXT) $(DESTDIR)$(PREFIX)/lib | ||
+ chmod a+r $(DESTDIR)$(PREFIX)/lib/libbsc.$(LIBEXT) | ||
|
||
clean: | ||
- rm -f *.o libbsc.a bsc | ||
+ rm -rf *.o libbsc.a libbsc.$(LIBEXT) bsc bsc.dSYM | ||
|
||
adler32.o: libbsc/adler32/adler32.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/adler32/adler32.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/adler32/adler32.cpp | ||
|
||
libsais.o: libbsc/bwt/libsais/libsais.c | ||
$(CC) $(CFLAGS) -c libbsc/bwt/libsais/libsais.c | ||
|
||
coder.o: libbsc/coder/coder.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/coder/coder.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/coder/coder.cpp | ||
|
||
qlfc.o: libbsc/coder/qlfc/qlfc.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/coder/qlfc/qlfc.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/coder/qlfc/qlfc.cpp | ||
|
||
qlfc_model.o: libbsc/coder/qlfc/qlfc_model.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/coder/qlfc/qlfc_model.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/coder/qlfc/qlfc_model.cpp | ||
|
||
detectors.o: libbsc/filters/detectors.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/filters/detectors.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/filters/detectors.cpp | ||
|
||
preprocessing.o: libbsc/filters/preprocessing.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/filters/preprocessing.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/filters/preprocessing.cpp | ||
|
||
libbsc.o: libbsc/libbsc/libbsc.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/libbsc/libbsc.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/libbsc/libbsc.cpp | ||
|
||
lzp.o: libbsc/lzp/lzp.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/lzp/lzp.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/lzp/lzp.cpp | ||
|
||
platform.o: libbsc/platform/platform.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/platform/platform.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/platform/platform.cpp | ||
|
||
st.o: libbsc/st/st.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/st/st.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/st/st.cpp | ||
|
||
bwt.o: libbsc/bwt/bwt.cpp | ||
- $(CC) $(CFLAGS) -c libbsc/bwt/bwt.cpp | ||
+ $(CXX) $(CFLAGS) -c libbsc/bwt/bwt.cpp | ||
|