system/maxcso: Added (Fast cso compressor).

Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
This commit is contained in:
Hunter Sezen 2018-11-26 21:13:11 +00:00 committed by Willy Sudiarto Raharjo
parent 42b0726621
commit d0a86a675f
No known key found for this signature in database
GPG Key ID: 887B8374D7333381
7 changed files with 456 additions and 0 deletions

2
system/maxcso/README Normal file
View File

@ -0,0 +1,2 @@
A fast ISO to CSO compression program for use with PSP and PS2
emulators, which uses multiple algorithms for best compression ratio.

76
system/maxcso/flags.patch Normal file
View File

@ -0,0 +1,76 @@
From 7b269754c70f6512fef7beb8a11f19a2fc1067fa Mon Sep 17 00:00:00 2001
From: "Unknown W. Brackets" <checkins@unknownbrackets.org>
Date: Sat, 24 Nov 2018 11:38:01 -0800
Subject: [PATCH] Allow CFLAGS/CXXFLAGS to be overridden.
---
7zip/Makefile | 11 +++++++----
Makefile | 13 ++++++++-----
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/7zip/Makefile b/7zip/Makefile
index 986b1488..3909487c 100644
--- a/7zip/Makefile
+++ b/7zip/Makefile
@@ -2,8 +2,11 @@ CC ?= gcc
CXX ?= g++
AR ?= ar
-CFLAGS += -W -Wall -Wextra -O2
-CXXFLAGS += -W -Wall -Wextra -std=c++11 -O2 -ICPP
+SRC_CFLAGS = -W -Wall -Wextra
+SRC_CXXFLAGS = -W -Wall -Wextra -std=c++11 -ICPP
+
+CFLAGS ?= -O2
+CXXFLAGS ?= $(CFLAGS)
7ZIP_CXX_SRC = CPP/7zip/Archive/Common/ParseProperties.cpp \
CPP/7zip/Archive/DeflateProps.cpp \
@@ -33,10 +36,10 @@ CXXFLAGS += -W -Wall -Wextra -std=c++11 -O2 -ICPP
7ZIP_C_OBJ = $(7ZIP_C_SRC:.c=.o)
%.o: %.cpp
- $(CXX) -c $(CXXFLAGS) -o $@ $<
+ $(CXX) -c $(SRC_CXXFLAGS) $(CXXFLAGS) -o $@ $<
%.o: %.c
- $(CC) -c $(CFLAGS) -o $@ $<
+ $(CC) -c $(SRC_CFLAGS) $(CFLAGS) -o $@ $<
7zip.a: $(7ZIP_CXX_OBJ) $(7ZIP_C_OBJ)
$(AR) rcs $@ $^
diff --git a/Makefile b/Makefile
index 70870e23..5368d4d6 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,11 @@ MANDIR ?= $(PREFIX)/share/man
CC ?= gcc
CXX ?= g++
-CFLAGS += -W -Wall -Wextra -O2 -Wno-implicit-function-declaration -DNDEBUG=1
-CXXFLAGS += -W -Wall -Wextra -std=c++11 -O2 -Izopfli/src -I7zip -DNDEBUG=1 \
+CFLAGS ?= -O2
+CXXFLAGS ?= $(CFLAGS)
+
+SRC_CFLAGS += -W -Wall -Wextra -Wno-implicit-function-declaration -DNDEBUG=1
+SRC_CXXFLAGS += -W -Wall -Wextra -std=c++11 -Izopfli/src -I7zip -DNDEBUG=1 \
-Wno-unused-parameter -pthread
SRC_CXX_SRC = $(wildcard src/*.cpp)
@@ -22,13 +25,13 @@ ZOPFLI_C_SRC = zopfli/src/zopfli/blocksplitter.c zopfli/src/zopfli/cache.c \
ZOPFLI_C_OBJ = $(ZOPFLI_C_SRC:.c=.o)
%.o: %.cpp
- $(CXX) -c $(CXXFLAGS) -o $@ $<
+ $(CXX) -c $(SRC_CXXFLAGS) $(CXXFLAGS) -o $@ $<
%.o: %.c
- $(CC) -c $(CFLAGS) -o $@ $<
+ $(CC) -c $(SRC_CFLAGS) $(CFLAGS) -o $@ $<
maxcso: $(SRC_CXX_OBJ) $(CLI_CXX_OBJ) $(ZOPFLI_C_OBJ) 7zip/7zip.a
- $(CXX) -o $@ $(CXXFLAGS) $^ -luv -llz4 -lz
+ $(CXX) -o $@ $(SRC_CXXFLAGS) $(CXXFLAGS) $^ -luv -llz4 -lz
7zip/7zip.a:
$(MAKE) -C 7zip 7zip.a

View File

@ -0,0 +1,35 @@
From 06c234d2734a2f129aa5cbc1cf8332594813343d Mon Sep 17 00:00:00 2001
From: orbea <orbea@fredslev.dk>
Date: Thu, 22 Nov 2018 12:04:28 -0800
Subject: [PATCH] Makefile: Add install and uninstall targets.
---
Makefile | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Makefile b/Makefile
index e66826da..54a6489c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+
CC ?= gcc
CXX ?= g++
@@ -29,6 +32,14 @@ maxcso: $(SRC_CXX_OBJ) $(CLI_CXX_OBJ) $(ZOPFLI_C_OBJ) 7zip/7zip.a
7zip/7zip.a:
$(MAKE) -C 7zip 7zip.a
+install:
+ mkdir -p $(DESTDIR)$(BINDIR)
+ cp maxcso $(DESTDIR)$(BINDIR)
+ chmod 0755 $(DESTDIR)$(BINDIR)/maxcso
+
+uninstall:
+ rm -f $(DESTDIR)$(BINDIR)/maxcso
+
clean:
rm -f $(SRC_CXX_OBJ) $(CLI_CXX_OBJ) $(ZOPFLI_C_OBJ) maxcso
$(MAKE) -C 7zip clean

204
system/maxcso/man.patch Normal file
View File

@ -0,0 +1,204 @@
From bd7f860ebec755a67d09cd9c52a98bd7e1761fe3 Mon Sep 17 00:00:00 2001
From: orbea <orbea@fredslev.dk>
Date: Thu, 22 Nov 2018 18:27:14 -0800
Subject: [PATCH] man: Add the maxcso.1 manual.
---
Makefile | 5 ++
maxcso.1 | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 165 insertions(+)
create mode 100644 maxcso.1
diff --git a/Makefile b/Makefile
index 54a6489c..70870e23 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/share/man
CC ?= gcc
CXX ?= g++
@@ -34,11 +35,15 @@ maxcso: $(SRC_CXX_OBJ) $(CLI_CXX_OBJ) $(ZOPFLI_C_OBJ) 7zip/7zip.a
install:
mkdir -p $(DESTDIR)$(BINDIR)
+ mkdir -p $(DESTDIR)$(MANDIR)/man1
cp maxcso $(DESTDIR)$(BINDIR)
+ cp maxcso.1 $(DESTDIR)$(MANDIR)/man1
chmod 0755 $(DESTDIR)$(BINDIR)/maxcso
+ chmod 0644 $(DESTDIR)$(MANDIR)/man1/maxcso.1
uninstall:
rm -f $(DESTDIR)$(BINDIR)/maxcso
+ rm -f $(DESTDIR)$(MANDIR)/man1/maxcso.1
clean:
rm -f $(SRC_CXX_OBJ) $(CLI_CXX_OBJ) $(ZOPFLI_C_OBJ) maxcso
diff --git a/maxcso.1 b/maxcso.1
new file mode 100644
index 00000000..67d7e16c
--- /dev/null
+++ b/maxcso.1
@@ -0,0 +1,160 @@
+.\" maxcso.1
+.\"
+.Dd November 22, 2018
+.Dt MAXCSO 1
+.Os
+.Sh NAME
+.Nm MAXCSO
+.Nd Fast cso compressor
+.Sh SYNOPSIS
+.Nm maxcso
+.Op Fl -args
+.Op Ar input.iso
+.Op Fl o Ar output.cso
+.Sh DESCRIPTION
+A fast ISO to CSO compression program for use with PSP and PS2 emulators, which
+uses multiple algorithms for best compression ratio.
+.Ss FEATURES
+.Bl -bullet -offset <TAB> -compact
+.It
+Can use as many CPU cores as you want.
+.It
+Can use
+.Xr zlib 3 ,
+7-zip's deflate, and Zopfli.
+.It
+Processes multiple files in one command.
+.It
+Can take a CSO or DAX file as a source.
+.It
+Able to output at larger block sizes.
+.It
+Support for experimental CSO v2 and ZSO formats using
+.Xr lz4 1
+(faster decompression).
+.It
+Tuning of deflate or
+.Xr lz4 1
+compression threshold.
+.It
+Decompression of all supported inputs (including DAX and CSO v2).
+.El
+.Ss Compression
+.Nm maxcso
+always uses compression level 9.
+Decompression speed is about the same regardless of level, and disk access is
+faster with smaller files.
+.Pp
+Using 7-zip's deflate and Zopfli improves compression ratios, but don't expect a
+lot.
+Usual results are between 0.5% to 1.0% smaller.
+.Pp
+Larger block sizes than the default will help compression, in the range of 2-3%.
+However, the files may not be compatible with some software.
+For example,
+.Nm ppsspp
+versions released after 2014-10-26 will support larger block
+sizes.
+.Pp
+Avoid DAX where CSOs using larger block sizes are supported, since DAX is less
+efficient.
+.Pp
+.Xr lz4 1
+support is mostly for experimentation.
+.Ss Speed
+Compared to other tools like ciso and CisoPlus,
+.Nm maxcso
+can run much faster and achieve the same compression.
+Use
+.Fl -fast
+to get the fastest compression, which matches level 9 in other tools.
+.Pp
+Additionally, if you have better than a dual core processor,
+.Nm maxcso
+will use all
+of your cores, and perform even better.
+.Pp
+In usage, CSOs typically perform well in all known emulators.
+Some versions of PSP firmware with
+support for CSOs have bugs in their CSO support, but this doesn't affect
+emulators.
+.Sh OPTIONS
+Multiple files may be specified.
+Inputs can be iso or cso files.
+.Bl -tag -width indent
+.It Fl -threads=N
+Specify N threads for I/O and compression.
+.It Fl -quiet
+Suppress status output.
+.It Fl -crc
+Log CRC32 checksums, ignore output files and methods.
+.It Fl -fast
+Use only basic
+.Xr zlib 3
+or lz4 for fastest result.
+.It Fl -decompress
+Write out to raw ISO, decompressing as needed.
+.It Fl -block=N
+Specify a block size (default depends on iso size).
+Many readers only support the 2048 size.
+.It Fl -format=VER Ar cso1 , cso2 , zso , dax
+Specify cso version.
+These are experimental, default is
+.Ar cso1 .
+.It Fl -usr-zlib
+Enable trials with
+.Xr zlib 3
+for deflate compression.
+.It Fl -use-zopli
+Enable trials with Zopfli for deflate compression.
+Because Zopfli is significantly slower than the other methods and uses a lot
+more memory, it is disabled by default.
+Use for maximum compression.
+.It Fl -use-7zdeflate
+Enable trials with 7-zip's deflate compression.
+.It Fl -use-lz4
+Enable trials with lz4hc for
+.Xr lz4 1
+compression.
+.It Fl -use-lz4brute
+Enable bruteforce trials with lz4hc for
+.Xr lz4 1
+compression.
+.It Fl -only-METHOD
+Only allow a certain compression method (
+.Xr zlib 3 ,
+etc. above).
+.It Fl -no-METHOD
+Disable a certain compression method (
+.Xr zlib 3 ,
+etc. above).
+.It Fl -lz4-cost=N
+Allow
+.Xr lz4 1
+to increase block size by N% at most (cso2 only).
+.It Fl -orig-cost=N
+Allow uncompressed to increase block size by N% at most.
+.El
+.Pp
+The cost arguments allow you to allow each block to be N% bigger by using
+.Xr lz4 1
+or no compression.
+This makes the file read faster (less cpu power), but take more space.
+.Sh EXAMPLES
+.Bl -tag -width indent
+.It Nm maxcso Ar myfile.iso
+Compress
+.Ar myfile.iso
+and create myfile.cso.
+.It Nm maxcso Ar myfile.iso Fl o Ar output.cso
+Compress
+.Ar myfile.iso
+and create
+.Ar output.cso .
+.El
+.Sh SEE ALSO
+.Xr lz4 1 ,
+.Xr PCSX2 1 ,
+.Xr zlib 3
+.Sh BUGS
+.Lk https://github.com/unknownbrackets/maxcso/issues "Issue tracker"

View File

@ -0,0 +1,110 @@
#!/bin/sh
# Slackware build script for maxcso
# Copyright 2018 Hunter Sezen California, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=maxcso
VERSION=${VERSION:-1.10.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -eu
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Makefile: Add install and uninstall targets.
# https://github.com/unknownbrackets/maxcso/commit/06c234d2734a2f129aa5cbc1cf8332594813343d
# https://github.com/unknownbrackets/maxcso/pull/23
patch -p1 < $CWD/install.patch
# man: Add the maxcso.1 manual.
# https://github.com/unknownbrackets/maxcso/commit/bd7f860ebec755a67d09cd9c52a98bd7e1761fe3
# https://github.com/unknownbrackets/maxcso/pull/25
patch -p1 < $CWD/man.patch
# Allow CFLAGS/CXXFLAGS to be overridden.
# https://github.com/unknownbrackets/maxcso/commit/7b269754c70f6512fef7beb8a11f19a2fc1067fa
patch -p1 < $CWD/flags.patch
make \
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS"
make install \
PREFIX=/usr \
MANDIR=/usr/man \
DESTDIR=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" |
grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a LICENSE.md README.md README_CSO.md README_ZSO.md \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

10
system/maxcso/maxcso.info Normal file
View File

@ -0,0 +1,10 @@
PRGNAM="maxcso"
VERSION="1.10.0"
HOMEPAGE="https://github.com/unknownbrackets/maxcso"
DOWNLOAD="https://github.com/unknownbrackets/maxcso/archive/v1.10.0/maxcso-1.10.0.tar.gz"
MD5SUM="29fa15cdb1567e5f48b78ad64a56e4a1"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="libuv lz4"
MAINTAINER="Hunter Sezen"
EMAIL="orbea@fredslev.dk"

19
system/maxcso/slack-desc Normal file
View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
maxcso: maxcso (Fast cso compressor)
maxcso:
maxcso: A fast ISO to CSO compression program for use with PSP and PS2
maxcso: emulators, which uses multiple algorithms for best compression ratio.
maxcso:
maxcso: Homepage: https://github.com/unknownbrackets/maxcso
maxcso:
maxcso:
maxcso:
maxcso:
maxcso: