Skip to content

Commit

Permalink
graphics/jbig2dec: Use USES=pathfix to fix .pc installation
Browse files Browse the repository at this point in the history
- Update MASTER_SITES
- Convert REINPLACE_CMD to patch files
  • Loading branch information
sunpoet committed Jul 9, 2023
1 parent 002cc38 commit aeb01f3
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 13 deletions.
6 changes: 3 additions & 3 deletions graphics/jbig2dec/Makefile
@@ -1,7 +1,7 @@
PORTNAME= jbig2dec
PORTVERSION= 0.19
CATEGORIES= graphics devel
MASTER_SITES= https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9531/
MASTER_SITES= https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9533/

MAINTAINER= sunpoet@FreeBSD.org
COMMENT= Decoder implementation of the JBIG2 image compression format
Expand All @@ -10,11 +10,12 @@ WWW= https://github.com/ArtifexSoftware/jbig2dec
LICENSE= GPLv3
LICENSE_FILE= ${WRKSRC}/COPYING

USES= cpe libtool
USES= cpe libtool pathfix

CONFIGURE_ENV= ac_cv_func_getopt_long=yes
GNU_CONFIGURE= yes
INSTALL_TARGET= install-strip
LDFLAGS+= -lmd
USE_LDCONFIG= yes

CPE_VENDOR= artifex
Expand All @@ -27,6 +28,5 @@ PNG_LIB_DEPENDS= libpng.so:graphics/png

post-patch:
@${RM} ${WRKSRC}/getopt* ${WRKSRC}/sha1.h
@${REINPLACE_CMD} -E 's|SHA1_Final\( *([^,]+), *([^\)]+)\)|SHA1_Final(\2, \1)|' ${WRKSRC}/jbig2dec.c ${WRKSRC}/sha1.c

.include <bsd.port.mk>
10 changes: 3 additions & 7 deletions graphics/jbig2dec/files/patch-Makefile.in
@@ -1,6 +1,6 @@
--- Makefile.in.orig 2020-09-10 16:29:31 UTC
+++ Makefile.in
@@ -611,18 +611,19 @@ libjbig2dec_la_SOURCES = jbig2.c \
@@ -611,8 +611,8 @@ libjbig2dec_la_SOURCES = jbig2.c \
jbig2_generic.h jbig2_symbol_dict.h jbig2_text.h \
memento.c memento.h

Expand All @@ -10,17 +10,13 @@
+ jbig2.h jbig2_image.h \
os_types.h config_types.h config_win32.h

-jbig2dec_LDADD = libjbig2dec.la @LIBOBJS@ $(PNG_LIBS)
+jbig2dec_LDADD = libjbig2dec.la @LIBOBJS@ $(PNG_LIBS) -lmd
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = jbig2dec.pc
jbig2dec_LDADD = libjbig2dec.la @LIBOBJS@ $(PNG_LIBS)
@@ -621,7 +621,7 @@ pkgconfig_DATA = jbig2dec.pc
dist_man_MANS = jbig2dec.1
EXTRA_DIST = test_jbig2dec.py msvc.mak LICENSE CHANGES
MAINTAINERCLEANFILES = config_types.h.in
-test_sha1_SOURCES = sha1.c sha1.h
+test_sha1_SOURCES = sha1.c
test_sha1_CFLAGS = -DTEST
+test_sha1_LDADD = -lmd
test_arith_SOURCES = jbig2_arith.c
test_arith_CFLAGS = -DTEST
test_arith_LDADD = libjbig2dec.la
11 changes: 10 additions & 1 deletion graphics/jbig2dec/files/patch-jbig2dec.c
@@ -1,4 +1,4 @@
--- jbig2dec.c.orig 2020-02-11 16:28:00 UTC
--- jbig2dec.c.orig 2020-09-10 15:14:14 UTC
+++ jbig2dec.c
@@ -33,7 +33,10 @@
#endif
Expand All @@ -12,3 +12,12 @@

#ifdef JBIG_EXTERNAL_MEMENTO_H
#include JBIG_EXTERNAL_MEMENTO_H
@@ -217,7 +220,7 @@ hash_print(jbig2dec_params_t *params, FILE *out)
char digest[2 * SHA1_DIGEST_SIZE + 1];
int i;

- SHA1_Final(params->hash_ctx, md);
+ SHA1_Final(md, params->hash_ctx);
for (i = 0; i < SHA1_DIGEST_SIZE; i++) {
snprintf(&(digest[2 * i]), 3, "%02x", md[i]);
}
40 changes: 38 additions & 2 deletions graphics/jbig2dec/files/patch-sha1.c
@@ -1,4 +1,4 @@
--- sha1.c.orig 2014-10-31 13:30:04 UTC
--- sha1.c.orig 2020-09-10 15:14:14 UTC
+++ sha1.c
@@ -86,6 +86,13 @@ A million repetitions of "a"
#include <string.h>
Expand All @@ -14,11 +14,47 @@
#include "sha1.h"

void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
@@ -258,7 +265,6 @@ SHA1_Final(SHA1_CTX *context, uint8_t di
@@ -225,7 +232,7 @@ SHA1_Update(SHA1_CTX *context, const uint8_t *data, co

/* Add padding and return the message digest. */
void
-SHA1_Final(SHA1_CTX *context, uint8_t digest[SHA1_DIGEST_SIZE])
+SHA1_Final(uint8_t digest[SHA1_DIGEST_SIZE], SHA1_CTX *context)
{
uint32_t i;
uint8_t finalcount[8];
@@ -258,7 +265,6 @@ SHA1_Final(SHA1_CTX *context, uint8_t digest[SHA1_DIGE

/*************************************************************/

-#if 0
int
main(int argc, char **argv)
{
@@ -286,7 +292,7 @@ main(int argc, char **argv)
i = fread(buffer, 1, 16384, file);
SHA1_Update(&context, buffer, i);
}
- SHA1_Final(&context, digest);
+ SHA1_Final(digest, &context);
fclose(file);
for (i = 0; i < SHA1_DIGEST_SIZE / 4; i++) {
for (j = 0; j < 4; j++) {
@@ -344,7 +350,7 @@ main(int argc, char **argv)
for (k = 0; k < 2; k++) {
SHA1_Init(&context);
SHA1_Update(&context, (uint8_t *) test_data[k], strlen(test_data[k]));
- SHA1_Final(&context, digest);
+ SHA1_Final(digest, &context);
digest_to_hex(digest, output);

if (strcmp(output, test_results[k])) {
@@ -359,7 +365,7 @@ main(int argc, char **argv)
SHA1_Init(&context);
for (k = 0; k < 1000000; k++)
SHA1_Update(&context, (uint8_t *) "a", 1);
- SHA1_Final(&context, digest);
+ SHA1_Final(digest, &context);
digest_to_hex(digest, output);
if (strcmp(output, test_results[2])) {
fprintf(stdout, "FAIL\n");

0 comments on commit aeb01f3

Please sign in to comment.