[darwinbuild-changes] [863] trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 10 17:32:07 PDT 2010
Revision: 863
http://trac.macosforge.org/projects/darwinbuild/changeset/863
Author: wsiegrist at apple.com
Date: 2010-08-10 17:32:06 -0700 (Tue, 10 Aug 2010)
Log Message:
-----------
Merge PR-8279204 (again)
Modified Paths:
--------------
trunk/archs.sh
trunk/darwinbuild/darwinbuild.common
trunk/darwinbuild/darwinbuild.in
trunk/darwinbuild/manifest.c
trunk/darwinbuild.xcodeproj/project.pbxproj
trunk/darwinup/DB.cpp
trunk/darwinup/Digest.cpp
trunk/darwinup/Digest.h
trunk/darwinxref/plugins/c_plugins.xcconfig
trunk/darwinxref/plugins/register.c
Added Paths:
-----------
trunk/darwinbuild/digest.c
Removed Paths:
-------------
trunk/darwinbuild/Makefile
trunk/darwinup/Makefile
trunk/darwinxref/Makefile
Property Changed:
----------------
trunk/
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/PR-4841388:399-419
/branches/PR-6358021:442-443
/branches/PR-6392966:423-427
/branches/PR-6398060:433-434
/branches/PR-6493844:460-461
/branches/PR-6497694:466-468,471
/branches/PR-6634286:632-650
/branches/PR-6688645:479-490
/branches/PR-6722857:495-499
/branches/PR-6729491:655-664
/branches/PR-6973110:804-813
/branches/PR-7250612:635-650
/branches/PR-7341154:682-694
/branches/PR-7431723:660-664
/branches/PR-7461534:650-664
/branches/PR-7482850:670-671
/branches/PR-7489777:676-731
/branches/PR-7529688:692-694
/branches/PR-7593824:739-772
/branches/PR-7598640:703-731
/branches/PR-7748469:777-785
/branches/PR-7765119:790-791
/branches/PR-7798586:796-799
/branches/PR-7872907:830-840
/branches/PR-7935095:819-821
/branches/PR-8116613:849
/branches/PR-8279204:861
+ /branches/PR-4841388:399-419
/branches/PR-6358021:442-443
/branches/PR-6392966:423-427
/branches/PR-6398060:433-434
/branches/PR-6493844:460-461
/branches/PR-6497694:466-468,471
/branches/PR-6634286:632-650
/branches/PR-6688645:479-490
/branches/PR-6722857:495-499
/branches/PR-6729491:655-664
/branches/PR-6973110:804-813
/branches/PR-7250612:635-650
/branches/PR-7341154:682-694
/branches/PR-7431723:660-664
/branches/PR-7461534:650-664
/branches/PR-7482850:670-671
/branches/PR-7489777:676-731
/branches/PR-7529688:692-694
/branches/PR-7593824:739-772
/branches/PR-7598640:703-731
/branches/PR-7748469:777-785
/branches/PR-7765119:790-791
/branches/PR-7798586:796-799
/branches/PR-7872907:830-840
/branches/PR-7935095:819-821
/branches/PR-8116613:849
/branches/PR-8279204:854-862
Modified: trunk/archs.sh
===================================================================
--- trunk/archs.sh 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/archs.sh 2010-08-11 00:32:06 UTC (rev 863)
@@ -4,7 +4,6 @@
# Detect which arches we should build for
#
-CRYPTO_ARCHS=`lipo -info /usr/lib/libcrypto.dylib | cut -d : -f 3`
SQLITE_ARCHS=`lipo -info /usr/lib/libsqlite3.dylib | cut -d : -f 3`
TCL_ARCHS=`lipo -info /usr/lib/libtcl.dylib | cut -d : -f 3`
SYSTEM_ARCHS=`lipo -info /usr/lib/libSystem.dylib | cut -d : -f 3`
@@ -15,7 +14,7 @@
for ARCH in $SYSTEM_ARCHS;
do
# crosscheck against the remaining sets...
- for ALIST in "$CRYPTO_ARCHS" "$SQLITE_ARCHS" "$TCL_ARCHS";
+ for ALIST in "$SQLITE_ARCHS" "$TCL_ARCHS";
do
# see if ARCH is not in ALIST
if [[ ${ALIST/$ARCH} == $ALIST ]];
Deleted: trunk/darwinbuild/Makefile
===================================================================
--- trunk/darwinbuild/Makefile 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinbuild/Makefile 2010-08-11 00:32:06 UTC (rev 863)
@@ -1,75 +0,0 @@
-include ../common.mk
-
-###
-### Variables for the 'install' phase
-###
-DATDIR:=$(DATDIR)/darwinbuild
-
-PrefixReplacements = darwinbuild \
- darwinmaster.sh \
- packageRoots.sh \
- thinPackages.sh \
- installXcode \
- installXcode32
-
-all: manifest prefixes
-
-manifest: manifest.c
- cc $(CFLAGS) -Wall -Werror -o $(OBJROOT)/$@ -lcrypto $^
-
-prefixes: $(PrefixReplacements)
-
-$(PrefixReplacements): % : %.in
- $(SED) -e 's,%%PREFIX%%,$(PREFIX),' $@.in > $@ ;
-
-install: all
- [ -d $(BINDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(BINDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) darwinbuild $(BINDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) darwinmaster $(BINDIR)
-
- [ -d $(DATDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(DATDIR)
- $(INSTALL) $(INSTALL_DOC_FLAGS) darwinbuild.common $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode2 $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode3 $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode31 $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode32 $(DATDIR)
- $(INSTALL) $(INSTALL_DOC_FLAGS) Info.plist $(DATDIR)
- $(INSTALL) $(INSTALL_DOC_FLAGS) SDKSettings.plist $(DATDIR)
-
- $(INSTALL) $(INSTALL_EXE_FLAGS) createChroot $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) $(OBJROOT)/manifest $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) ditto $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) buildlist $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) buildorder $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) packageRoots $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) synthfat $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) thinFile $(DATDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) thinPackages $(DATDIR)
-
-uninstall:
- rm -f $(BINDIR)/darwinbuild
- rm -f $(BINDIR)/darwinmaster
- rm -f $(DATDIR)/darwinbuild.common
- rm -f $(DATDIR)/installXcode
- rm -f $(DATDIR)/installXcode2
- rm -f $(DATDIR)/installXcode3
- rm -f $(DATDIR)/installXcode31
- rm -f $(DATDIR)/installXcode32
- rm -f $(DATDIR)/Info.plist
- rm -f $(DATDIR)/SDKSettings.plist
- rm -f $(DATDIR)/createChroot
- rm -f $(DATDIR)/manifest
- rm -f $(DATDIR)/ditto
- rm -f $(DATDIR)/buildlist
- rm -f $(DATDIR)/buildorder
- rm -f $(DATDIR)/packageRoots
- rm -f $(DATDIR)/synthfat
- rm -f $(DATDIR)/thinFile
- rm -f $(DATDIR)/thinPackages
-
-
-clean:
- rm -f manifest
- @$(foreach SCRIPT,$(PrefixReplacements), \
- rm -f $(SCRIPT) ; )
Modified: trunk/darwinbuild/darwinbuild.common
===================================================================
--- trunk/darwinbuild/darwinbuild.common 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinbuild/darwinbuild.common 2010-08-11 00:32:06 UTC (rev 863)
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2005, Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-2010, Apple Computer, Inc. All rights reserved.
#
# @APPLE_BSD_LICENSE_HEADER_START@
#
@@ -533,10 +533,10 @@
echo "ERROR: Could not access $HashSource" 1>&2
exit 1
fi
- Hash=$(openssl dgst -sha1 < "$HashSource")
+ Hash=$($DIGEST < "$HashSource")
echo "# Hash of $HashSource" >> "$TmpFile"
else
- Hash=$(openssl dgst -sha1 < "$TmpFile")
+ Hash=$($DIGEST < "$TmpFile")
fi
cp "$TmpFile" "$receipts/$Hash"
Modified: trunk/darwinbuild/darwinbuild.in
===================================================================
--- trunk/darwinbuild/darwinbuild.in 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinbuild/darwinbuild.in 2010-08-11 00:32:06 UTC (rev 863)
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2004-2005, Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2004-2010, Apple Computer, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -81,6 +81,7 @@
NFSDIR=.build/buildroot.nfs
DARWINXREF=$PREFIX/bin/darwinxref
DATADIR=$PREFIX/share/darwinbuild
+DIGEST=$DATADIR/digest
COMMONFILE=$DATADIR/darwinbuild.common
DARWINTRACE=$DATADIR/darwintrace.dylib
DITTO=$DATADIR/ditto
@@ -993,7 +994,7 @@
### Output the manifest
MANIFEST="/tmp/$projnam.$$"
"$DARWINXREF" register "$projnam" "$REAL_DSTROOT" | tee "$MANIFEST"
- SHA1=$(cat "$MANIFEST" | openssl dgst -sha1)
+ SHA1=$(cat "$MANIFEST" | $DIGEST)
mkdir -p "$REAL_DSTROOT/usr/local/darwinbuild/receipts"
cp "$MANIFEST" "$REAL_DSTROOT/usr/local/darwinbuild/receipts/$SHA1"
ln -s "$SHA1" "$REAL_DSTROOT/usr/local/darwinbuild/receipts/$projnam.hdrs"
@@ -1007,7 +1008,7 @@
### in the receipts directory after registration.
MANIFEST="/tmp/$projnam.$$"
"$DARWINXREF" register "$projnam" "$REAL_DSTROOT" | tee "$MANIFEST"
- SHA1=$(cat "$MANIFEST" | openssl dgst -sha1)
+ SHA1=$(cat "$MANIFEST" | $DIGEST)
mkdir -p "$REAL_DSTROOT/usr/local/darwinbuild/receipts"
cp "$MANIFEST" "$REAL_DSTROOT/usr/local/darwinbuild/receipts/$SHA1"
ln -s "$SHA1" "$REAL_DSTROOT/usr/local/darwinbuild/receipts/$projnam"
Copied: trunk/darwinbuild/digest.c (from rev 860, branches/PR-8279204/darwinbuild/digest.c)
===================================================================
--- trunk/darwinbuild/digest.c (rev 0)
+++ trunk/darwinbuild/digest.c 2010-08-11 00:32:06 UTC (rev 863)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2010 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 APPLE OR ITS CONTRIBUTORS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <CommonCrypto/CommonDigest.h>
+
+
+void print_usage() {
+ fprintf(stdout, "digest [-1] \n");
+ fprintf(stdout, " Print digest hash of stdin to stdout. \n");
+ fprintf(stdout, " \n");
+ fprintf(stdout, " -1 Use SHA1 hash (default) \n");
+ fprintf(stdout, " \n");
+}
+
+char* format_digest(const unsigned char* m) {
+ char* result = NULL;
+ // SHA-1
+ asprintf(&result,
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x",
+ m[0], m[1], m[2], m[3],
+ m[4], m[5], m[6], m[7],
+ m[8], m[9], m[10], m[11],
+ m[12], m[13], m[14], m[15],
+ m[16], m[17], m[18], m[19]
+ );
+ return result;
+}
+
+char* calculate_digest(int fd) {
+ unsigned char md[CC_SHA1_DIGEST_LENGTH];
+ CC_SHA1_CTX c;
+ CC_SHA1_Init(&c);
+
+ memset(md, 0, CC_SHA1_DIGEST_LENGTH);
+
+ ssize_t len;
+ const unsigned int blocklen = 8192;
+ unsigned char* block = (unsigned char*)malloc(blocklen);
+ if (!block) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ while(1) {
+ len = read(fd, block, blocklen);
+ if (len == 0) { close(fd); break; }
+ if ((len < 0) && (errno == EINTR)) continue;
+ if (len < 0) { close(fd); return NULL; }
+ CC_SHA1_Update(&c, block, (size_t)len);
+ }
+
+ CC_SHA1_Final(md, &c);
+ free(block);
+ return format_digest(md);
+}
+
+
+int main(int argc, char* argv[]) {
+
+ int digest = 1; // default to SHA1
+
+ int ch;
+ while ((ch = getopt(argc, argv, "1")) != -1) {
+ switch (ch) {
+ case '1':
+ digest = 1;
+ break;
+ case '?':
+ default:
+ print_usage();
+ exit(1);
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ fprintf(stdout, "%s\n", calculate_digest(fileno(stdin)));
+
+ return 0;
+}
Modified: trunk/darwinbuild/manifest.c
===================================================================
--- trunk/darwinbuild/manifest.c 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinbuild/manifest.c 2010-08-11 00:32:06 UTC (rev 863)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2005-2010 Apple Computer, Inc. All rights reserved.
*
* @APPLE_BSD_LICENSE_HEADER_START@
*
@@ -40,7 +40,8 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include <openssl/evp.h>
+#include <stdlib.h>
+#include <CommonCrypto/CommonDigest.h>
static char* format_digest(const unsigned char* m) {
@@ -62,21 +63,12 @@
}
static char* calculate_digest(int fd) {
- unsigned char digstr[EVP_MAX_MD_SIZE];
- memset(digstr, 0, sizeof(digstr));
+ unsigned char md[CC_SHA1_DIGEST_LENGTH];
+ CC_SHA1_CTX c;
+ CC_SHA1_Init(&c);
- EVP_MD_CTX ctx;
- static const EVP_MD* md;
+ memset(md, 0, CC_SHA1_DIGEST_LENGTH);
- if (md == NULL) {
- EVP_MD_CTX_init(&ctx);
- OpenSSL_add_all_digests();
- md = EVP_get_digestbyname("sha1");
- if (md == NULL) return NULL;
- }
-
- EVP_DigestInit(&ctx, md);
-
ssize_t len;
const unsigned int blocklen = 8192;
static unsigned char* block = NULL;
@@ -88,11 +80,11 @@
if (len == 0) { close(fd); break; }
if ((len < 0) && (errno == EINTR)) continue;
if (len < 0) { close(fd); return NULL; }
- EVP_DigestUpdate(&ctx, block, (size_t)len);
+ CC_SHA1_Update(&c, block, (size_t)len);
}
-
- EVP_DigestFinal(&ctx, digstr, NULL);
- return format_digest(digstr);
+
+ CC_SHA1_Final(md, &c);
+ return format_digest(md);
}
static int compare(const FTSENT **a, const FTSENT **b) {
Modified: trunk/darwinbuild.xcodeproj/project.pbxproj
===================================================================
--- trunk/darwinbuild.xcodeproj/project.pbxproj 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinbuild.xcodeproj/project.pbxproj 2010-08-11 00:32:06 UTC (rev 863)
@@ -25,6 +25,7 @@
7227AD1B109A053900BE33D7 /* CopyFiles */,
);
dependencies = (
+ 720BE2F6120C90E500B3C4A5 /* PBXTargetDependency */,
7227AC421098DC6A00BE33D7 /* PBXTargetDependency */,
7227AC401098DC6A00BE33D7 /* PBXTargetDependency */,
7227AC3E1098DC6A00BE33D7 /* PBXTargetDependency */,
@@ -101,6 +102,7 @@
/* Begin PBXBuildFile section */
61E0A6BD10A8DCC700DA7EBC /* exportIndex.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BFF10965EEA00C66E90 /* exportIndex.c */; };
+ 720BE2F4120C90C500B3C4A5 /* digest.c in Sources */ = {isa = PBXBuildFile; fileRef = 720BE2E9120C909E00B3C4A5 /* digest.c */; };
7227AB41109897D500BE33D7 /* binary_sites.tcl in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86BF310965EEA00C66E90 /* binary_sites.tcl */; };
7227AB42109897D500BE33D7 /* branch.tcl in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86BF410965EEA00C66E90 /* branch.tcl */; };
7227AB43109897D500BE33D7 /* currentBuild.tcl in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86BF610965EEA00C66E90 /* currentBuild.tcl */; };
@@ -109,7 +111,6 @@
7227AB46109897D500BE33D7 /* macosx.tcl in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C0710965EEA00C66E90 /* macosx.tcl */; };
7227AB67109899A600BE33D7 /* cfutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BE910965E7500C66E90 /* cfutils.h */; settings = {ATTRIBUTES = (Public, ); }; };
7227AB68109899A600BE33D7 /* DBPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BED10965E7500C66E90 /* DBPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 7227AB7210989AAF00BE33D7 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72C86CE110974CC700C66E90 /* libcrypto.dylib */; };
7227AB7510989F8D00BE33D7 /* manifest.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C2E1096600B00C66E90 /* manifest.c */; };
7227ACA01098FCAA00BE33D7 /* libredo_prebinding.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */; };
7227AD1C109A05FA00BE33D7 /* buildlist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB871098A7BF00BE33D7 /* buildlist */; };
@@ -162,7 +163,6 @@
72C86C9D109745BC00C66E90 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BE210965E4F00C66E90 /* main.cpp */; };
72C86C9E109745BC00C66E90 /* SerialSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BE410965E4F00C66E90 /* SerialSet.cpp */; };
72C86C9F109745BC00C66E90 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BE610965E4F00C66E90 /* Utils.cpp */; };
- 72C86CE210974CC800C66E90 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72C86CE110974CC700C66E90 /* libcrypto.dylib */; };
72C86CE410974CC800C66E90 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72C86CE310974CC800C66E90 /* libsqlite3.dylib */; };
72D05CB811D2680500B33EDD /* query.c in Sources */ = {isa = PBXBuildFile; fileRef = 72D05CA911D2678F00B33EDD /* query.c */; };
DF12E2821119E2B0007587C1 /* DB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF12E2811119E2B0007587C1 /* DB.cpp */; };
@@ -173,6 +173,13 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
+ 720BE2F5120C90E500B3C4A5 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 726DD14910965C5700D5AEAB /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 720BE2EA120C90A700B3C4A5;
+ remoteInfo = digest;
+ };
7227AB0F1097BBA900BE33D7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 726DD14910965C5700D5AEAB /* Project object */;
@@ -597,7 +604,7 @@
isa = PBXContainerItemProxy;
containerPortal = 726DD14910965C5700D5AEAB /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 72D05CAD11D267C400B33EDD /* query */;
+ remoteGlobalIDString = 72D05CAD11D267C400B33EDD;
remoteInfo = query;
};
DFCB82D9109A2F9A00D2DB2F /* PBXContainerItemProxy */ = {
@@ -660,6 +667,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 720BE2E9120C909E00B3C4A5 /* digest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = digest.c; path = darwinbuild/digest.c; sourceTree = "<group>"; };
+ 720BE2F2120C90A700B3C4A5 /* digest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = digest; sourceTree = BUILT_PRODUCTS_DIR; };
7227AB6D10989A9900BE33D7 /* manifest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = manifest; sourceTree = BUILT_PRODUCTS_DIR; };
7227AB871098A7BF00BE33D7 /* buildlist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = buildlist; path = darwinbuild/buildlist; sourceTree = "<group>"; };
7227AB881098A7BF00BE33D7 /* buildorder */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = buildorder; path = darwinbuild/buildorder; sourceTree = "<group>"; };
@@ -771,10 +780,9 @@
72C86C481096609500C66E90 /* darwinup */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = darwinup; sourceTree = BUILT_PRODUCTS_DIR; };
72C86C52109660CA00C66E90 /* darwintrace.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = darwintrace.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libredo_prebinding.a; path = /usr/local/lib/libredo_prebinding.a; sourceTree = "<absolute>"; };
- 72C86CE110974CC700C66E90 /* libcrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.dylib; path = /usr/lib/libcrypto.dylib; sourceTree = "<absolute>"; };
72C86CE310974CC800C66E90 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = /usr/lib/libsqlite3.dylib; sourceTree = "<absolute>"; };
72D05CA911D2678F00B33EDD /* query.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = query.c; sourceTree = "<group>"; };
- 72D05CB711D267C400B33EDD /* register copy.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = "register copy.so"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 72D05CB711D267C400B33EDD /* query.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = query.so; sourceTree = BUILT_PRODUCTS_DIR; };
DF12E2801119E2B0007587C1 /* DB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DB.h; path = darwinup/DB.h; sourceTree = "<group>"; };
DF12E2811119E2B0007587C1 /* DB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DB.cpp; path = darwinup/DB.cpp; sourceTree = "<group>"; };
DFC9772711138F9400CAE084 /* Column.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Column.cpp; path = darwinup/Column.cpp; sourceTree = "<group>"; };
@@ -787,11 +795,17 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 720BE2ED120C90A700B3C4A5 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
7227AB6B10989A9900BE33D7 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 7227AB7210989AAF00BE33D7 /* libcrypto.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -970,7 +984,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 72C86CE210974CC800C66E90 /* libcrypto.dylib in Frameworks */,
72C86CE410974CC800C66E90 /* libsqlite3.dylib in Frameworks */,
7227ACA01098FCAA00BE33D7 /* libredo_prebinding.a in Frameworks */,
);
@@ -1002,7 +1015,6 @@
72C86BD510965DC900C66E90 /* darwinbuild */,
72C86C391096607900C66E90 /* Products */,
72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */,
- 72C86CE110974CC700C66E90 /* libcrypto.dylib */,
72C86CE310974CC800C66E90 /* libsqlite3.dylib */,
72574A0F10977F7A00B13BC3 /* CoreFoundation.framework */,
72574A1410977FAD00B13BC3 /* libtcl.dylib */,
@@ -1013,6 +1025,7 @@
72C86BD510965DC900C66E90 /* darwinbuild */ = {
isa = PBXGroup;
children = (
+ 720BE2E9120C909E00B3C4A5 /* digest.c */,
7227AB871098A7BF00BE33D7 /* buildlist */,
7227AB881098A7BF00BE33D7 /* buildorder */,
7227AB891098A7BF00BE33D7 /* ditto */,
@@ -1167,7 +1180,8 @@
7227AC1C1098D8DB00BE33D7 /* thinPackages */,
7227AC251098DB9200BE33D7 /* installXcode */,
7227AC2E1098DBDF00BE33D7 /* installXcode32 */,
- 72D05CB711D267C400B33EDD /* register copy.so */,
+ 72D05CB711D267C400B33EDD /* query.so */,
+ 720BE2F2120C90A700B3C4A5 /* digest */,
);
name = Products;
sourceTree = "<group>";
@@ -1194,6 +1208,22 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 720BE2EA120C90A700B3C4A5 /* digest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 720BE2EE120C90A700B3C4A5 /* Build configuration list for PBXNativeTarget "digest" */;
+ buildPhases = (
+ 720BE2EB120C90A700B3C4A5 /* Sources */,
+ 720BE2ED120C90A700B3C4A5 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = digest;
+ productName = digest;
+ productReference = 720BE2F2120C90A700B3C4A5 /* digest */;
+ productType = "com.apple.product-type.tool";
+ };
7227AB6C10989A9900BE33D7 /* manifest */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7227AB7310989ACD00BE33D7 /* Build configuration list for PBXNativeTarget "manifest" */;
@@ -1763,7 +1793,7 @@
);
name = query;
productName = configuration;
- productReference = 72D05CB711D267C400B33EDD /* register copy.so */;
+ productReference = 72D05CB711D267C400B33EDD /* query.so */;
productType = "com.apple.product-type.objfile";
};
/* End PBXNativeTarget section */
@@ -1822,6 +1852,7 @@
7227AC1E1098DB9200BE33D7 /* installXcode */,
7227AC271098DBDF00BE33D7 /* installXcode32 */,
7227AC7E1098EF6400BE33D7 /* libredo_prebinding.a */,
+ 720BE2EA120C90A700B3C4A5 /* digest */,
);
};
/* End PBXProject section */
@@ -2023,6 +2054,14 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
+ 720BE2EB120C90A700B3C4A5 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 720BE2F4120C90C500B3C4A5 /* digest.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
7227AB6A10989A9900BE33D7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -2264,6 +2303,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
+ 720BE2F6120C90E500B3C4A5 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 720BE2EA120C90A700B3C4A5 /* digest */;
+ targetProxy = 720BE2F5120C90E500B3C4A5 /* PBXContainerItemProxy */;
+ };
7227AB101097BBA900BE33D7 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 725740981097B051008AD4D7 /* darwinxref_plugins */;
@@ -2577,6 +2621,33 @@
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
+ 720BE2EF120C90A700B3C4A5 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */;
+ buildSettings = {
+ INSTALL_PATH = "$(DATDIR)/darwinbuild";
+ PRODUCT_NAME = digest;
+ };
+ name = Debug;
+ };
+ 720BE2F0120C90A700B3C4A5 /* Public */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */;
+ buildSettings = {
+ INSTALL_PATH = "$(DATDIR)/darwinbuild";
+ PRODUCT_NAME = digest;
+ };
+ name = Public;
+ };
+ 720BE2F1120C90A700B3C4A5 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */;
+ buildSettings = {
+ INSTALL_PATH = "$(DATDIR)/darwinbuild";
+ PRODUCT_NAME = digest;
+ };
+ name = Release;
+ };
7227AB3E1098977D00BE33D7 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */;
@@ -3605,6 +3676,16 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 720BE2EE120C90A700B3C4A5 /* Build configuration list for PBXNativeTarget "digest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 720BE2EF120C90A700B3C4A5 /* Debug */,
+ 720BE2F0120C90A700B3C4A5 /* Public */,
+ 720BE2F1120C90A700B3C4A5 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Public;
+ };
7227AB4A109897E500BE33D7 /* Build configuration list for PBXAggregateTarget "tcl_plugins" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Modified: trunk/darwinup/DB.cpp
===================================================================
--- trunk/darwinup/DB.cpp 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinup/DB.cpp 2010-08-11 00:32:06 UTC (rev 863)
@@ -155,13 +155,13 @@
uint64_t size;
memcpy(&size, &data[this->file_offset(6)], sizeof(uint64_t));
- Digest* digest = NULL;
+ SHA1Digest* digest = NULL;
uint8_t* dp;
memcpy(&dp, &data[this->file_offset(7)], sizeof(uint8_t*));
if (dp) {
- digest = new Digest();
- digest->m_size = 20; // size of SHA1 hash
- memcpy(digest->m_data, dp, 20);
+ digest = new SHA1Digest();
+ digest->m_size = CC_SHA1_DIGEST_LENGTH;
+ memcpy(digest->m_data, dp, CC_SHA1_DIGEST_LENGTH);
}
char* path;
Modified: trunk/darwinup/Digest.cpp
===================================================================
--- trunk/darwinup/Digest.cpp 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinup/Digest.cpp 2010-08-11 00:32:06 UTC (rev 863)
@@ -49,50 +49,6 @@
#include "redo_prebinding.h"
}
-Digest::Digest() {
- memset(m_data, 0, sizeof(m_data));
- m_size = 0;
-}
-
-Digest::Digest(const EVP_MD* md, int fd) {
- digest(md, fd);
-}
-
-void Digest::digest(const EVP_MD* md, int fd) {
- EVP_MD_CTX ctx;
- EVP_MD_CTX_init(&ctx);
- EVP_DigestInit(&ctx, md);
-
- int len;
- const unsigned int blocklen = 8192;
- static uint8_t* block = NULL;
- if (block == NULL) {
- block = (uint8_t*)malloc(blocklen);
- }
- while(1) {
- len = read(fd, block, blocklen);
- if (len == 0) { close(fd); break; }
- if ((len < 0) && (errno == EINTR)) continue;
- if (len < 0) { close(fd); return; }
- EVP_DigestUpdate(&ctx, block, len);
- }
- if (len >= 0) {
- EVP_DigestFinal(&ctx, m_data, &m_size);
- }
-}
-
-Digest::Digest(const EVP_MD* md, uint8_t* data, uint32_t size) {
- digest(md, data, size);
-}
-
-void Digest::digest(const EVP_MD* md, uint8_t* data, uint32_t size) {
- EVP_MD_CTX ctx;
- EVP_MD_CTX_init(&ctx);
- EVP_DigestInit(&ctx, md);
- EVP_DigestUpdate(&ctx, data, size);
- EVP_DigestFinal(&ctx, m_data, &m_size);
-}
-
uint8_t* Digest::data() { return m_data; }
uint32_t Digest::size() { return m_size; }
@@ -121,45 +77,51 @@
return (memcmp(a->data(), b->data(), a_size) == 0);
}
-
-const EVP_MD* SHA1Digest::m_md;
-
SHA1Digest::SHA1Digest() {
- if (m_md == NULL) {
- OpenSSL_add_all_digests();
- m_md = EVP_get_digestbyname("sha1");
- assert(m_md != NULL);
- }
+ m_size = CC_SHA1_DIGEST_LENGTH;
}
SHA1Digest::SHA1Digest(int fd) {
- if (m_md == NULL) {
- OpenSSL_add_all_digests();
- m_md = EVP_get_digestbyname("sha1");
- assert(m_md != NULL);
- }
- digest(m_md, fd);
+ m_size = CC_SHA1_DIGEST_LENGTH;
+ digest(m_data, fd);
}
SHA1Digest::SHA1Digest(const char* filename) {
+ m_size = CC_SHA1_DIGEST_LENGTH;
int fd = open(filename, O_RDONLY);
- if (m_md == NULL) {
- OpenSSL_add_all_digests();
- m_md = EVP_get_digestbyname("sha1");
- assert(m_md != NULL);
- }
- digest(m_md, fd);
+ digest(m_data, fd);
}
SHA1Digest::SHA1Digest(uint8_t* data, uint32_t size) {
- if (m_md == NULL) {
- OpenSSL_add_all_digests();
- m_md = EVP_get_digestbyname("sha1");
- assert(m_md != NULL);
+ m_size = CC_SHA1_DIGEST_LENGTH;
+ digest(m_data, data, size);
+}
+
+void SHA1Digest::digest(unsigned char* md, int fd) {
+ CC_SHA1_CTX c;
+ CC_SHA1_Init(&c);
+
+ int len;
+ const unsigned int blocklen = 8192;
+ static uint8_t* block = NULL;
+ if (block == NULL) {
+ block = (uint8_t*)malloc(blocklen);
}
- digest(m_md, data, size);
+ while(1) {
+ len = read(fd, block, blocklen);
+ if (len == 0) { close(fd); break; }
+ if ((len < 0) && (errno == EINTR)) continue;
+ if (len < 0) { close(fd); return; }
+ CC_SHA1_Update(&c, block, (size_t)len);
+ }
+ if (len >= 0) {
+ CC_SHA1_Final(md, &c);
+ }
}
+void SHA1Digest::digest(unsigned char* md, uint8_t* data, uint32_t size) {
+ CC_SHA1((const void*)data, (CC_LONG)size, md);
+}
SHA1DigestMachO::SHA1DigestMachO(const char* filename) {
char* error = NULL;
@@ -182,11 +144,11 @@
&block,
&blocklen);
if (ret == REDO_PREBINDING_SUCCESS && block != NULL) {
- digest(SHA1Digest::m_md, (uint8_t*)block, blocklen);
+ digest(m_data, (uint8_t*)block, blocklen);
} else {
//fprintf(stderr, "%s:%d: unexpected unprebind result: %s: %s (%d)\n", __FILE__, __LINE__, filename, error, ret);
int fd = open(filename, O_RDONLY);
- digest(SHA1Digest::m_md, fd);
+ digest(m_data, fd);
close(fd);
}
if (block != NULL) {
@@ -195,7 +157,7 @@
}
} else {
int fd = open(filename, O_RDONLY);
- digest(SHA1Digest::m_md, fd);
+ digest(m_data, fd);
close(fd);
}
}
@@ -206,6 +168,6 @@
if (res == -1) {
fprintf(stderr, "%s:%d: readlink: %s: %s (%d)\n", __FILE__, __LINE__, filename, strerror(errno), errno);
} else {
- digest(SHA1Digest::m_md, (uint8_t*)link, res);
+ digest(m_data, (uint8_t*)link, res);
}
}
Modified: trunk/darwinup/Digest.h
===================================================================
--- trunk/darwinup/Digest.h 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinup/Digest.h 2010-08-11 00:32:06 UTC (rev 863)
@@ -35,34 +35,25 @@
#include <sys/types.h>
#include <stdint.h>
-#include <openssl/evp.h>
+#include <CommonCrypto/CommonDigest.h>
#include "Utils.h"
////
// Digest
//
-// Digest is the root class for all message digest algorithms
-// supported by darwinup.
+// Digest is the abstract root class for all message digest algorithms
+// supported by darwinup. Subclasses must implement the constructors
+// and digest() APIs.
//
-// Conceptually it's an abstract class, although that
-// hasn't been formalized.
-//
// SHA1Digest is the only concrete subclass. There are two
// subclasses of SHA1Digest which add convenience functions
// for digesting a canonicalized Mach-O binary, and the
// target of a symlink obtained by readlink(2).
//
-// NOTE: It might be more appropriate to use the CommonCrypto
-// implementation of these algorithms rather than the OpenSSL
-// implementation. However, CommonCrypto is only available on
-// Tiger.
////
struct Digest {
- Digest();
- Digest(const EVP_MD* md, int fd);
- Digest(const EVP_MD* md, uint8_t* data, uint32_t size);
////
// Accessor functions
@@ -74,7 +65,7 @@
// Returns the size of the raw digest.
virtual uint32_t size();
- // Returns the digest as an ASCIZ string, represented in hexidecimal.
+ // Returns the digest as an ASCII string, represented in hexidecimal.
virtual char* string();
////
@@ -88,11 +79,11 @@
protected:
- virtual void digest(const EVP_MD* md, int fd);
- virtual void digest(const EVP_MD* md, uint8_t* data, uint32_t size);
+ virtual void digest(unsigned char* md, int fd) = 0;
+ virtual void digest(unsigned char* md, uint8_t* data, uint32_t size) = 0;
- uint8_t m_data[EVP_MAX_MD_SIZE];
- uint32_t m_size;
+ unsigned char m_data[CC_SHA512_DIGEST_LENGTH]; // support up to 64 bytes
+ uint32_t m_size;
friend struct Depot;
friend struct DarwinupDatabase;
@@ -102,8 +93,6 @@
// SHA1Digest
////
struct SHA1Digest : Digest {
- static const EVP_MD* m_md;
-
// Creates an empty digest.
SHA1Digest();
@@ -115,6 +104,10 @@
// Computes the SHA-1 digest of the block of memory.
SHA1Digest(uint8_t* data, uint32_t size);
+
+ void digest(unsigned char* md, int fd);
+ void digest(unsigned char* md, uint8_t* data, uint32_t size);
+
};
////
Deleted: trunk/darwinup/Makefile
===================================================================
--- trunk/darwinup/Makefile 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinup/Makefile 2010-08-11 00:32:06 UTC (rev 863)
@@ -1,30 +0,0 @@
-include ../common.mk
-
-CXXFLAGS=-g -Wall -Werror -Wno-non-virtual-dtor $(CFLAGS)
-# libredo.o is generated from cctools_ofiles
-REDO=$(shell if [ -f /usr/local/lib/libredo_prebinding.a ]; then \
- echo /usr/local/lib/libredo_prebinding.a ; else \
- echo libredo.o ; fi)
-
-all: darwinup
-
-darwinup: Archive.o Depot.o Digest.o File.o SerialSet.o Utils.o main.o \
- $(REDO)
- g++ $(CXXFLAGS) -lcrypto -lsqlite3 -o $@ $^
-
-Archive.o: Archive.cpp Archive.h Depot.h File.h Utils.h
-Depot.o: Depot.cpp Archive.h Depot.h File.h Utils.h
-Digest.o: Digest.cpp Digest.h
-File.o: File.cpp Archive.h Digest.h File.h Utils.h
-Utils.o: Utils.h
-main.o: main.cpp Depot.h Utils.h
-
-install: all
- [ -d $(BINDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(BINDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) darwinup $(BINDIR)
-
-uninstall:
- rm -f $(BINDIR)/darwinup
-
-clean:
- rm -f darwinup Archive.o Depot.o Digest.o File.o SerialSet.o Utils.o main.o
Deleted: trunk/darwinxref/Makefile
===================================================================
--- trunk/darwinxref/Makefile 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinxref/Makefile 2010-08-11 00:32:06 UTC (rev 863)
@@ -1,108 +0,0 @@
-include ../common.mk
-
-###
-### Variables for the 'install' phase
-###
-DATDIR:=$(DATDIR)/darwinxref
-INCDIR:=$(INCDIR)/darwinbuild
-
-SOURCES= \
- DBDataStore.c \
- DBPlugin.c \
- DBTclPlugin.c \
- cfutils.c \
- main.c
-
-PLUGIN_SOURCES=$(wildcard plugins/*.c)
-PLUGIN_OBJECTS=$(PLUGIN_SOURCES:.c=.so) $(wildcard plugins/*.tcl)
-
-### todo: --with-plugin-path configuration
-CFLAGS+= \
- -DDEFAULT_DB_FILE=\".build/xref.db\" \
- -DDEFAULT_PLUGIN_PATH=\"$(subst $(DESTDIR),,$(DATDIR))/plugins\" \
-
-### todo: --with-tcl-plugins configuration
-TCL_CFLAGS=-DHAVE_TCL_PLUGINS=1
-TCL_LDFLAGS=-ltcl
-
-CFLAGS+=-g -Wall -Werror $(TCL_CFLAGS) $(SQLITEINC)
-LDFLAGS+=-framework CoreFoundation $(TCL_LDFLAGS)
-PLUGIN_CFLAGS=$(CFLAGS) -I.
-PLUGIN_LDFLAGS=$(LDFLAGS) -bundle -bundle_loader $(SYMROOT)/darwinxref
-
-CC = cc
-DSYMUTIL = dsymutil
-
-all: \
- darwinxref \
- $(PLUGIN_SOURCES:.c=.so) \
- upgrade_plist \
- apple_plugins
-
-install: all install_apple_plugins
- [ -d $(BINDIR) ] || \
- $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(BINDIR)
- $(INSTALL) $(INSTALL_EXE_FLAGS) $(SYMROOT)/darwinxref $(BINDIR)
-
- [ -d $(DATDIR)/plugins ] || \
- $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(DATDIR)/plugins
- $(INSTALL) $(INSTALL_DOC_FLAGS) $(OBJROOT)/plugins/*.so plugins/*.tcl $(DATDIR)/plugins
-
- [ -d $(INCDIR) ] || \
- $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(INCDIR)
- $(INSTALL) $(INSTALL_DOC_FLAGS) DBPlugin.h cfutils.h $(INCDIR)
-
-uninstall:
- rm -f $(BINDIR)/darwinxref
- [ ! -d $(DATDIR) ] || ( cd $(DATDIR) && rm -f $(PLUGIN_OBJECTS) )
- -rmdir $(DATDIR)/plugins
- -rmdir $(DATDIR)
-
- rm -f $(INCDIR)/DBPlugin.h
- rm -f $(INCDIR)/cfutils.h
- -rmdir $(INCDIR)
-
-clean:
- rm -f darwinxref
- rm -rf darwinxref.dSYM
- rm -f $(SOURCES:.c=.o)
- rm -f $(PLUGIN_SOURCES:.c=.so)
- rm -rf $(PLUGIN_SOURCES:.c=.so.dSYM)
- rm -f upgrade_plist
- rm -rf upgrade_plist.dSYM
-
-darwinxref: $(SOURCES)
- @for CFILE in $(SOURCES); do \
- OFILE=$$(echo $$(basename $${CFILE}) | sed -e 's,\.[^.]*$$,.o,') ; \
- CMD="$(CC) $(CFLAGS) -c -o $(OBJROOT)/$${OFILE} $${CFILE}"; \
- echo $$CMD ; $$CMD || exit 1 ; \
- done
- $(CC) $(LDFLAGS) $(CFLAGS) -o $(SYMROOT)/darwinxref \
- $(SQLITELIB) \
- $(foreach OFILE, $(SOURCES:.c=.o), $(OBJROOT)/$(notdir $(OFILE)))
- $(DSYMUTIL) --out $(SYMROOT)/darwinxref.dSYM $(SYMROOT)/darwinxref || true
-
-plugins/register.so: plugins/register.c DBPlugin.h darwinxref
- @mkdir -p $(OBJROOT)/plugins
- cc $(CFLAGS) -o $(OBJROOT)/$@ $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) $(SQLITEINC) $(SQLITELIB) -lcrypto $<
-
-plugins/%.so: plugins/%.c DBPlugin.h darwinxref
- @mkdir -p $(OBJROOT)/plugins
- cc $(CFLAGS) -o $(OBJROOT)/$@ $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) $<
-
-plugins-darwinports/%.so: plugins-darwinports/%.c DBPlugin.h darwinxref
- cc $(CFLAGS) -o $(OBJROOT)/$@ $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) $<
-
-apple_plugins:
- @if [ -d plugins-apple ]; then \
- make -C plugins-apple; \
- fi
-
-install_apple_plugins:
- @if [ -d plugins-apple ]; then \
- make -C plugins-apple install; \
- fi
-
-upgrade_plist: upgrade_plist.c cfutils.c
- cc $(CFLAGS) -o $(OBJROOT)/$@ $(CFLAGS) $(LDFLAGS) $^
-
Modified: trunk/darwinxref/plugins/c_plugins.xcconfig
===================================================================
--- trunk/darwinxref/plugins/c_plugins.xcconfig 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinxref/plugins/c_plugins.xcconfig 2010-08-11 00:32:06 UTC (rev 863)
@@ -41,7 +41,7 @@
GCC_WARN_UNUSED_VALUE = YES
GCC_WARN_UNUSED_VARIABLE = YES
OTHER_CFLAGS =
-OTHER_LDFLAGS = -framework CoreFoundation -ltcl -lcrypto -lsqlite3
+OTHER_LDFLAGS = -framework CoreFoundation -ltcl -lsqlite3
PRODUCT_NAME = $(TARGET_NAME)
WARNING_CFLAGS = -Werror -Wall
PREFIX = /usr/local
Modified: trunk/darwinxref/plugins/register.c
===================================================================
--- trunk/darwinxref/plugins/register.c 2010-08-11 00:30:59 UTC (rev 862)
+++ trunk/darwinxref/plugins/register.c 2010-08-11 00:32:06 UTC (rev 863)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2005-2010 Apple Computer, Inc. All rights reserved.
*
* @APPLE_BSD_LICENSE_HEADER_START@
*
@@ -43,7 +43,8 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include <openssl/evp.h>
+#include <stdlib.h>
+#include <CommonCrypto/CommonDigest.h>
#include "sqlite3.h"
extern char** environ;
@@ -129,22 +130,13 @@
}
static char* calculate_digest(int fd) {
- unsigned char digstr[EVP_MAX_MD_SIZE];
- memset(digstr, 0, sizeof(digstr));
+ unsigned char md[CC_SHA1_DIGEST_LENGTH];
+ CC_SHA1_CTX c;
+ CC_SHA1_Init(&c);
- EVP_MD_CTX ctx;
- static const EVP_MD* md;
+ memset(md, 0, CC_SHA1_DIGEST_LENGTH);
- if (md == NULL) {
- EVP_MD_CTX_init(&ctx);
- OpenSSL_add_all_digests();
- md = EVP_get_digestbyname("sha1");
- if (md == NULL) return NULL;
- }
-
- EVP_DigestInit(&ctx, md);
-
- unsigned int len;
+ ssize_t len;
const unsigned int blocklen = 8192;
static unsigned char* block = NULL;
if (block == NULL) {
@@ -155,11 +147,11 @@
if (len == 0) { close(fd); break; }
if ((len < 0) && (errno == EINTR)) continue;
if (len < 0) { close(fd); return NULL; }
- EVP_DigestUpdate(&ctx, block, len);
+ CC_SHA1_Update(&c, block, (size_t)len);
}
-
- EVP_DigestFinal(&ctx, digstr, &len);
- return format_digest(digstr);
+
+ CC_SHA1_Final(md, &c);
+ return format_digest(md);
}
static char* calculate_unprebound_digest(const char* filename);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100810/569225a0/attachment-0001.html>
More information about the darwinbuild-changes
mailing list