Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xar update #1020

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
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;
79 changes: 0 additions & 79 deletions 10.9-libcxx/stable/main/finkinfo/utils/xar.info

This file was deleted.