Skip to content

Commit

Permalink
libxar: new version from alt fork (see Issue fink#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmacks committed Apr 8, 2023
1 parent 81a68b6 commit f5a65a3
Show file tree
Hide file tree
Showing 3 changed files with 270 additions and 18 deletions.
122 changes: 122 additions & 0 deletions 10.9-libcxx/stable/main/finkinfo/utils/libxar-apple1-shlibs.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
Package: libxar-apple1-shlibs
Version: 494.81.1
Revision: 1
Source: https://github.com/apple-oss-distributions/xar/archive/refs/tags/xar-%v.tar.gz
Source-Checksum: SHA256(5c1f3d4252c08909f6407964f2776e6d35a67f8dfbaa6b2594ce2a4f6d730a76)
SourceDirectory: xar-xar-%v
BuildDepends: <<
bzip2-dev,
fink-package-precedence,
libxml2 (>= 2.9.1-1),
openssl300-dev
<<
Depends: <<
bzip2-shlibs,
libxml2-shlibs (>= 2.9.1-1),
openssl300-shlibs
<<
PatchFile: %n.patch
PatchFile-MD5: 505e04b130799b9b25b5fb66d9c25fbf
SetCPPFLAGS: -DXARSIG_BUILDING_WITH_XAR -MD -DNO_COMMONCRYPTO
SetLIBS: -lcrypto
ConfigureParams: --disable-static --libdir=%p/lib/xar-apple
CompileScript: <<
#!/bin/sh -ev
pushd xar
%{default_script}
fink-package-precedence --depfile-ext='\.d' --prohibit-bdep=libxar-apple1-dev .
<<
InfoTest: <<
TestScript: <<
#!/bin/sh -ex
pushd xar/test
PATH=%b/xar/src:$PATH
PYTHON=/usr/bin/python
[ -x $PYTHON ] || PYTHON=/usr/bin/python3
for t in *.py; do
$PYTHON $t || exit 2
done
<<
<<
InstallScript: <<
#!/bin/sh -ev
pushd xar
make install DESTDIR=%d
<<
DocFiles: xar/LICENSE xar/TODO
Shlibs: %p/lib/xar-apple/libxar.1.dylib 1.0.0 %n (>= 494.81.1-1)
SplitOff: <<
Package: xar
Depends: <<
%N (>= %v-%r),
bzip2-shlibs,
libxml2-shlibs (>= 2.9.1-1),
openssl300-shlibs
<<
Files: <<
bin
share/man
<<
DocFiles: xar/LICENSE xar/TODO
<<
SplitOff2: <<
Package: libxar-apple1-dev
Depends: %N (= %v-%r)
Conflicts: <<
libxar1-dev,
libxar-apple1-dev
<<
Replaces: <<
xar (<< 1.4-3),
libxar1-dev,
libxar-apple1-dev
<<
BuildDependsOnly: true
Files: <<
include
lib/xar-apple/libxar.{dylib,la}
<<
DocFiles: xar/LICENSE xar/TODO
<<
License: BSD
Description: The eXtensible ARchiver
DescDetail: <<
xar is an archiver meant to handle the archival tasks of the 21st
century. It handles Extended Attributes, ACLs, Resource Forks, can
extract archives to match up the usernames/groupnames of files it
has archived (as opposed to just matching up uids/gids), and can
make you coffee.
<<
DescPort: <<
Hack to build the non-Apple variant for compatibility to older
OSX releases (as of 494.81.1, claims to omit features on
platforms prior to 12.0)
<<
DescPackaging: <<
Source provenance:
http://xar.googlecode.com
https://github.com/mackyle/xar
https://github.com/tpoechtrager/xar
https://github.com/jimafisk/xar
At some point, apple forked it, leading to:
https://github.com/apple-oss-distributions/xar
https://github.com/val-verde/apple-xar

We hack in a preprocessor token to allow forcing internal
support of crypto via openssl, even if platform-detection
would prefer CommonCrypto. That allows building recent
versions even on older OSX platforms.

We base our package on Apple's, with val-verde's patch for
newer openssl:
https://github.com/val-verde/apple-xar/commit/36ff6763444e591803ce8dc14466b092c731e614

The build creates two shared libs--one with install_name in %p
the other in %b. It also creates two runtime binaries--one
linked against each shared lib. Doesn't use libtool, so this
game allows test-run everything during building.

Manually run the tests, but don't abort for the known fails.
<<
Maintainer: None <fink-devel@lists.sourceforge.net>
Homepage: https://github.com/apple-oss-distributions/xar
116 changes: 116 additions & 0 deletions 10.9-libcxx/stable/main/finkinfo/utils/libxar-apple1-shlibs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
diff -Nurd xar-xar-494.81.1.orig/xar/lib/archive.h xar-xar-494.81.1/xar/lib/archive.h
--- xar-xar-494.81.1.orig/xar/lib/archive.h 2023-01-23 19:43:41.000000000 -0500
+++ xar-xar-494.81.1/xar/lib/archive.h 2023-04-08 08:39:50.000000000 -0400
@@ -40,7 +40,7 @@
#define _XAR_ARCHIVE_H_
#include <zlib.h>
#include <libxml/hash.h>
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)
#include <CommonCrypto/CommonDigest.h>
#include <CommonCrypto/CommonDigestSPI.h>
#else
diff -Nurd xar-xar-494.81.1.orig/xar/lib/hash.c xar-xar-494.81.1/xar/lib/hash.c
--- xar-xar-494.81.1.orig/xar/lib/hash.c 2023-01-23 19:43:41.000000000 -0500
+++ xar-xar-494.81.1/xar/lib/hash.c 2023-04-08 09:32:36.000000000 -0400
@@ -41,7 +41,7 @@
#include <string.h>
#include <sys/types.h>
#include <zlib.h>
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)
#include <CommonCrypto/CommonDigest.h>
#include <CommonCrypto/CommonDigestSPI.h>
#else
@@ -58,7 +58,7 @@

#pragma mark Hash Wrapper Object

-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)

CCDigestRef digestRef_from_name(const char* name, unsigned int *outHashSize) {
CCDigestRef result = NULL;
@@ -88,16 +88,16 @@

return result;
}
-#endif // __APPLE__
+#endif // __APPLE__ && !NO_COMMONCRYPTO


struct __xar_hash_t {
const char *digest_name;
void *context;
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)
CCDigestRef digest;
#else
- EVP_MD_CTX digest;
+ EVP_MD_CTX *digest;
const EVP_MD *type;
#endif
unsigned int length;
@@ -113,12 +113,13 @@
if( context )
HASH_CTX(hash)->context = context;

-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)
HASH_CTX(hash)->digest = digestRef_from_name(digest_name, &HASH_CTX(hash)->length);
#else
OpenSSL_add_all_digests();
HASH_CTX(hash)->type = EVP_get_digestbyname(digest_name);
- EVP_DigestInit(&HASH_CTX(hash)->digest, HASH_CTX(hash)->type);
+ HASH_CTX(hash)->digest = EVP_MD_CTX_new();
+ EVP_DigestInit(HASH_CTX(hash)->digest, HASH_CTX(hash)->type);
#endif

HASH_CTX(hash)->digest_name = strdup(digest_name);
@@ -135,15 +136,15 @@
}

void xar_hash_update(xar_hash_t hash, void *buffer, size_t nbyte) {
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)
CCDigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
#else
- EVP_DigestUpdate(&HASH_CTX(hash)->digest, buffer, nbyte);
+ EVP_DigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
#endif
}

void *xar_hash_finish(xar_hash_t hash, size_t *nbyte) {
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)
void *buffer = calloc(1, CC_SHA512_DIGEST_LENGTH); // current biggest digest size This is what OpenSSL uses
#else
void *buffer = calloc(1, EVP_MAX_MD_SIZE);
@@ -151,11 +152,11 @@
if( ! buffer )
return NULL;

-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(NO_COMMONCRYPTO)
CCDigestFinal(HASH_CTX(hash)->digest, buffer);
CCDigestDestroy(HASH_CTX(hash)->digest);
#else
- EVP_DigestFinal(&HASH_CTX(hash)->digest, buffer, &HASH_CTX(hash)->length);
+ EVP_DigestFinal(HASH_CTX(hash)->digest, buffer, &HASH_CTX(hash)->length);
#endif

*nbyte = HASH_CTX(hash)->length;
diff -Nurd xar-xar-494.81.1.orig/xar/src/xar.c xar-xar-494.81.1/xar/src/xar.c
--- xar-xar-494.81.1.orig/xar/src/xar.c 2023-01-23 19:43:41.000000000 -0500
+++ xar-xar-494.81.1/xar/src/xar.c 2023-04-08 08:40:22.000000000 -0400
@@ -51,8 +51,8 @@
#include <time.h>
#include "xar_internal.h"
#include "config.h"
-#include "filetree.h"
-#include "util.h"
+#include "../lib/filetree.h"
+#include "../lib/util.h"
#define SYMBOLIC 1
#define NUMERIC 2
static int Perms = 0;
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
Package: xar
# OPENSSL110 FTBFS; on hold pending issue #20
Package: libxar1-shlibs
# OPENSSL110 FTBFS
Version: 1.5.2
Revision: 2
Source: http://xar.googlecode.com/files/%n-%v.tar.gz
Revision: 3
Source: http://xar.googlecode.com/files/xar-%v.tar.gz
Source-Checksum: SHA256(4c5d5682803cdfab16d72365cf51fc4075d597c5eeaa8c7d1990fea98cdae3e6)
BuildDepends: <<
bzip2-dev,
libxml2,
openssl100-dev
<<
Depends: <<
libxar1-shlibs (>= %v-%r),
bzip2-shlibs,
libxml2-shlibs,
openssl100-shlibs
<<
Replaces: xar (<< 1.4-3)
ConfigureParams: --disable-static --mandir=%p/share/man
CompileScript: <<
./configure %c
make
%{default_script}
<<
InfoTest: <<
TestScript: <<
Expand All @@ -34,27 +34,42 @@ InfoTest: <<
<<
<<
InstallScript: <<
make install BINDIR="%i/bin" DATADIR="%i/share" LIBDIR="%i/lib" INCLUDEDIR="%i/include" MANDIR="%i/share/man"
make install DESTDIR=%d
# make install BINDIR="%i/bin" DATADIR="%i/share" LIBDIR="%i/lib" INCLUDEDIR="%i/include" MANDIR="%i/share/man"
<<
DocFiles: LICENSE TODO
Shlibs: %p/lib/libxar.1.dylib 1.0.0 %n (>= 1.4-3)
SplitOff: <<
Package: libxar1-shlibs
Package: xar
Depends: <<
%N (>= %v-%r),
bzip2-shlibs,
libxml2-shlibs,
openssl100-shlibs
<<
Replaces: %N (<< 1.4-3)
Files: lib/libxar.*.dylib
Shlibs: %p/lib/libxar.1.dylib 1.0.0 %n (>= 1.4-3)
Files: <<
bin
share/man
<<
DocFiles: LICENSE TODO
<<
SplitOff2: <<
Package: libxar1-dev
Depends: libxar1-shlibs (= %v-%r)
Replaces: %N (<< 1.4-3)
Depends: %N (= %v-%r)
Conflicts: <<
libxar1-dev,
libxar-apple1-dev
<<
Replaces: <<
xar (<< 1.4-3),
libxar1-dev,
libxar-apple1-dev
<<
BuildDependsOnly: true
Files: include lib
Files: <<
include
lib/libxar.{dylib,la}
<<
DocFiles: LICENSE TODO
<<
License: BSD
Expand All @@ -67,11 +82,10 @@ has archived (as opposed to just matching up uids/gids), and can
make you coffee.
<<
DescPackaging: <<

The build creates two shared libs--one with install_name in %p
the other in %b. It also creates two runtime binaries--one
linked against each shared lib. Doesn't use libtool, so need
to be able to test-run everything during building.
linked against each shared lib. Doesn't use libtool, so this
game allows test-run everything during building.

Manually run the tests, but don't abort for the known fails.
<<
Expand Down

0 comments on commit f5a65a3

Please sign in to comment.