diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1864647 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +build/ +.DS_Store +darwinbuild.xcodeproj/project.xcworkspace/ +darwinbuild.xcodeproj/xcuserdata/ + +# Build byproduct files +darwinxref/libtcl8.6.dylib + +# Installer files +*.pkg +installer/payload diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e69de29 diff --git a/Documentation/code_signing.md b/Documentation/code_signing.md new file mode 100644 index 0000000..fb7d3ee --- /dev/null +++ b/Documentation/code_signing.md @@ -0,0 +1,94 @@ +# Code Signing with darwinbuild + +darwinbuild supports Apple code signing, both automatically via Xcode, +and manually from the command line. Code signing is enabled by passing +the `-codesign` flag on the command line, like this: + +```shell +sudo darwinbuild -codesign='Developer ID Application' some_project +``` + +The string after the equals sign is the name of the certificate you want +Xcode to use. However, since darwinbuild must be run as root, it does not +have access to your personal keychain (which is where I presume you are storing +your signing materials). Therefore, you **must** run the steps under “Keychain +Preparation” below at least once before this will work, and ensure that the +DEVELOPER_TEAM property is set every time you build. You can either set this in +your project file, or via the `environment` key in the darwinbuild plist. +Passing the variable via `export` or `sudo env` will *not* work. + +## Format of darwinbuild-codesign.plist + +If you want to do manual code-signing (if your project is not built by Xcode, +for example), install a file called `darwinbuild-codesign.plist` in the +`/usr/local/darwinbuild` folder of your DSTROOT during the build. After the +build is complete, darwinbuild will locate the file, parse it, perform +the signing, and then delete it from the DSTROOT (so the codesign plists +do not collide, which would confuse darwinbuild no end). + +Here is a sample `darwinbuild-codesign.plist` file: + +```xml + + + + + hardened_runtime + + prefix + com.mycompany. + timestamp + + files + + /usr/local/bin/my_library + + /usr/local/lib/my_program + + identifier + com.mycompany.my_special_program + order + 1 + + + + +``` + +At the top level are keys that provide settings for all files. These are: + +* `hardened_runtime`: Boolean, default false. If true, `-o runtime` will be included in the codesign arguments. +* `prefix`: String, corresponds to the `--prefix` flag of codesign. If you provide a value, it must end in a `.`, or codesign will not create the signing identifier you expect (it won’t add the dot for you). +* `timestamp`: Either boolean or string. If `true` (default), use Apple’s timestamping service. If `false`, no timestamp server will be used. If a string, it will be interpreted as the URL of the timestamping server to use. + +The `files` dictionary contains as keys list of files to sign. These are usually +provided as absolute paths, but are treated relative to the DSTROOT. If the +value of the key is `true`, all default settings (at the top level of the plist) +will be used. Otherwise, it is interpreted as a dictionary with the following keys: + +* `identifier`: The code signing identifier. It will be used verbatim by codesign. Per the manual page, do **NOT** sign two different pieces of code with the same identifier. +* `hardened_runtime`: Overrides the default `hardened_runtime` setting, if present. +* `prefix`: Overrides the default `prefix` setting, if present. +* `dr`: The Designated Requirement for the code being signed. This is usually computed automatically during the sgning process. +* `order`: The order index at which the file will be signed. + +Every file in the `files` dictionary has an order index. By default, all files +have an order index of 65535. If you override this setting with another value, +you can control in which order the files are signed. This can be useful when +signing bundles that contain other bundles that also need to be signed. +Files with the lowest index values are signed first. + +## Keychain Preparation + +By default, darwinbuild does not have access to your user keychain, because it +runs xcodebuild in a different user session than the sudo process provides. You +must therefore add the keychain with your signing materials (referred to below +as `$KEYCHAIN_PATH`). Follow the below steps. + +1. `sudo su`; enter password +2. `security list-keychains -d user -s $KEYCHAIN_PATH /Library/Keychains/System.keychain` +3. `security unlock-keychain $KEYCHAIN_PATH`; enter password +4. `security list-keychains`; if `$KEYCHAIN_PATH` is listed in the output, you’re good to go. + +This should only need to be done once per Mac. Note that there is a possibility +that macOS updates will undo this change. If this ever happens, simply repeat the above steps. diff --git a/Documentation/creating_darwinbuild_plists.md b/Documentation/creating_darwinbuild_plists.md new file mode 100644 index 0000000..ae98924 --- /dev/null +++ b/Documentation/creating_darwinbuild_plists.md @@ -0,0 +1,81 @@ +# Creating Build Definition Property Lists + +To use darwinbuild, you will need to create an XML-format property list that +contains the build definitions. A barebones example looks like this: + +```xml + + + + + source_sites + + + + build + PD17D4 + + environment + + MACOSX_DEPLOYMENT_TARGET + 10.13 + SDKROOT + macosx10.13 + + + projects + + xnubuild + + version + 10.13 + + + + +``` + +Here is a key-by-key explanation of the above property list: + +* **`source_sites`** + This is a list of URLs from which darwinbuild will attempt to download the + source code for the projects it will build. Each URL will be tried in the order + it is specified here. The desired filename will be appended to each URL. If + the download returns a 404 or other error, the next URL will be tried. + + The only exception to the above logic is in the case of `opensource.apple.com`. + If the URL to download from contains the substring `opensource.apple.com/tarballs`, + then the project name (the part of the filename to download before the first hyphen) + will be prepended before the filename, like this: `opensource.apple.com/tarballs//`. + This is done to align with the way Apple organizes their website. +* **`build`** + This is the identifier of the “build” of PureDarwin the property list represents. + While there is no requirements for its format, it *must* match the filename exactly + (minus the `.plist` extension). Otherwise, darwinbuild will be unable to correctly + load the build definitions. +* **`environment`** + This dictionary contains a 1:1 mapping of environment variables that will + be propagated into each build command invoked by darwinbuild. +* **`projects`** + This is where the meat of the build definition is. The contents of + this dictionary will be described under “Project Definitions,” below. + +### Project Definitions + +A “project” is the core of the darwinbuild dependency model. The name of the project +is specified as the key in the `projects` dictionary. A project’s name is used to +refer to the project from both the command line, and from other projects as dependencies. + +The “version” of a project is in practice an arbitrary string, and is specified as +the `version` key in the project definition. Apple open-source releases +use a dot-separated sequence of one to five positive numbers here, but the logic behind +the changing of these numbers has never been publicly described. There is no strict +interpretation of which version is “newer” than another; if the version number has changed +in any way, the the project sources have changed and must be rebuilt. darwinbuild supports +keeping multiple versions of the same project in the Sources subdirectory of the build directory. + +The version does, however, determine the name of the source tarball to be downloaded. +It will always have the following format: `-.tar.gz`. The source +tarball must be available from one of the `source_sites` under this filename. If none +of the `source_sites` contain a copy of this file, darwinbuild also supports downloading +source archives from GitHub Releases; this is detailed in the “GitHub Releases Support” section. diff --git a/README b/README index b669556..424430f 100644 --- a/README +++ b/README @@ -1,8 +1,5 @@ Darwinbuild -Updated 2009-02-17 - -Kevin Van Vechten -William Siegrist +Updated 2017-12-19 1. Overview 1.1 Availability, Bug Reports, Contributions, and Discussion @@ -27,7 +24,7 @@ A. darwinxref Darwinbuild is a collection of tools that assist compilation of the many projects contained in Darwin[1], the open source base of Apple's -Mac OS X operating system[2]. Apple publishes the sources of these projects +macOS operating system[2]. Apple publishes the sources of these projects in an archive format (.tar.gz). An archive is published for each project version on Apple's site[3]. @@ -35,73 +32,66 @@ These tools will provide the proper build environment as well as help to resolve any necessary dependencies prior to building. [1] -[2] +[2] [3] 1.1 Availability, Bug Reports, Contributions, and Discussion -Due to the constant development of darwinbuild, the only version you should -be working with is trunk of the subversion repository[1]. Trunk should -always be stable enough for building projects. If you find a problem or have -a enhancement in mind, file a ticket at the website[2]. - -Discussion about darwinbuild, or building Darwin projects in -general, should take place on the darwinbuild-dev[3] mailing list. +Due to the constant development of darwinbuild, the only version you should +be working with is the master branch of the Git repository[1]. This should +always be stable enough for building projects. -[1] -[2] -[3] +[1] =============== 2. Installation =============== -You can install the latest version of darwinbuild using MacPorts. +You can install by checking out the source and building darwinbuild yourself. +You would want to run the following two commands: - % port install darwinbuild + % cd + % sudo xcodebuild install DSTROOT=/ -scheme World -Or, you can also install by checking out the source and building -darwinbuild yourself. The included Xcode project will compile the tools and install -them into the location specified by the PREFIX environment parameter. If the -PREFIX parameter is not specified, the files will be installed into /usr/local. +This will install darwinbuild and its supporting tools into /usr/local/bin. -By default, darwinbuild will build for x86_64 and i386. You can override this with -the ARCHS environment variable. However, building trunk for ppc is not supported -since trunk is targeted for Darwin 10. The release branches for Darwin 8 and 9 do -support building for ppc. +If you want to manage darwinbuild with Homebrew, you can try this technique. +First, open Xcode and perform an archive. There is no good way of doing this +from the command line, unfortunately. Then export the generated archive bundle +(it should appear with the name "world", after the scheme that created it) to a +location such as the Desktop. (Really, anywhere would do.) Then run the following +commands: -To build and install darwinbuild to the boot partition: + % mkdir -p /usr/local/Cellar/darwinbuild/HEAD + % cp -R /Products/usr/local/{bin,share} /usr/local/Cellar/darwinbuild/HEAD + % brew link darwinbuild - % cd - % sudo xcodebuild install DSTROOT=/ +You don't need to copy the include directory, and the rest of the exported archive +can be deleted afterwards. 2.1 Creating the Build Directory -After installation, you must initialize the build directory using darwinbuild. -Assuming you wanted to build projects from 9G55 in your home directory: +After installation, you must initialize the build directory using darwinbuild. +Assuming you wanted to build projects from the SUFuji16E195 plist[1] (which is +what most current development is targeting): - # mkdir ~/9G55 - # cd ~/9G55 - # sudo -s - # darwinbuild -init 9G55 + $ mkdir ~/SUFuji16E195 + $ cd ~/SUFuji16E195 + $ darwinbuild -init https://github.com/csekel/PureDarwin-System-Plist/raw/master/SUFuji16E195.plist Creating build root disk image ... - Attempting to download http://svn.macosforge.org/repository/darwinbuild/trunk/plists//9G55.plist ... - Download complete - Attempting to download http://svn.macosforge.org/repository/darwinbuild/trunk/plists//9F33.plist ... - Download complete - ... - Attempting to download http://svn.macosforge.org/repository/darwinbuild/trunk/plists//9A581.plist ... + Attempting to download https://github.com/csekel/PureDarwin-System-Plist/raw/master/SUFuji16E195.plist ... Download complete Initialization Complete - # ls + $ ls .build Headers Logs Roots Sources Symbols +[1] After initialization, the build directory will contain the following: .build contains private data for the darwinbuild system Headers contains the resulting header files from previous builds -Logs contains logs of previous build attempts +Logs contains logs of previous build attempts Roots contains the finished products of previous successful builds Sources contains sources downloaded from the web Symbols contains debug symbol versions of previous build products @@ -119,7 +109,7 @@ assume the current working directory is this build directory. To build a Darwin project, for example xnu, the darwinbuild script can be used in the following manner: - # darwinbuild xnu + $ darwinbuild xnu The darwinxref tool is consulted to find the version that corresponds to the build specified when the build directory was initialized. It is necessary @@ -127,22 +117,23 @@ to run the darwinbuild tool as root so that projects can set the proper ownership and permissions on the build results. darwinbuild first looks in the Sources directory for a directory containing -the sources to be built (Sources/xnu-517.11.1), or a .tar.gz archive -containing the sources (Sources/xnu-517.11.1.tar.gz). If neither is found, -darwinbuild will attempt to download the sources from the web. +the sources to be built (Sources/xnu-3789.51.2), or a .tar.gz archive +containing the sources (Sources/xnu-3789.51.2.tar.gz). If neither is found, +darwinbuild will attempt to download the sources from the web (including +from GitHub Releases). If it does not already exist, a BuildRoot directory will be created. This -is where the build will actually take place. During the build, darwinbuild -will change the root directory to BuildRoot (see the chroot(8) man page for -details). Darwinbuild is capable of copying the required tools, libraries -and headers from the Roots directory into the BuildRoot prior to building. -If a necessary dependency is not found in the Roots directory, it will be -downloaded from the web. +is where the build will actually take place. By default, darwinbuild does +not change the root directory to BuildRoot any more (see the chroot(8) man +page for details). This is because of incompatibilities between a chroot +environment and the current version of the Xcode build tools. Darwinbuild +can modify the tools to work correctly in a chroot, but *this is unsupported* +and may break at any time. The build output will be written to the console, and additionally logged into a file in the Logs directory. The above example produces the following file: - Logs/xnu/xnu-517.11.1.log~1 + Logs/xnu/xnu-3789.51.2.log~1 The ~1 indicates that this log file corresponds to the first attempt to build xnu version 517.11.1. Each subsequent attempt will add one to this @@ -150,7 +141,7 @@ build number. If the build succeeds, the finished product will be copied out of the BuildRoot directory and into the Roots directory: - Roots/xnu/xnu-517.11.1.root~1 + Roots/xnu/xnu-3789.51.2.root~1 After the copy, darwinbuild traverses the directory and records all files found in the darwinxref database. This makes it possible to query which project a file is produced by. When a Mach-O executable, library, or bundle @@ -180,7 +171,7 @@ the same style as the Roots directory for a regular build. For example: Passing the -logdeps flag to darwinbuild will build the specified project while recording the paths of all files openened and all executables invoked. These paths are written into the Logs directory, and if the build is -successful, will be imported into the darwinxref database. +successful, will be imported into the darwinxref database. ============================== @@ -206,13 +197,13 @@ passed since cpp-precomp is not available. During the build, the RC_ARCHS and RC_NONARCH_CFLAGS variables will be combined to create the RC_ARCHS environment variable; a -arch flag will be appended for each architecture listed in RC_ARCHS. -The MACOSX_DEPLOYMENT_TARGET variable should match the major Mac OS X release +The MACOSX_DEPLOYMENT_TARGET variable should match the major macOS release that is being targeted, such as 10.2 or 10.3. 4.1 Build Aliases and Alternate Targets -Some projects may produce different results based on the contents of +Some projects may produce different results based on the contents of the RC_ProjectName variable. When the same source archive is used to create more than one component of Darwin, it's referred to as a build alias. Because of this, it is important to always provide accurrate @@ -224,79 +215,14 @@ to the make tool (gnumake or xcodebuild). However, some projects produce different results based on alternate targets. If the project in the property list contains a "target" attribute, that string will be passed instead. - -====================== -5. Tips and Techniques -====================== - - -5.1 Private Headers - -Many open source header files are not present in a standard Mac OS X install. -These "private headers" are not needed by application developers, and are not -part of any SDK officially supported by Apple. However, Darwin projects are -part of the operating system itself and these headers are required. The -darwinbuildheaders command uses the darwinxref tool and darwinbuild -headers -commands to produce all header files for a given darwin release. - % bin/darwinbuildheaders - -The resulting header files from each project are placed into the Headers -directory. The headers can be subsequently installed into the BuildRoot -directory using the installheaders command. - % bin/installheaders - -By modifying the build plist file, it is possible to include these headers -instead of the default system headers, giving more accurate build results and -avoiding failures. Edit the RC_NONARCH_CFLAGS variable to provide the following -include paths to gcc (substituting the actual installation directory). - -I/usr/local/darwinbuild/BuildRoot/usr/include - -I/usr/local/darwinbuild/BuildRoot/usr/local/include - - -5.2 Build Tools - -In addition to private headers, there are numerous command line tools which -are used exclusively to build Darwin projects. These tools are placed in -/usr/local/bin. For example, building xnu requires kextsymboltool, -relpath, and decomment. - - -5.3 Static Libraries - -Several projects require static libraries from other projects. These libraries -are usually placed in /usr/local/lib/system. The most notable examples are -xnu's usage of libkld.a which is produced by cctools_ofiles, and Libsystem's -use of many static libraries from Libc, Libinfo, and more. - - -5.4 Alternate BuildRoot Storage - -By default, "darwinbuild -init" will setup your environment to use a HFSX -sparsebundle to host your BuildRoot. A sparsebundle is used to work around -problems with using xcodebuild inside of a chroot. There are two other -storage methods to choose from: NFS Loopback and Legacy Directory. - - 1. NFS Loopback (ex: darwinbuild -init 9G55 -nfs) - The NFS loopback method places a directory under .build and adds that - directory to /etc/exports. When you try to build a project, darwinbuild - will mount the NFS export on localhost. The NFS mount also works around - the xcodebuild problems. - - 2. Legacy Directory (ex: darwinbuild -init 9G55 -nodmg) - This is just the way darwinbuild worked before the sparsebundle and NFS - support was added. It just makes a directory for BuildRoot and builds - on whatever filesystem you are on at the time. If you are on HFS or ZFS, - this storage will cause problems for Xcode-based projects. - - ============= A. darwinxref ============= The darwinxref tool allows you to query which source version of a Darwin -project is present in a particular Mac OS X build. It also stores information +project is present in a particular macOS build. It also stores information about what dependencies a particular project has, and what files the project -produces. As each Mac OS X release is made available, Apple publishes a +produces. As each macOS release is made available, Apple publishes a property list file containing the project names and versions in that release. These property lists are read by the darwinxref tool to seed its internal database. Property lists are available via Subversion[1]. @@ -310,19 +236,19 @@ header file, sqlite3.h. [2] An example of downloading, installing, and querying a property list: - % curl http://svn.macosforge.org/repository/darwinbuild/trunk/plists/7U16.plist > \ - plists/7U16.plist - % bin/darwinxref loadIndex plists/7U16.plist + $ curl -L https://github.com/csekel/PureDarwin-System-Plist/raw/master/SUFuji16E195.plist > \ + plists/SUFuji16E195.plist + $ darwinxref loadIndex plists/SUFuji16E195.plist 268 of 268 projects loaded. - % bin/darwinxref -b 7U16 version xnu - xnu-517.11.1 + $ darwinxref -b SUFuji16E195 version xnu + xnu-3789.51.2 To list all projects in a build, use the special project name '*': - % bin/darwinxref -b 7U16 version '*' + $ darwinxref -b SUFuji16E195 version '*' To register the results of a previous build with the database use the register command. Note this is done automatically by darwinbuild: - % bin/darwinxref register adv_cmds 63 Roots/adv_cmds/adv_cmds-63.root~1 + $ darwinxref register adv_cmds 63 Roots/adv_cmds/adv_cmds-63.root~1 /bin /bin/ps /bin/stty @@ -330,8 +256,6 @@ register command. Note this is done automatically by darwinbuild: To find which project produces the 'whois' command by searching the list of previously registered files: - % bin/darwinxref findFile whois + $ bin/darwinxref findFile whois adv_cmds-63: /usr/bin/whois - - diff --git a/archs.sh b/archs.sh old mode 100755 new mode 100644 diff --git a/darwinbuild.xcodeproj/project.pbxproj b/darwinbuild.xcodeproj/project.pbxproj index cf61d3b..a466c2b 100644 --- a/darwinbuild.xcodeproj/project.pbxproj +++ b/darwinbuild.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -22,7 +22,8 @@ isa = PBXAggregateTarget; buildConfigurationList = 7227AC451098DC9900BE33D7 /* Build configuration list for PBXAggregateTarget "darwinbuild_scripts" */; buildPhases = ( - 7227AD1B109A053900BE33D7 /* CopyFiles */, + 7227AD1B109A053900BE33D7 /* Copy Files */, + 1F12836421C89FB900E3A732 /* CopyFiles */, ); dependencies = ( 720BE2F6120C90E500B3C4A5 /* PBXTargetDependency */, @@ -31,8 +32,6 @@ 7227AC3E1098DC6A00BE33D7 /* PBXTargetDependency */, 7227AC3C1098DC6A00BE33D7 /* PBXTargetDependency */, 7227AC3A1098DC6A00BE33D7 /* PBXTargetDependency */, - 7227AC381098DC6A00BE33D7 /* PBXTargetDependency */, - 7227AC361098DC6A00BE33D7 /* PBXTargetDependency */, ); name = darwinbuild_scripts; productName = darwinbuild_scripts; @@ -78,7 +77,9 @@ buildPhases = ( ); dependencies = ( - 72C86C5F1096617500C66E90 /* PBXTargetDependency */, + 1FF1E7E322E65BC9002B8CAA /* PBXTargetDependency */, + 1FCA51AF22E6551E00D55269 /* PBXTargetDependency */, + 1FA9FAFD22E61D9D0096A78D /* PBXTargetDependency */, 72C86C611096617500C66E90 /* PBXTargetDependency */, 725740971097B03D008AD4D7 /* PBXTargetDependency */, 7227AB101097BBA900BE33D7 /* PBXTargetDependency */, @@ -90,29 +91,39 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 1F7298EB24D75A200006E19E /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F7298EA24D759FF0006E19E /* libsqlite3.tbd */; }; + 1F7D730D22E52DFD003F8A67 /* SwiftCLI in Frameworks */ = {isa = PBXBuildFile; productRef = 1F7D730C22E52DFD003F8A67 /* SwiftCLI */; }; + 1F8B4BA824EB74DC00CC07E5 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F8B4BA724EB74DC00CC07E5 /* CoreFoundation.framework */; }; + 1FA2A9EA22E62BF600F53888 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FA2A9E922E62BF600F53888 /* main.swift */; }; + 1FA2A9EF22E62BFE00F53888 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF4AFCB22E5237B002F09C6 /* Utilities.swift */; }; + 1FA2A9F222E62C1900F53888 /* SwiftCLI in Frameworks */ = {isa = PBXBuildFile; productRef = 1FA2A9F122E62C1900F53888 /* SwiftCLI */; }; + 1FB1351722E522B5005E9A88 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB1351622E522B5005E9A88 /* main.swift */; }; + 1FCA51B722E6562800D55269 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FCA51B622E6562800D55269 /* main.swift */; }; + 1FCA51BC22E6562F00D55269 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF4AFCB22E5237B002F09C6 /* Utilities.swift */; }; + 1FCA51BF22E6563C00D55269 /* SwiftCLI in Frameworks */ = {isa = PBXBuildFile; productRef = 1FCA51BE22E6563C00D55269 /* SwiftCLI */; }; + 1FDAA0F525281B7700B92892 /* PDSDKSettings.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1FDAA0F425281B7500B92892 /* PDSDKSettings.plist */; }; + 1FDE55C024DB9DE1009ED847 /* libtcl8.6.dylib in Copy libtcl8.6.dylib */ = {isa = PBXBuildFile; fileRef = 1FDE55BD24DB9DBD009ED847 /* libtcl8.6.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 1FECB5DF1FBBBD41002EA059 /* setXcodePlatform in Copy Files */ = {isa = PBXBuildFile; fileRef = 1FECB5DE1FBBBC09002EA059 /* setXcodePlatform */; }; + 1FF3C41A24EAF989002A5356 /* libtcl8.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FDE55BD24DB9DBD009ED847 /* libtcl8.6.dylib */; }; + 1FF4AFCC22E5237B002F09C6 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF4AFCB22E5237B002F09C6 /* Utilities.swift */; }; + 3963011A1EAB4D60006081C7 /* source_sites.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C0E10965EEA00C66E90 /* source_sites.c */; }; + 396301211EAB4E01006081C7 /* patch_sites.c in Sources */ = {isa = PBXBuildFile; fileRef = 396301191EAB42B6006081C7 /* patch_sites.c */; }; + 396301291EAB5DBC006081C7 /* patch_sites.tcl in CopyFiles */ = {isa = PBXBuildFile; fileRef = 396301281EAB5DB5006081C7 /* patch_sites.tcl */; }; 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 */; }; 7227AB44109897D500BE33D7 /* darwin.tcl in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86BF710965EEA00C66E90 /* darwin.tcl */; }; 7227AB45109897D500BE33D7 /* group.tcl in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C0210965EEA00C66E90 /* group.tcl */; }; 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, ); }; }; + 7227AB67109899A600BE33D7 /* cfutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BE910965E7500C66E90 /* cfutils.h */; }; + 7227AB68109899A600BE33D7 /* DBPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BED10965E7500C66E90 /* DBPlugin.h */; }; 7227AB7510989F8D00BE33D7 /* manifest.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C2E1096600B00C66E90 /* manifest.c */; }; - 7227AD1C109A05FA00BE33D7 /* buildlist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB871098A7BF00BE33D7 /* buildlist */; }; - 7227AD1D109A05FA00BE33D7 /* buildorder in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB881098A7BF00BE33D7 /* buildorder */; }; - 7227AD1E109A05FA00BE33D7 /* ditto in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB891098A7BF00BE33D7 /* ditto */; }; - 7227AD1F109A05FA00BE33D7 /* synthfat in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB8B1098A7BF00BE33D7 /* synthfat */; }; - 7227AD20109A05FA00BE33D7 /* thinFile in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB8C1098A7BF00BE33D7 /* thinFile */; }; - 7227AD21109A05FA00BE33D7 /* createChroot in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C221096600B00C66E90 /* createChroot */; }; - 7227AD22109A05FA00BE33D7 /* darwinbuild.common in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C231096600B00C66E90 /* darwinbuild.common */; }; - 7227AD23109A05FA00BE33D7 /* Info.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C271096600B00C66E90 /* Info.plist */; }; - 7227AD24109A05FA00BE33D7 /* installXcode2 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C291096600B00C66E90 /* installXcode2 */; }; - 7227AD25109A05FA00BE33D7 /* installXcode3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C2A1096600B00C66E90 /* installXcode3 */; }; - 7227AD26109A05FA00BE33D7 /* installXcode31 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C2B1096600B00C66E90 /* installXcode31 */; }; - 7227AD27109A05FA00BE33D7 /* SDKSettings.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72C86C311096600B00C66E90 /* SDKSettings.plist */; }; + 7227AD1C109A05FA00BE33D7 /* buildlist in Copy Files */ = {isa = PBXBuildFile; fileRef = 7227AB871098A7BF00BE33D7 /* buildlist */; }; + 7227AD1D109A05FA00BE33D7 /* buildorder in Copy Files */ = {isa = PBXBuildFile; fileRef = 7227AB881098A7BF00BE33D7 /* buildorder */; }; + 7227AD1F109A05FA00BE33D7 /* synthfat in Copy Files */ = {isa = PBXBuildFile; fileRef = 7227AB8B1098A7BF00BE33D7 /* synthfat */; }; + 7227AD20109A05FA00BE33D7 /* thinFile in Copy Files */ = {isa = PBXBuildFile; fileRef = 7227AB8C1098A7BF00BE33D7 /* thinFile */; }; + 7227AD22109A05FA00BE33D7 /* darwinbuild.common in Copy Files */ = {isa = PBXBuildFile; fileRef = 72C86C231096600B00C66E90 /* darwinbuild.common */; }; 72573FF71097A601008AD4D7 /* dependencies.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BF810965EEA00C66E90 /* dependencies.c */; }; 72573FF81097A60C008AD4D7 /* diff.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BFA10965EEA00C66E90 /* diff.c */; }; 72573FF91097A64C008AD4D7 /* dot.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BFB10965EEA00C66E90 /* dot.c */; }; @@ -131,7 +142,6 @@ 725740901097AFFB008AD4D7 /* plist_sites.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C0B10965EEA00C66E90 /* plist_sites.c */; }; 725740911097B004008AD4D7 /* register.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C0C10965EEA00C66E90 /* register.c */; }; 725740921097B00C008AD4D7 /* resolveDeps.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C0D10965EEA00C66E90 /* resolveDeps.c */; }; - 725740931097B012008AD4D7 /* source_sites.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C0E10965EEA00C66E90 /* source_sites.c */; }; 725740941097B018008AD4D7 /* target.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C0F10965EEA00C66E90 /* target.c */; }; 725740951097B01E008AD4D7 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C1010965EEA00C66E90 /* version.c */; }; 725749AD10976A6300B13BC3 /* cfutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BE810965E7500C66E90 /* cfutils.c */; }; @@ -139,28 +149,40 @@ 725749AF10976A6300B13BC3 /* DBPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BEC10965E7500C66E90 /* DBPlugin.c */; }; 725749B010976A6300B13BC3 /* DBTclPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BEF10965E7500C66E90 /* DBTclPlugin.c */; }; 725749B110976A6300B13BC3 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BF010965E7500C66E90 /* main.c */; }; - 725749B610976AFE00B13BC3 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72C86CE310974CC800C66E90 /* libsqlite3.dylib */; }; - 72574A1010977F7A00B13BC3 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72574A0F10977F7A00B13BC3 /* CoreFoundation.framework */; }; - 72574A1510977FAD00B13BC3 /* libtcl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72574A1410977FAD00B13BC3 /* libtcl.dylib */; }; 72574B5D1097A37600B13BC3 /* configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BF510965EEA00C66E90 /* configuration.c */; }; 72C86C68109663D300C66E90 /* darwintrace.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BD910965E0A00C66E90 /* darwintrace.c */; }; - 72C86C99109745BC00C66E90 /* Archive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BDA10965E4F00C66E90 /* Archive.cpp */; }; - 72C86C9A109745BC00C66E90 /* Depot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BDC10965E4F00C66E90 /* Depot.cpp */; }; - 72C86C9B109745BC00C66E90 /* Digest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BDE10965E4F00C66E90 /* Digest.cpp */; }; - 72C86C9C109745BC00C66E90 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72C86BE010965E4F00C66E90 /* File.cpp */; }; - 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 */; }; - 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 */; }; - DFC9772D11138F9400CAE084 /* Column.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFC9772711138F9400CAE084 /* Column.cpp */; }; - DFC9772E11138F9400CAE084 /* Database.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFC9772911138F9400CAE084 /* Database.cpp */; }; - DFC9772F11138F9400CAE084 /* Table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFC9772B11138F9400CAE084 /* Table.cpp */; }; - DFCAA3C61178E1A1008DCF37 /* darwinup.1 in Install Manpage */ = {isa = PBXBuildFile; fileRef = DFCAA39C1178E05B008DCF37 /* darwinup.1 */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 1FA9FAFC22E61D9D0096A78D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 726DD14910965C5700D5AEAB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1FB1351322E522B5005E9A88; + remoteInfo = "darwinbuild-codesign"; + }; + 1FCA51AE22E6551E00D55269 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 726DD14910965C5700D5AEAB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1FA2A9E622E62BF600F53888; + remoteInfo = "darwinbuild-recursive"; + }; + 1FF1E7E222E65BC9002B8CAA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 726DD14910965C5700D5AEAB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1FCA51B322E6562800D55269; + remoteInfo = "fetch-from-github"; + }; + 3963011E1EAB4E01006081C7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 726DD14910965C5700D5AEAB /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7257499F1097697300B13BC3; + remoteInfo = darwinxref; + }; 720BE2F5120C90E500B3C4A5 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 726DD14910965C5700D5AEAB /* Project object */; @@ -182,20 +204,6 @@ remoteGlobalIDString = 7227AB3D1098977C00BE33D7; remoteInfo = tcl_plugins; }; - 7227AC351098DC6A00BE33D7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 726DD14910965C5700D5AEAB /* Project object */; - proxyType = 1; - remoteGlobalIDString = 7227AC271098DBDF00BE33D7; - remoteInfo = installXcode32; - }; - 7227AC371098DC6A00BE33D7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 726DD14910965C5700D5AEAB /* Project object */; - proxyType = 1; - remoteGlobalIDString = 7227AC1E1098DB9200BE33D7; - remoteInfo = installXcode; - }; 7227AC391098DC6A00BE33D7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 726DD14910965C5700D5AEAB /* Project object */; @@ -567,13 +575,6 @@ remoteGlobalIDString = 72574B581097A36300B13BC3; remoteInfo = configuration; }; - 72C86C5E1096617500C66E90 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 726DD14910965C5700D5AEAB /* Project object */; - proxyType = 1; - remoteGlobalIDString = 72C86C471096609500C66E90; - remoteInfo = darwinup; - }; 72C86C601096617500C66E90 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 726DD14910965C5700D5AEAB /* Project object */; @@ -598,62 +599,98 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 7227AB3C1098977C00BE33D7 /* CopyFiles */ = { + 1F12836421C89FB900E3A732 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; - dstPath = "$(DATDIR)/darwinxref/plugins"; + dstPath = "$(BINDIR)"; dstSubfolderSpec = 0; files = ( - 7227AB41109897D500BE33D7 /* binary_sites.tcl in CopyFiles */, - 7227AB42109897D500BE33D7 /* branch.tcl in CopyFiles */, - 7227AB43109897D500BE33D7 /* currentBuild.tcl in CopyFiles */, - 7227AB44109897D500BE33D7 /* darwin.tcl in CopyFiles */, - 7227AB45109897D500BE33D7 /* group.tcl in CopyFiles */, - 7227AB46109897D500BE33D7 /* macosx.tcl in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; }; - 7227AD1B109A053900BE33D7 /* CopyFiles */ = { + 1FDAA0F325281B5D00B92892 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; - dstPath = "$(DATDIR)/darwinbuild"; + dstPath = /usr/local/share/darwinbuild; + dstSubfolderSpec = 0; + files = ( + 1FDAA0F525281B7700B92892 /* PDSDKSettings.plist in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 1FDE55BF24DB9DD1009ED847 /* Copy libtcl8.6.dylib */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/local/share/darwinxref; dstSubfolderSpec = 0; files = ( - 7227AD1C109A05FA00BE33D7 /* buildlist in CopyFiles */, - 7227AD1D109A05FA00BE33D7 /* buildorder in CopyFiles */, - 7227AD1E109A05FA00BE33D7 /* ditto in CopyFiles */, - 7227AD1F109A05FA00BE33D7 /* synthfat in CopyFiles */, - 7227AD20109A05FA00BE33D7 /* thinFile in CopyFiles */, - 7227AD21109A05FA00BE33D7 /* createChroot in CopyFiles */, - 7227AD22109A05FA00BE33D7 /* darwinbuild.common in CopyFiles */, - 7227AD23109A05FA00BE33D7 /* Info.plist in CopyFiles */, - 7227AD24109A05FA00BE33D7 /* installXcode2 in CopyFiles */, - 7227AD25109A05FA00BE33D7 /* installXcode3 in CopyFiles */, - 7227AD26109A05FA00BE33D7 /* installXcode31 in CopyFiles */, - 7227AD27109A05FA00BE33D7 /* SDKSettings.plist in CopyFiles */, + 1FDE55C024DB9DE1009ED847 /* libtcl8.6.dylib in Copy libtcl8.6.dylib */, ); + name = "Copy libtcl8.6.dylib"; runOnlyForDeploymentPostprocessing = 1; }; - DFCAA3C51178E10E008DCF37 /* Install Manpage */ = { + 7227AB3C1098977C00BE33D7 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; - dstPath = "$(DATDIR)/man/man1"; + dstPath = "$(DATDIR)/darwinxref/plugins"; dstSubfolderSpec = 0; files = ( - DFCAA3C61178E1A1008DCF37 /* darwinup.1 in Install Manpage */, + 7227AB41109897D500BE33D7 /* binary_sites.tcl in CopyFiles */, + 7227AB43109897D500BE33D7 /* currentBuild.tcl in CopyFiles */, + 396301291EAB5DBC006081C7 /* patch_sites.tcl in CopyFiles */, + 7227AB44109897D500BE33D7 /* darwin.tcl in CopyFiles */, + 7227AB45109897D500BE33D7 /* group.tcl in CopyFiles */, + 7227AB46109897D500BE33D7 /* macosx.tcl in CopyFiles */, ); - name = "Install Manpage"; + runOnlyForDeploymentPostprocessing = 1; + }; + 7227AD1B109A053900BE33D7 /* Copy Files */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = "$(DATDIR)/darwinbuild"; + dstSubfolderSpec = 0; + files = ( + 1FECB5DF1FBBBD41002EA059 /* setXcodePlatform in Copy Files */, + 7227AD1C109A05FA00BE33D7 /* buildlist in Copy Files */, + 7227AD1D109A05FA00BE33D7 /* buildorder in Copy Files */, + 7227AD1F109A05FA00BE33D7 /* synthfat in Copy Files */, + 7227AD20109A05FA00BE33D7 /* thinFile in Copy Files */, + 7227AD22109A05FA00BE33D7 /* darwinbuild.common in Copy Files */, + ); + name = "Copy Files"; runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 1F4A793721B9F123000FE4B5 /* conclusion.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = conclusion.html; path = installer/conclusion.html; sourceTree = ""; }; + 1F4A793821B9F123000FE4B5 /* license.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = license.html; path = installer/license.html; sourceTree = ""; }; + 1F4A793921B9F123000FE4B5 /* welcome.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = welcome.html; path = installer/welcome.html; sourceTree = ""; }; + 1F7298EA24D759FF0006E19E /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; + 1F8B4BA724EB74DC00CC07E5 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + 1F9D9647226516AA0024E830 /* darwinxref.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = darwinxref.entitlements; path = darwinxref/darwinxref.entitlements; sourceTree = ""; }; + 1FA2A9E722E62BF600F53888 /* darwinbuild-recursive */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "darwinbuild-recursive"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1FA2A9E922E62BF600F53888 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; + 1FB1351422E522B5005E9A88 /* sign-root */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "sign-root"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1FB1351622E522B5005E9A88 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; + 1FCA51B422E6562800D55269 /* fetch-from-github */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "fetch-from-github"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1FCA51B622E6562800D55269 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; + 1FD9F0CD21B9E90700FB866A /* build.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = build.sh; path = installer/build.sh; sourceTree = ""; }; + 1FD9F0CF21B9EAA300FB866A /* distribution.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = distribution.xml; path = installer/distribution.xml; sourceTree = ""; }; + 1FDAA0F425281B7500B92892 /* PDSDKSettings.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PDSDKSettings.plist; path = darwinbuild/PDSDKSettings.plist; sourceTree = ""; }; + 1FDE256A24D75B4900CBC605 /* vendor-tcl.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = "vendor-tcl.sh"; path = "darwinxref/vendor-tcl.sh"; sourceTree = ""; }; + 1FDE55BD24DB9DBD009ED847 /* libtcl8.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libtcl8.6.dylib; path = darwinxref/libtcl8.6.dylib; sourceTree = ""; }; + 1FEA10392264FBCF008B675D /* notarize.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = notarize.sh; path = installer/notarize.sh; sourceTree = ""; }; + 1FECB5DE1FBBBC09002EA059 /* setXcodePlatform */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = setXcodePlatform; path = darwinbuild/setXcodePlatform; sourceTree = ""; }; + 1FF4AFCB22E5237B002F09C6 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; }; + 396301191EAB42B6006081C7 /* patch_sites.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = patch_sites.c; sourceTree = ""; }; + 396301271EAB4E01006081C7 /* patch_sites.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = patch_sites.so; sourceTree = BUILT_PRODUCTS_DIR; }; + 396301281EAB5DB5006081C7 /* patch_sites.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = patch_sites.tcl; sourceTree = ""; }; 720BE2E9120C909E00B3C4A5 /* digest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = digest.c; path = darwinbuild/digest.c; sourceTree = ""; }; 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 = ""; }; 7227AB881098A7BF00BE33D7 /* buildorder */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = buildorder; path = darwinbuild/buildorder; sourceTree = ""; }; - 7227AB891098A7BF00BE33D7 /* ditto */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = ditto; path = darwinbuild/ditto; sourceTree = ""; }; 7227AB8A1098A7BF00BE33D7 /* packageRoots.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = packageRoots.in; path = darwinbuild/packageRoots.in; sourceTree = ""; }; 7227AB8B1098A7BF00BE33D7 /* synthfat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = synthfat; path = darwinbuild/synthfat; sourceTree = ""; }; 7227AB8C1098A7BF00BE33D7 /* thinFile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = thinFile; path = darwinbuild/thinFile; sourceTree = ""; }; @@ -663,8 +700,6 @@ 7227AC0A1098D7CE00BE33D7 /* darwinmaster.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = darwinmaster.in; path = darwinbuild/darwinmaster.in; sourceTree = ""; }; 7227AC131098D84600BE33D7 /* packageRoots */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = packageRoots; sourceTree = BUILT_PRODUCTS_DIR; }; 7227AC1C1098D8DB00BE33D7 /* thinPackages */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = thinPackages; sourceTree = BUILT_PRODUCTS_DIR; }; - 7227AC251098DB9200BE33D7 /* installXcode */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = installXcode; sourceTree = BUILT_PRODUCTS_DIR; }; - 7227AC2E1098DBDF00BE33D7 /* installXcode32 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = installXcode32; sourceTree = BUILT_PRODUCTS_DIR; }; 72573F7F1097A488008AD4D7 /* dependencies.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = dependencies.so; sourceTree = BUILT_PRODUCTS_DIR; }; 72573FD21097A4B7008AD4D7 /* dot.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = dot.so; sourceTree = BUILT_PRODUCTS_DIR; }; 72573FDB1097A538008AD4D7 /* diff.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = diff.so; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -688,24 +723,9 @@ 7257407E1097AF0A008AD4D7 /* target.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = target.so; sourceTree = BUILT_PRODUCTS_DIR; }; 725740861097AF30008AD4D7 /* version.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = version.so; sourceTree = BUILT_PRODUCTS_DIR; }; 725749A01097697300B13BC3 /* darwinxref */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = darwinxref; sourceTree = BUILT_PRODUCTS_DIR; }; - 72574A0F10977F7A00B13BC3 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 72574A1410977FAD00B13BC3 /* libtcl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libtcl.dylib; path = /usr/lib/libtcl.dylib; sourceTree = ""; }; 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = c_plugins.xcconfig; sourceTree = ""; }; 72574B591097A36300B13BC3 /* configuration.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = configuration.so; sourceTree = BUILT_PRODUCTS_DIR; }; 72C86BD910965E0A00C66E90 /* darwintrace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = darwintrace.c; path = darwintrace/darwintrace.c; sourceTree = ""; }; - 72C86BDA10965E4F00C66E90 /* Archive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Archive.cpp; path = darwinup/Archive.cpp; sourceTree = ""; }; - 72C86BDB10965E4F00C66E90 /* Archive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Archive.h; path = darwinup/Archive.h; sourceTree = ""; }; - 72C86BDC10965E4F00C66E90 /* Depot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Depot.cpp; path = darwinup/Depot.cpp; sourceTree = ""; }; - 72C86BDD10965E4F00C66E90 /* Depot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Depot.h; path = darwinup/Depot.h; sourceTree = ""; }; - 72C86BDE10965E4F00C66E90 /* Digest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Digest.cpp; path = darwinup/Digest.cpp; sourceTree = ""; }; - 72C86BDF10965E4F00C66E90 /* Digest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Digest.h; path = darwinup/Digest.h; sourceTree = ""; }; - 72C86BE010965E4F00C66E90 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = File.cpp; path = darwinup/File.cpp; sourceTree = ""; }; - 72C86BE110965E4F00C66E90 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = File.h; path = darwinup/File.h; sourceTree = ""; }; - 72C86BE210965E4F00C66E90 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = darwinup/main.cpp; sourceTree = ""; }; - 72C86BE410965E4F00C66E90 /* SerialSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SerialSet.cpp; path = darwinup/SerialSet.cpp; sourceTree = ""; }; - 72C86BE510965E4F00C66E90 /* SerialSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SerialSet.h; path = darwinup/SerialSet.h; sourceTree = ""; }; - 72C86BE610965E4F00C66E90 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Utils.cpp; path = darwinup/Utils.cpp; sourceTree = ""; }; - 72C86BE710965E4F00C66E90 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Utils.h; path = darwinup/Utils.h; sourceTree = ""; }; 72C86BE810965E7500C66E90 /* cfutils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cfutils.c; path = darwinxref/cfutils.c; sourceTree = ""; }; 72C86BE910965E7500C66E90 /* cfutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cfutils.h; path = darwinxref/cfutils.h; sourceTree = ""; }; 72C86BEA10965E7500C66E90 /* DBDataStore.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DBDataStore.c; path = darwinxref/DBDataStore.c; sourceTree = ""; }; @@ -716,7 +736,6 @@ 72C86BEF10965E7500C66E90 /* DBTclPlugin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DBTclPlugin.c; path = darwinxref/DBTclPlugin.c; sourceTree = ""; }; 72C86BF010965E7500C66E90 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = darwinxref/main.c; sourceTree = ""; }; 72C86BF310965EEA00C66E90 /* binary_sites.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = binary_sites.tcl; sourceTree = ""; }; - 72C86BF410965EEA00C66E90 /* branch.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = branch.tcl; sourceTree = ""; }; 72C86BF510965EEA00C66E90 /* configuration.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = configuration.c; sourceTree = ""; }; 72C86BF610965EEA00C66E90 /* currentBuild.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = currentBuild.tcl; sourceTree = ""; }; 72C86BF710965EEA00C66E90 /* darwin.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = darwin.tcl; sourceTree = ""; }; @@ -745,66 +764,53 @@ 72C86C0E10965EEA00C66E90 /* source_sites.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = source_sites.c; sourceTree = ""; }; 72C86C0F10965EEA00C66E90 /* target.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = target.c; sourceTree = ""; }; 72C86C1010965EEA00C66E90 /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = ""; }; - 72C86C221096600B00C66E90 /* createChroot */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = createChroot; path = darwinbuild/createChroot; sourceTree = ""; }; 72C86C231096600B00C66E90 /* darwinbuild.common */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = darwinbuild.common; path = darwinbuild/darwinbuild.common; sourceTree = ""; }; 72C86C241096600B00C66E90 /* darwinbuild.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = darwinbuild.in; path = darwinbuild/darwinbuild.in; sourceTree = ""; }; - 72C86C271096600B00C66E90 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = darwinbuild/Info.plist; sourceTree = ""; }; - 72C86C281096600B00C66E90 /* installXcode.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = installXcode.in; path = darwinbuild/installXcode.in; sourceTree = ""; }; - 72C86C291096600B00C66E90 /* installXcode2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = installXcode2; path = darwinbuild/installXcode2; sourceTree = ""; }; - 72C86C2A1096600B00C66E90 /* installXcode3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = installXcode3; path = darwinbuild/installXcode3; sourceTree = ""; }; - 72C86C2B1096600B00C66E90 /* installXcode31 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = installXcode31; path = darwinbuild/installXcode31; sourceTree = ""; }; - 72C86C2C1096600B00C66E90 /* installXcode32.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = installXcode32.in; path = darwinbuild/installXcode32.in; sourceTree = ""; }; 72C86C2E1096600B00C66E90 /* manifest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = manifest.c; path = darwinbuild/manifest.c; sourceTree = ""; }; - 72C86C311096600B00C66E90 /* SDKSettings.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = SDKSettings.plist; path = darwinbuild/SDKSettings.plist; sourceTree = ""; }; 72C86C381096607900C66E90 /* darwinbuild */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = darwinbuild; sourceTree = BUILT_PRODUCTS_DIR; }; - 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; }; - 72C86CE310974CC800C66E90 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = /usr/lib/libsqlite3.dylib; sourceTree = ""; }; 72D05CA911D2678F00B33EDD /* query.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = query.c; sourceTree = ""; }; 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 = ""; }; - DF12E2811119E2B0007587C1 /* DB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DB.cpp; path = darwinup/DB.cpp; sourceTree = ""; }; DF6BE300132C5EBD00793781 /* close-test */ = {isa = PBXFileReference; lastKnownFileType = text; path = "close-test"; sourceTree = ""; }; DF6BE301132C5EBD00793781 /* exec */ = {isa = PBXFileReference; lastKnownFileType = text; path = exec; sourceTree = ""; }; DF6BE302132C5EBD00793781 /* realpath */ = {isa = PBXFileReference; lastKnownFileType = text; path = realpath; sourceTree = ""; }; DF6BE303132C5EBD00793781 /* redirection-test */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "redirection-test"; sourceTree = ""; }; DF6BE304132C5EBD00793781 /* run-tests.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "run-tests.sh"; sourceTree = ""; }; - DF6BE306132C5EBD00793781 /* 300dirs.tbz2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 300dirs.tbz2; sourceTree = ""; }; - DF6BE307132C5EBD00793781 /* 300files.tbz2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 300files.tbz2; sourceTree = ""; }; - DF6BE308132C5EBD00793781 /* corrupt.tgz */ = {isa = PBXFileReference; lastKnownFileType = text; path = corrupt.tgz; sourceTree = ""; }; - DF6BE309132C5EBD00793781 /* deep-rollback-2.xar */ = {isa = PBXFileReference; lastKnownFileType = file; path = "deep-rollback-2.xar"; sourceTree = ""; }; - DF6BE30A132C5EBD00793781 /* deep-rollback.cpgz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "deep-rollback.cpgz"; sourceTree = ""; }; - DF6BE30B132C5EBD00793781 /* depotroot.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = depotroot.tar.gz; sourceTree = ""; }; - DF6BE30C132C5EBD00793781 /* dest.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = dest.tar.gz; sourceTree = ""; }; - DF6BE30D132C5EBD00793781 /* extension.tar.bz2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = extension.tar.bz2; sourceTree = ""; }; - DF6BE30E132C5EBD00793781 /* rep_dir_file.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_dir_file.tar.gz; sourceTree = ""; }; - DF6BE30F132C5EBD00793781 /* rep_dir_link.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_dir_link.tar.gz; sourceTree = ""; }; - DF6BE310132C5EBD00793781 /* rep_file_dir.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_file_dir.tar.gz; sourceTree = ""; }; - DF6BE311132C5EBD00793781 /* rep_file_link.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_file_link.tar.gz; sourceTree = ""; }; - DF6BE312132C5EBD00793781 /* rep_flink_dir.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_flink_dir.tar.gz; sourceTree = ""; }; - DF6BE313132C5EBD00793781 /* rep_flink_file.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_flink_file.tar.gz; sourceTree = ""; }; - DF6BE314132C5EBD00793781 /* rep_link_dir.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_link_dir.tar.gz; sourceTree = ""; }; - DF6BE315132C5EBD00793781 /* rep_link_file.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = rep_link_file.tar.gz; sourceTree = ""; }; - DF6BE316132C5EBD00793781 /* root.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = root.tar.gz; sourceTree = ""; }; - DF6BE317132C5EBD00793781 /* root2.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = root2.tar.gz; sourceTree = ""; }; - DF6BE318132C5EBD00793781 /* root3.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = root3.tar.gz; sourceTree = ""; }; - DF6BE319132C5EBD00793781 /* root5.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = root5.tar.gz; sourceTree = ""; }; - DF6BE31A132C5EBD00793781 /* root6.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = root6.tar.gz; sourceTree = ""; }; - DF6BE31B132C5EBD00793781 /* root7.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = root7.tar.gz; sourceTree = ""; }; - DF6BE31C132C5EBD00793781 /* run-tests.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "run-tests.sh"; sourceTree = ""; }; - DF6BE31D132C5EBD00793781 /* symlink_update.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = symlink_update.tar.gz; sourceTree = ""; }; - DF6BE31E132C5EBD00793781 /* symlinks.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = symlinks.tar.gz; sourceTree = ""; }; DF6BE31F132C5EBD00793781 /* run-all-tests.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "run-all-tests.sh"; sourceTree = ""; }; - DFC9772711138F9400CAE084 /* Column.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Column.cpp; path = darwinup/Column.cpp; sourceTree = ""; }; - DFC9772811138F9400CAE084 /* Column.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Column.h; path = darwinup/Column.h; sourceTree = ""; }; - DFC9772911138F9400CAE084 /* Database.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Database.cpp; path = darwinup/Database.cpp; sourceTree = ""; }; - DFC9772A11138F9400CAE084 /* Database.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Database.h; path = darwinup/Database.h; sourceTree = ""; }; - DFC9772B11138F9400CAE084 /* Table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Table.cpp; path = darwinup/Table.cpp; sourceTree = ""; }; - DFC9772C11138F9400CAE084 /* Table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Table.h; path = darwinup/Table.h; sourceTree = ""; }; - DFCAA39C1178E05B008DCF37 /* darwinup.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; name = darwinup.1; path = darwinup/darwinup.1; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 1FA2A9E422E62BF600F53888 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1FA2A9F222E62C1900F53888 /* SwiftCLI in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1FB1351122E522B5005E9A88 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1F7D730D22E52DFD003F8A67 /* SwiftCLI in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1FCA51B122E6562800D55269 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1FCA51BF22E6563C00D55269 /* SwiftCLI in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 396301221EAB4E01006081C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 720BE2ED120C90A700B3C4A5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -977,9 +983,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 725749B610976AFE00B13BC3 /* libsqlite3.dylib in Frameworks */, - 72574A1010977F7A00B13BC3 /* CoreFoundation.framework in Frameworks */, - 72574A1510977FAD00B13BC3 /* libtcl.dylib in Frameworks */, + 1F8B4BA824EB74DC00CC07E5 /* CoreFoundation.framework in Frameworks */, + 1F7298EB24D75A200006E19E /* libsqlite3.tbd in Frameworks */, + 1FF3C41A24EAF989002A5356 /* libtcl8.6.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -990,14 +996,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 72C86C461096609500C66E90 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 72C86CE410974CC800C66E90 /* libsqlite3.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 72C86C50109660CA00C66E90 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1015,18 +1013,74 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1F7298E924D759FF0006E19E /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1F8B4BA724EB74DC00CC07E5 /* CoreFoundation.framework */, + 1F7298EA24D759FF0006E19E /* libsqlite3.tbd */, + ); + name = Frameworks; + sourceTree = ""; + }; + 1FA2A9E822E62BF600F53888 /* darwinbuild-recursive */ = { + isa = PBXGroup; + children = ( + 1FA2A9E922E62BF600F53888 /* main.swift */, + ); + path = "darwinbuild-recursive"; + sourceTree = ""; + }; + 1FB1351522E522B5005E9A88 /* swift */ = { + isa = PBXGroup; + children = ( + 1FCA51B522E6562800D55269 /* fetch-from-github */, + 1FA2A9E822E62BF600F53888 /* darwinbuild-recursive */, + 1FB1351C22E522EA005E9A88 /* darwinbuild-codesign */, + 1FF4AFCB22E5237B002F09C6 /* Utilities.swift */, + ); + path = swift; + sourceTree = ""; + }; + 1FB1351C22E522EA005E9A88 /* darwinbuild-codesign */ = { + isa = PBXGroup; + children = ( + 1FB1351622E522B5005E9A88 /* main.swift */, + ); + path = "darwinbuild-codesign"; + sourceTree = ""; + }; + 1FCA51B522E6562800D55269 /* fetch-from-github */ = { + isa = PBXGroup; + children = ( + 1FCA51B622E6562800D55269 /* main.swift */, + ); + path = "fetch-from-github"; + sourceTree = ""; + }; + 1FD9F0CE21B9E90C00FB866A /* installer */ = { + isa = PBXGroup; + children = ( + 1F4A793721B9F123000FE4B5 /* conclusion.html */, + 1F4A793821B9F123000FE4B5 /* license.html */, + 1F4A793921B9F123000FE4B5 /* welcome.html */, + 1FD9F0CD21B9E90700FB866A /* build.sh */, + 1FEA10392264FBCF008B675D /* notarize.sh */, + 1FD9F0CF21B9EAA300FB866A /* distribution.xml */, + ); + name = installer; + sourceTree = ""; + }; 726DD14710965C5700D5AEAB = { isa = PBXGroup; children = ( DF6BE2FE132C5EBD00793781 /* testing */, 72C86BD810965DDF00C66E90 /* darwintrace */, - 72C86BD710965DD800C66E90 /* darwinup */, 72C86BD610965DD000C66E90 /* darwinxref */, 72C86BD510965DC900C66E90 /* darwinbuild */, + 1FD9F0CE21B9E90C00FB866A /* installer */, + 1FB1351522E522B5005E9A88 /* swift */, + 1F7298E924D759FF0006E19E /* Frameworks */, 72C86C391096607900C66E90 /* Products */, - 72C86CE310974CC800C66E90 /* libsqlite3.dylib */, - 72574A0F10977F7A00B13BC3 /* CoreFoundation.framework */, - 72574A1410977FAD00B13BC3 /* libtcl.dylib */, 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */, ); sourceTree = ""; @@ -1034,26 +1088,19 @@ 72C86BD510965DC900C66E90 /* darwinbuild */ = { isa = PBXGroup; children = ( + 1FDAA0F425281B7500B92892 /* PDSDKSettings.plist */, 720BE2E9120C909E00B3C4A5 /* digest.c */, 7227AB871098A7BF00BE33D7 /* buildlist */, 7227AB881098A7BF00BE33D7 /* buildorder */, - 7227AB891098A7BF00BE33D7 /* ditto */, 7227AB8A1098A7BF00BE33D7 /* packageRoots.in */, 7227AB8B1098A7BF00BE33D7 /* synthfat */, 7227AB8C1098A7BF00BE33D7 /* thinFile */, 7227AB8D1098A7BF00BE33D7 /* thinPackages.in */, - 72C86C221096600B00C66E90 /* createChroot */, 72C86C231096600B00C66E90 /* darwinbuild.common */, 7227AC0A1098D7CE00BE33D7 /* darwinmaster.in */, 72C86C241096600B00C66E90 /* darwinbuild.in */, - 72C86C271096600B00C66E90 /* Info.plist */, - 72C86C281096600B00C66E90 /* installXcode.in */, - 72C86C291096600B00C66E90 /* installXcode2 */, - 72C86C2A1096600B00C66E90 /* installXcode3 */, - 72C86C2B1096600B00C66E90 /* installXcode31 */, - 72C86C2C1096600B00C66E90 /* installXcode32.in */, + 1FECB5DE1FBBBC09002EA059 /* setXcodePlatform */, 72C86C2E1096600B00C66E90 /* manifest.c */, - 72C86C311096600B00C66E90 /* SDKSettings.plist */, ); name = darwinbuild; sourceTree = ""; @@ -1071,39 +1118,13 @@ 72C86BEE10965E7500C66E90 /* DBPluginPriv.h */, 72C86BEF10965E7500C66E90 /* DBTclPlugin.c */, 72C86BF010965E7500C66E90 /* main.c */, + 1FDE256A24D75B4900CBC605 /* vendor-tcl.sh */, + 1FDE55BD24DB9DBD009ED847 /* libtcl8.6.dylib */, + 1F9D9647226516AA0024E830 /* darwinxref.entitlements */, ); name = darwinxref; sourceTree = ""; }; - 72C86BD710965DD800C66E90 /* darwinup */ = { - isa = PBXGroup; - children = ( - DFCAA39C1178E05B008DCF37 /* darwinup.1 */, - DFC9772711138F9400CAE084 /* Column.cpp */, - DFC9772811138F9400CAE084 /* Column.h */, - DFC9772911138F9400CAE084 /* Database.cpp */, - DFC9772A11138F9400CAE084 /* Database.h */, - DFC9772B11138F9400CAE084 /* Table.cpp */, - DFC9772C11138F9400CAE084 /* Table.h */, - 72C86BDA10965E4F00C66E90 /* Archive.cpp */, - 72C86BDB10965E4F00C66E90 /* Archive.h */, - 72C86BDC10965E4F00C66E90 /* Depot.cpp */, - 72C86BDD10965E4F00C66E90 /* Depot.h */, - 72C86BDE10965E4F00C66E90 /* Digest.cpp */, - 72C86BDF10965E4F00C66E90 /* Digest.h */, - 72C86BE010965E4F00C66E90 /* File.cpp */, - 72C86BE110965E4F00C66E90 /* File.h */, - 72C86BE210965E4F00C66E90 /* main.cpp */, - 72C86BE410965E4F00C66E90 /* SerialSet.cpp */, - 72C86BE510965E4F00C66E90 /* SerialSet.h */, - 72C86BE610965E4F00C66E90 /* Utils.cpp */, - 72C86BE710965E4F00C66E90 /* Utils.h */, - DF12E2801119E2B0007587C1 /* DB.h */, - DF12E2811119E2B0007587C1 /* DB.cpp */, - ); - name = darwinup; - sourceTree = ""; - }; 72C86BD810965DDF00C66E90 /* darwintrace */ = { isa = PBXGroup; children = ( @@ -1115,9 +1136,9 @@ 72C86BF210965EEA00C66E90 /* plugins */ = { isa = PBXGroup; children = ( + 396301281EAB5DB5006081C7 /* patch_sites.tcl */, 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */, 72C86BF310965EEA00C66E90 /* binary_sites.tcl */, - 72C86BF410965EEA00C66E90 /* branch.tcl */, 72C86BF510965EEA00C66E90 /* configuration.c */, 72C86BF610965EEA00C66E90 /* currentBuild.tcl */, 72C86BF710965EEA00C66E90 /* darwin.tcl */, @@ -1143,6 +1164,7 @@ 72C86C0B10965EEA00C66E90 /* plist_sites.c */, 72D05CA911D2678F00B33EDD /* query.c */, 72C86C0C10965EEA00C66E90 /* register.c */, + 396301191EAB42B6006081C7 /* patch_sites.c */, 72C86C0D10965EEA00C66E90 /* resolveDeps.c */, 72C86C0E10965EEA00C66E90 /* source_sites.c */, 72C86C0F10965EEA00C66E90 /* target.c */, @@ -1156,7 +1178,6 @@ isa = PBXGroup; children = ( 72C86C381096607900C66E90 /* darwinbuild */, - 72C86C481096609500C66E90 /* darwinup */, 72C86C52109660CA00C66E90 /* darwintrace.dylib */, 725749A01097697300B13BC3 /* darwinxref */, 72574B591097A36300B13BC3 /* configuration.so */, @@ -1186,10 +1207,12 @@ 7227AC061098D78C00BE33D7 /* darwinmaster */, 7227AC131098D84600BE33D7 /* packageRoots */, 7227AC1C1098D8DB00BE33D7 /* thinPackages */, - 7227AC251098DB9200BE33D7 /* installXcode */, - 7227AC2E1098DBDF00BE33D7 /* installXcode32 */, 72D05CB711D267C400B33EDD /* query.so */, 720BE2F2120C90A700B3C4A5 /* digest */, + 396301271EAB4E01006081C7 /* patch_sites.so */, + 1FB1351422E522B5005E9A88 /* sign-root */, + 1FA2A9E722E62BF600F53888 /* darwinbuild-recursive */, + 1FCA51B422E6562800D55269 /* fetch-from-github */, ); name = Products; sourceTree = ""; @@ -1198,7 +1221,6 @@ isa = PBXGroup; children = ( DF6BE2FF132C5EBD00793781 /* darwintrace */, - DF6BE305132C5EBD00793781 /* darwinup */, DF6BE31F132C5EBD00793781 /* run-all-tests.sh */, ); path = testing; @@ -1216,38 +1238,6 @@ path = darwintrace; sourceTree = ""; }; - DF6BE305132C5EBD00793781 /* darwinup */ = { - isa = PBXGroup; - children = ( - DF6BE306132C5EBD00793781 /* 300dirs.tbz2 */, - DF6BE307132C5EBD00793781 /* 300files.tbz2 */, - DF6BE308132C5EBD00793781 /* corrupt.tgz */, - DF6BE309132C5EBD00793781 /* deep-rollback-2.xar */, - DF6BE30A132C5EBD00793781 /* deep-rollback.cpgz */, - DF6BE30B132C5EBD00793781 /* depotroot.tar.gz */, - DF6BE30C132C5EBD00793781 /* dest.tar.gz */, - DF6BE30D132C5EBD00793781 /* extension.tar.bz2 */, - DF6BE30E132C5EBD00793781 /* rep_dir_file.tar.gz */, - DF6BE30F132C5EBD00793781 /* rep_dir_link.tar.gz */, - DF6BE310132C5EBD00793781 /* rep_file_dir.tar.gz */, - DF6BE311132C5EBD00793781 /* rep_file_link.tar.gz */, - DF6BE312132C5EBD00793781 /* rep_flink_dir.tar.gz */, - DF6BE313132C5EBD00793781 /* rep_flink_file.tar.gz */, - DF6BE314132C5EBD00793781 /* rep_link_dir.tar.gz */, - DF6BE315132C5EBD00793781 /* rep_link_file.tar.gz */, - DF6BE316132C5EBD00793781 /* root.tar.gz */, - DF6BE317132C5EBD00793781 /* root2.tar.gz */, - DF6BE318132C5EBD00793781 /* root3.tar.gz */, - DF6BE319132C5EBD00793781 /* root5.tar.gz */, - DF6BE31A132C5EBD00793781 /* root6.tar.gz */, - DF6BE31B132C5EBD00793781 /* root7.tar.gz */, - DF6BE31C132C5EBD00793781 /* run-tests.sh */, - DF6BE31D132C5EBD00793781 /* symlink_update.tar.gz */, - DF6BE31E132C5EBD00793781 /* symlinks.tar.gz */, - ); - path = darwinup; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1270,6 +1260,80 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 1FA2A9E622E62BF600F53888 /* darwinbuild-recursive */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1FA2A9EE22E62BF600F53888 /* Build configuration list for PBXNativeTarget "darwinbuild-recursive" */; + buildPhases = ( + 1FA2A9E322E62BF600F53888 /* Sources */, + 1FA2A9E422E62BF600F53888 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "darwinbuild-recursive"; + packageProductDependencies = ( + 1FA2A9F122E62C1900F53888 /* SwiftCLI */, + ); + productName = "darwinbuild-recursive"; + productReference = 1FA2A9E722E62BF600F53888 /* darwinbuild-recursive */; + productType = "com.apple.product-type.tool"; + }; + 1FB1351322E522B5005E9A88 /* sign-root */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1FB1351B22E522B5005E9A88 /* Build configuration list for PBXNativeTarget "sign-root" */; + buildPhases = ( + 1FB1351022E522B5005E9A88 /* Sources */, + 1FB1351122E522B5005E9A88 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "sign-root"; + packageProductDependencies = ( + 1F7D730C22E52DFD003F8A67 /* SwiftCLI */, + ); + productName = "darwinbuild-codesign"; + productReference = 1FB1351422E522B5005E9A88 /* sign-root */; + productType = "com.apple.product-type.tool"; + }; + 1FCA51B322E6562800D55269 /* fetch-from-github */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1FCA51B822E6562800D55269 /* Build configuration list for PBXNativeTarget "fetch-from-github" */; + buildPhases = ( + 1FCA51B022E6562800D55269 /* Sources */, + 1FCA51B122E6562800D55269 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "fetch-from-github"; + packageProductDependencies = ( + 1FCA51BE22E6563C00D55269 /* SwiftCLI */, + ); + productName = "fetch-from-github"; + productReference = 1FCA51B422E6562800D55269 /* fetch-from-github */; + productType = "com.apple.product-type.tool"; + }; + 3963011C1EAB4E01006081C7 /* patch_sites */ = { + isa = PBXNativeTarget; + buildConfigurationList = 396301231EAB4E01006081C7 /* Build configuration list for PBXNativeTarget "patch_sites" */; + buildPhases = ( + 3963011F1EAB4E01006081C7 /* Sources */, + 396301221EAB4E01006081C7 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 3963011D1EAB4E01006081C7 /* PBXTargetDependency */, + ); + name = patch_sites; + productName = configuration; + productReference = 396301271EAB4E01006081C7 /* patch_sites.so */; + productType = "com.apple.product-type.objfile"; + }; 720BE2EA120C90A700B3C4A5 /* digest */ = { isa = PBXNativeTarget; buildConfigurationList = 720BE2EE120C90A700B3C4A5 /* Build configuration list for PBXNativeTarget "digest" */; @@ -1308,6 +1372,7 @@ buildPhases = ( 7227AC001098D78C00BE33D7 /* ShellScript */, 7227AC011098D78C00BE33D7 /* ShellScript */, + 1F71A4FE2030F7A700020E2F /* ShellScript */, ); buildRules = ( ); @@ -1324,6 +1389,7 @@ buildPhases = ( 7227AC0D1098D84600BE33D7 /* ShellScript */, 7227AC0E1098D84600BE33D7 /* ShellScript */, + 1F71A4FF2030F81C00020E2F /* ShellScript */, ); buildRules = ( ); @@ -1340,6 +1406,7 @@ buildPhases = ( 7227AC161098D8DB00BE33D7 /* ShellScript */, 7227AC171098D8DB00BE33D7 /* ShellScript */, + 1F71A5002030F83D00020E2F /* ShellScript */, ); buildRules = ( ); @@ -1350,38 +1417,6 @@ productReference = 7227AC1C1098D8DB00BE33D7 /* thinPackages */; productType = "com.apple.product-type.tool"; }; - 7227AC1E1098DB9200BE33D7 /* installXcode */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7227AC211098DB9200BE33D7 /* Build configuration list for PBXNativeTarget "installXcode" */; - buildPhases = ( - 7227AC1F1098DB9200BE33D7 /* ShellScript */, - 7227AC201098DB9200BE33D7 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = installXcode; - productName = darwinbuild; - productReference = 7227AC251098DB9200BE33D7 /* installXcode */; - productType = "com.apple.product-type.tool"; - }; - 7227AC271098DBDF00BE33D7 /* installXcode32 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7227AC2A1098DBDF00BE33D7 /* Build configuration list for PBXNativeTarget "installXcode32" */; - buildPhases = ( - 7227AC281098DBDF00BE33D7 /* ShellScript */, - 7227AC291098DBDF00BE33D7 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = installXcode32; - productName = darwinbuild; - productReference = 7227AC2E1098DBDF00BE33D7 /* installXcode32 */; - productType = "com.apple.product-type.tool"; - }; 72573F771097A488008AD4D7 /* dependencies */ = { isa = PBXNativeTarget; buildConfigurationList = 72573F7B1097A488008AD4D7 /* Build configuration list for PBXNativeTarget "dependencies" */; @@ -1760,9 +1795,11 @@ isa = PBXNativeTarget; buildConfigurationList = 725749A61097699B00B13BC3 /* Build configuration list for PBXNativeTarget "darwinxref" */; buildPhases = ( + 1FDE256B24D75BFD00CBC605 /* Vendor Tcl */, 7257499D1097697300B13BC3 /* Sources */, 7257499E1097697300B13BC3 /* Frameworks */, 7227AB69109899DE00BE33D7 /* Headers */, + 1FDE55BF24DB9DD1009ED847 /* Copy libtcl8.6.dylib */, ); buildRules = ( ); @@ -1794,8 +1831,10 @@ isa = PBXNativeTarget; buildConfigurationList = 72C86C3D1096607A00C66E90 /* Build configuration list for PBXNativeTarget "darwinbuild" */; buildPhases = ( - 7227AB8F1098A89700BE33D7 /* ShellScript */, - 7227ABE61098D5E400BE33D7 /* ShellScript */, + 7227AB8F1098A89700BE33D7 /* Run Script */, + 7227ABE61098D5E400BE33D7 /* Run Script */, + 1F06C5B52023EB1D003EBE6C /* ShellScript */, + 1FDAA0F325281B5D00B92892 /* CopyFiles */, ); buildRules = ( ); @@ -1806,23 +1845,6 @@ productReference = 72C86C381096607900C66E90 /* darwinbuild */; productType = "com.apple.product-type.tool"; }; - 72C86C471096609500C66E90 /* darwinup */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72C86C4D109660B300C66E90 /* Build configuration list for PBXNativeTarget "darwinup" */; - buildPhases = ( - 72C86C451096609500C66E90 /* Sources */, - 72C86C461096609500C66E90 /* Frameworks */, - DFCAA3C51178E10E008DCF37 /* Install Manpage */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = darwinup; - productName = darwinup; - productReference = 72C86C481096609500C66E90 /* darwinup */; - productType = "com.apple.product-type.tool"; - }; 72C86C51109660CA00C66E90 /* darwintrace */ = { isa = PBXNativeTarget; buildConfigurationList = 72C86C55109660E900C66E90 /* Build configuration list for PBXNativeTarget "darwintrace" */; @@ -1863,20 +1885,36 @@ 726DD14910965C5700D5AEAB /* Project object */ = { isa = PBXProject; attributes = { - BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 1100; + LastUpgradeCheck = 1220; ORGANIZATIONNAME = "The DarwinBuild Project"; + TargetAttributes = { + 1FA2A9E622E62BF600F53888 = { + CreatedOnToolsVersion = 11.0; + }; + 1FB1351322E522B5005E9A88 = { + CreatedOnToolsVersion = 11.0; + }; + 1FCA51B322E6562800D55269 = { + CreatedOnToolsVersion = 11.0; + }; + }; }; buildConfigurationList = 726DD14C10965C5700D5AEAB /* Build configuration list for PBXProject "darwinbuild" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + compatibilityVersion = "Xcode 11.0"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, - Japanese, - French, - German, + en, + ja, + fr, + de, + Base, ); mainGroup = 726DD14710965C5700D5AEAB; + packageReferences = ( + 1F7D730B22E52DFD003F8A67 /* XCRemoteSwiftPackageReference "SwiftCLI" */, + ); productRefGroup = 72C86C391096607900C66E90 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -1884,7 +1922,6 @@ 72C86C561096614C00C66E90 /* world */, 7227AC311098DC4E00BE33D7 /* darwinbuild_scripts */, 725740981097B051008AD4D7 /* darwinxref_plugins */, - 72C86C471096609500C66E90 /* darwinup */, 72C86C51109660CA00C66E90 /* darwintrace */, 7257499F1097697300B13BC3 /* darwinxref */, 72574B581097A36300B13BC3 /* configuration */, @@ -1917,15 +1954,103 @@ 7227ABFF1098D78C00BE33D7 /* darwinmaster */, 7227AC0C1098D84600BE33D7 /* packageRoots */, 7227AC151098D8DB00BE33D7 /* thinPackages */, - 7227AC1E1098DB9200BE33D7 /* installXcode */, - 7227AC271098DBDF00BE33D7 /* installXcode32 */, 720BE2EA120C90A700B3C4A5 /* digest */, + 3963011C1EAB4E01006081C7 /* patch_sites */, + 1FB1351322E522B5005E9A88 /* sign-root */, + 1FA2A9E622E62BF600F53888 /* darwinbuild-recursive */, + 1FCA51B322E6562800D55269 /* fetch-from-github */, ); }; /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ - 7227AB8F1098A89700BE33D7 /* ShellScript */ = { + 1F06C5B52023EB1D003EBE6C /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/darwinbuild", + ); + outputPaths = ( + "$(DSTROOT)/usr/local/bin/darwinbuild", + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "mkdir -p $DSTROOT/usr/local/bin\n/bin/cp $BUILT_PRODUCTS_DIR/darwinbuild $DSTROOT/usr/local/bin\n"; + showEnvVarsInLog = 0; + }; + 1F71A4FE2030F7A700020E2F /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/darwinmaster", + ); + outputPaths = ( + "$(DSTROOT)/usr/local/bin/darwinmaster", + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "mkdir -p $DSTROOT/usr/local/bin\n/bin/cp $BUILT_PRODUCTS_DIR/darwinmaster $DSTROOT/usr/local/bin/darwinmaster"; + showEnvVarsInLog = 0; + }; + 1F71A4FF2030F81C00020E2F /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/packageRoots", + ); + outputPaths = ( + "$(DSTROOT)/$(DATDIR)/darwinbuild/packageRoots", + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "mkdir -p $DSTROOT/$DATDIR/darwinbuild\n/bin/cp $BUILT_PRODUCTS_DIR/packageRoots $DSTROOT/$DATDIR/darwinbuild/packageRoots"; + showEnvVarsInLog = 0; + }; + 1F71A5002030F83D00020E2F /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/thinPackages", + ); + outputPaths = ( + "$(DSTROOT)/$(DATDIR)/darwinbuild/thinPackages", + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "mkdir -p $DSTROOT/$DATDIR/darwinbuild\n/bin/cp $BUILT_PRODUCTS_DIR/thinPackages $DSTROOT/$DATDIR/darwinbuild/thinPackages"; + showEnvVarsInLog = 0; + }; + 1FDE256B24D75BFD00CBC605 /* Vendor Tcl */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 12; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/darwinxref/vendor-tcl.sh", + ); + name = "Vendor Tcl"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(SRCROOT)/darwinxref/libtcl8.6.dylib", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec $SRCROOT/darwinxref/vendor-tcl.sh\n"; + showEnvVarsInLog = 0; + }; + 7227AB8F1098A89700BE33D7 /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -1933,6 +2058,7 @@ inputPaths = ( "$(SRCROOT)/darwinbuild/darwinbuild.in", ); + name = "Run Script"; outputPaths = ( "$(DERIVED_FILE_DIR)/darwinbuild", ); @@ -1940,7 +2066,7 @@ shellPath = /bin/sh; shellScript = "/usr/bin/sed -e \"s,%%PREFIX%%,$PREFIX,\" $SRCROOT/darwinbuild/darwinbuild.in > $DERIVED_FILE_DIR/darwinbuild\n\n/bin/chmod 755 $DERIVED_FILE_DIR/darwinbuild\n\n"; }; - 7227ABE61098D5E400BE33D7 /* ShellScript */ = { + 7227ABE61098D5E400BE33D7 /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -1948,12 +2074,13 @@ inputPaths = ( "$(DERIVED_FILE_DIR)/darwinbuild", ); + name = "Run Script"; outputPaths = ( "$(BUILT_PRODUCTS_DIR)/darwinbuild", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/cp $DERIVED_FILE_DIR/darwinbuild $BUILT_PRODUCTS_DIR/darwinbuild"; + shellScript = "/bin/cp $DERIVED_FILE_DIR/darwinbuild $BUILT_PRODUCTS_DIR/darwinbuild\n"; }; 7227AC001098D78C00BE33D7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2045,69 +2172,44 @@ shellPath = /bin/sh; shellScript = "/bin/cp $DERIVED_FILE_DIR/thinPackages $BUILT_PRODUCTS_DIR/thinPackages"; }; - 7227AC1F1098DB9200BE33D7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1FA2A9E322E62BF600F53888 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - "$(SRCROOT)/darwinbuild/installXcode.in", - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/installXcode", + 1FA2A9EF22E62BFE00F53888 /* Utilities.swift in Sources */, + 1FA2A9EA22E62BF600F53888 /* main.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/bin/sed -e \"s,%%PREFIX%%,$PREFIX,\" $SRCROOT/darwinbuild/installXcode.in > $DERIVED_FILE_DIR/installXcode\n\n/bin/chmod 755 $DERIVED_FILE_DIR/installXcode\n\n"; }; - 7227AC201098DB9200BE33D7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; + 1FB1351022E522B5005E9A88 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - "$(DERIVED_FILE_DIR)/installXcode", - ); - outputPaths = ( - "$(BUILT_PRODUCTS_DIR)/installXcode", + 1FF4AFCC22E5237B002F09C6 /* Utilities.swift in Sources */, + 1FB1351722E522B5005E9A88 /* main.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/cp $DERIVED_FILE_DIR/installXcode $BUILT_PRODUCTS_DIR/installXcode"; }; - 7227AC281098DBDF00BE33D7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; + 1FCA51B022E6562800D55269 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - "$(SRCROOT)/darwinbuild/installXcode32.in", - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/installXcode32", + 1FCA51BC22E6562F00D55269 /* Utilities.swift in Sources */, + 1FCA51B722E6562800D55269 /* main.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/bin/sed -e \"s,%%PREFIX%%,$PREFIX,\" $SRCROOT/darwinbuild/installXcode32.in > $DERIVED_FILE_DIR/installXcode32\n\n/bin/chmod 755 $DERIVED_FILE_DIR/installXcode32\n\n"; }; - 7227AC291098DBDF00BE33D7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; + 3963011F1EAB4E01006081C7 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - "$(DERIVED_FILE_DIR)/installXcode32", - ); - outputPaths = ( - "$(BUILT_PRODUCTS_DIR)/installXcode32", + 396301211EAB4E01006081C7 /* patch_sites.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/cp $DERIVED_FILE_DIR/installXcode32 $BUILT_PRODUCTS_DIR/installXcode32"; }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ 720BE2EB120C90A700B3C4A5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2280,7 +2382,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 725740931097B012008AD4D7 /* source_sites.c in Sources */, + 3963011A1EAB4D60006081C7 /* source_sites.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2320,24 +2422,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 72C86C451096609500C66E90 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72C86C99109745BC00C66E90 /* Archive.cpp in Sources */, - 72C86C9A109745BC00C66E90 /* Depot.cpp in Sources */, - 72C86C9B109745BC00C66E90 /* Digest.cpp in Sources */, - 72C86C9C109745BC00C66E90 /* File.cpp in Sources */, - 72C86C9D109745BC00C66E90 /* main.cpp in Sources */, - 72C86C9E109745BC00C66E90 /* SerialSet.cpp in Sources */, - 72C86C9F109745BC00C66E90 /* Utils.cpp in Sources */, - DFC9772D11138F9400CAE084 /* Column.cpp in Sources */, - DFC9772E11138F9400CAE084 /* Database.cpp in Sources */, - DFC9772F11138F9400CAE084 /* Table.cpp in Sources */, - DF12E2821119E2B0007587C1 /* DB.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 72C86C4F109660CA00C66E90 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2357,6 +2441,26 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 1FA9FAFD22E61D9D0096A78D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1FB1351322E522B5005E9A88 /* sign-root */; + targetProxy = 1FA9FAFC22E61D9D0096A78D /* PBXContainerItemProxy */; + }; + 1FCA51AF22E6551E00D55269 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1FA2A9E622E62BF600F53888 /* darwinbuild-recursive */; + targetProxy = 1FCA51AE22E6551E00D55269 /* PBXContainerItemProxy */; + }; + 1FF1E7E322E65BC9002B8CAA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1FCA51B322E6562800D55269 /* fetch-from-github */; + targetProxy = 1FF1E7E222E65BC9002B8CAA /* PBXContainerItemProxy */; + }; + 3963011D1EAB4E01006081C7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7257499F1097697300B13BC3 /* darwinxref */; + targetProxy = 3963011E1EAB4E01006081C7 /* PBXContainerItemProxy */; + }; 720BE2F6120C90E500B3C4A5 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 720BE2EA120C90A700B3C4A5 /* digest */; @@ -2372,16 +2476,6 @@ target = 7227AB3D1098977C00BE33D7 /* tcl_plugins */; targetProxy = 7227AB47109897E000BE33D7 /* PBXContainerItemProxy */; }; - 7227AC361098DC6A00BE33D7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 7227AC271098DBDF00BE33D7 /* installXcode32 */; - targetProxy = 7227AC351098DC6A00BE33D7 /* PBXContainerItemProxy */; - }; - 7227AC381098DC6A00BE33D7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 7227AC1E1098DB9200BE33D7 /* installXcode */; - targetProxy = 7227AC371098DC6A00BE33D7 /* PBXContainerItemProxy */; - }; 7227AC3A1098DC6A00BE33D7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7227AC151098D8DB00BE33D7 /* thinPackages */; @@ -2647,11 +2741,6 @@ target = 72574B581097A36300B13BC3 /* configuration */; targetProxy = 725740CD1097B0AD008AD4D7 /* PBXContainerItemProxy */; }; - 72C86C5F1096617500C66E90 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72C86C471096609500C66E90 /* darwinup */; - targetProxy = 72C86C5E1096617500C66E90 /* PBXContainerItemProxy */; - }; 72C86C611096617500C66E90 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 72C86C51109660CA00C66E90 /* darwintrace */; @@ -2670,216 +2759,352 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 720BE2EF120C90A700B3C4A5 /* Debug */ = { + 1FA2A9EB22E62BF600F53888 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = digest; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_HARDENED_RUNTIME = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INSTALL_PATH = /usr/local/share/darwinbuild; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; - 720BE2F0120C90A700B3C4A5 /* Public */ = { + 1FA2A9ED22E62BF600F53888 /* Release */ = { 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; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INSTALL_PATH = /usr/local/share/darwinbuild; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; }; name = Release; }; - 7227AB3E1098977D00BE33D7 /* Debug */ = { + 1FB1351822E522B5005E9A88 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - PRODUCT_NAME = tcl_plugins; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_HARDENED_RUNTIME = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INSTALL_PATH = "$(DATDIR)/darwinbuild"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; - 7227AB3F1098977D00BE33D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - PRODUCT_NAME = tcl_plugins; - }; - name = Public; - }; - 7227AB401098977D00BE33D7 /* Release */ = { + 1FB1351A22E522B5005E9A88 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - PRODUCT_NAME = tcl_plugins; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INSTALL_PATH = "$(DATDIR)/darwinbuild"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; }; name = Release; }; - 7227AB6F10989A9A00BE33D7 /* Debug */ = { + 1FCA51B922E6562800D55269 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = manifest; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_HARDENED_RUNTIME = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INSTALL_PATH = /usr/local/share/darwinbuild; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; - 7227AB7010989A9A00BE33D7 /* Public */ = { + 1FCA51BB22E6562800D55269 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = manifest; - }; - name = Public; - }; - 7227AB7110989A9A00BE33D7 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = manifest; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INSTALL_PATH = /usr/local/share/darwinbuild; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; }; name = Release; }; - 7227AC031098D78C00BE33D7 /* Debug */ = { + 396301241EAB4E01006081C7 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; + baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { - INSTALL_PATH = "$(BINDIR)"; - PRODUCT_NAME = darwinmaster; + CLANG_ENABLE_OBJC_WEAK = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; - 7227AC041098D78C00BE33D7 /* Public */ = { + 396301261EAB4E01006081C7 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - INSTALL_PATH = "$(BINDIR)"; - PRODUCT_NAME = darwinmaster; - }; - name = Public; - }; - 7227AC051098D78C00BE33D7 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; + baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { - INSTALL_PATH = "$(BINDIR)"; - PRODUCT_NAME = darwinmaster; + CLANG_ENABLE_OBJC_WEAK = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; - 7227AC101098D84600BE33D7 /* Debug */ = { + 720BE2EF120C90A700B3C4A5 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_STYLE = Manual; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = packageRoots; + PRODUCT_NAME = digest; + PROVISIONING_PROFILE_SPECIFIER = ""; }; name = Debug; }; - 7227AC111098D84600BE33D7 /* Public */ = { + 720BE2F1120C90A700B3C4A5 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_STYLE = Manual; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = packageRoots; + PRODUCT_NAME = digest; + PROVISIONING_PROFILE_SPECIFIER = ""; }; - name = Public; + name = Release; }; - 7227AC121098D84600BE33D7 /* Release */ = { + 7227AB3E1098977D00BE33D7 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = packageRoots; + CLANG_ENABLE_OBJC_WEAK = YES; + PRODUCT_NAME = tcl_plugins; }; - name = Release; + name = Debug; }; - 7227AC191098D8DB00BE33D7 /* Debug */ = { + 7227AB401098977D00BE33D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = thinPackages; + CLANG_ENABLE_OBJC_WEAK = YES; + PRODUCT_NAME = tcl_plugins; }; - name = Debug; + name = Release; }; - 7227AC1A1098D8DB00BE33D7 /* Public */ = { + 7227AB6F10989A9A00BE33D7 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_STYLE = Manual; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = thinPackages; + PRODUCT_NAME = manifest; + PROVISIONING_PROFILE_SPECIFIER = ""; }; - name = Public; + name = Debug; }; - 7227AC1B1098D8DB00BE33D7 /* Release */ = { + 7227AB7110989A9A00BE33D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_STYLE = Manual; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = thinPackages; + PRODUCT_NAME = manifest; + PROVISIONING_PROFILE_SPECIFIER = ""; }; name = Release; }; - 7227AC221098DB9200BE33D7 /* Debug */ = { + 7227AC031098D78C00BE33D7 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = installXcode; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; + INSTALL_PATH = "$(BINDIR)"; + PRODUCT_NAME = darwinmaster; }; name = Debug; }; - 7227AC231098DB9200BE33D7 /* Public */ = { + 7227AC051098D78C00BE33D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = installXcode; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; + INSTALL_PATH = "$(BINDIR)"; + PRODUCT_NAME = darwinmaster; }; - name = Public; + name = Release; }; - 7227AC241098DB9200BE33D7 /* Release */ = { + 7227AC101098D84600BE33D7 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = installXcode; + PRODUCT_NAME = packageRoots; }; - name = Release; + name = Debug; }; - 7227AC2B1098DBDF00BE33D7 /* Debug */ = { + 7227AC121098D84600BE33D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = installXcode32; + PRODUCT_NAME = packageRoots; }; - name = Debug; + name = Release; }; - 7227AC2C1098DBDF00BE33D7 /* Public */ = { + 7227AC191098D8DB00BE33D7 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = installXcode32; + PRODUCT_NAME = thinPackages; }; - name = Public; + name = Debug; }; - 7227AC2D1098DBDF00BE33D7 /* Release */ = { + 7227AC1B1098D8DB00BE33D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; INSTALL_PATH = "$(DATDIR)/darwinbuild"; - PRODUCT_NAME = installXcode32; + PRODUCT_NAME = thinPackages; }; name = Release; }; @@ -2887,22 +3112,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; PRODUCT_NAME = darwinbuild_scripts; }; name = Debug; }; - 7227AC331098DC4F00BE33D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - PRODUCT_NAME = darwinbuild_scripts; - }; - name = Public; - }; 7227AC341098DC4F00BE33D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; PRODUCT_NAME = darwinbuild_scripts; }; name = Release; @@ -2911,20 +3130,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72573F7D1097A488008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72573F7E1097A488008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -2932,20 +3146,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72573FD01097A4B7008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72573FD11097A4B7008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -2953,20 +3162,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72573FD91097A538008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72573FDA1097A538008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -2974,20 +3178,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72573FE21097A5A2008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72573FE31097A5A2008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -2995,20 +3194,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72573FEB1097A5BA008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72573FEC1097A5BA008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3016,20 +3210,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72573FF41097A5D8008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72573FF51097A5D8008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3037,20 +3226,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740031097A6CC008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740041097A6CC008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3058,20 +3242,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740111097AA25008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740121097AA25008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3079,20 +3258,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 7257401A1097AA5F008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 7257401B1097AA5F008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3100,20 +3274,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740221097AA6E008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740231097AA6E008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3121,20 +3290,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 7257402A1097AA79008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 7257402B1097AA79008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3142,20 +3306,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740341097AA95008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740351097AA95008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3163,20 +3322,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 7257403C1097AAA6008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 7257403D1097AAA6008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3184,20 +3338,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740441097AABA008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740451097AABA008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3205,20 +3354,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 7257404C1097ABDC008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 7257404D1097ABDC008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3226,20 +3370,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740541097AEC1008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740551097AEC1008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3247,20 +3386,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 7257405C1097AECC008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 7257405D1097AECC008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3268,20 +3402,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740641097AEDE008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740651097AEDE008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3289,20 +3418,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 7257406C1097AEF0008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 7257406D1097AEF0008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3310,20 +3434,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740741097AEFE008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740751097AEFE008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3331,20 +3450,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 7257407C1097AF0A008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 7257407D1097AF0A008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3352,20 +3466,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 725740841097AF30008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 725740851097AF30008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3373,149 +3482,71 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; PRODUCT_NAME = darwinxref_plugins; }; name = Debug; }; - 7257409A1097B051008AD4D7 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - PRODUCT_NAME = darwinxref_plugins; - }; - name = Public; - }; 7257409B1097B051008AD4D7 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; PRODUCT_NAME = darwinxref_plugins; }; name = Release; }; - 725749861097633500B13BC3 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_MODEL_TUNING = ""; - GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_MISSING_PARENTHESES = YES; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; - GCC_WARN_PROTOTYPE_CONVERSION = NO; - GCC_WARN_SIGN_COMPARE = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNKNOWN_PRAGMAS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_VALUE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - LD_OPENMP_FLAGS = ""; - STRIP_INSTALLED_PRODUCT = NO; - STRIP_STYLE = "non-global"; - WARNING_CFLAGS = "-Wall"; - }; - name = Public; - }; - 725749871097633500B13BC3 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - PRODUCT_NAME = world; - }; - name = Public; - }; - 725749881097633500B13BC3 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - INSTALL_PATH = "$(BINDIR)"; - PRODUCT_NAME = darwinbuild; - }; - name = Public; - }; - 7257498A1097633500B13BC3 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEPLOYMENT_POSTPROCESSING = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - INSTALL_PATH = "$(BINDIR)"; - PRODUCT_NAME = darwinup; - STRIP_INSTALLED_PRODUCT = YES; - STRIP_STYLE = all; - }; - name = Public; - }; - 7257498B1097633500B13BC3 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - INSTALL_PATH = "$(DATDIR)/darwinbuild"; - "INSTALL_PATH[sdk=iphonesimulator*]" = "$(SDKROOT)$(DATDIR)/darwinbuild"; - LD_DYLIB_INSTALL_NAME = "$(DATDIR)/darwinbuild/darwintrace.dylib"; - PRODUCT_NAME = darwintrace; - }; - name = Public; - }; 725749A21097697300B13BC3 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = darwinxref/darwinxref.entitlements; + CODE_SIGN_STYLE = Manual; GCC_SYMBOLS_PRIVATE_EXTERN = NO; INSTALL_PATH = "$(BINDIR)"; - OTHER_CFLAGS = ( - "-DHAVE_TCL_PLUGINS=1", - "-DDEFAULT_PLUGIN_PATH=\\\"$(DATDIR)/darwinxref/plugins\\\"", - "-DDEFAULT_DB_FILE=\\\".build/xref.db\\\"", + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../share/darwinxref"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/darwinxref", ); - PRODUCT_NAME = darwinxref; - PUBLIC_HEADERS_FOLDER_PATH = "$(INCDIR)/darwinbuild"; - }; - name = Debug; - }; - 725749A31097697300B13BC3 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - INSTALL_PATH = "$(BINDIR)"; + MACOSX_DEPLOYMENT_TARGET = 10.15; OTHER_CFLAGS = ( "-DHAVE_TCL_PLUGINS=1", "-DDEFAULT_PLUGIN_PATH=\\\"$(DATDIR)/darwinxref/plugins\\\"", "-DDEFAULT_DB_FILE=\\\".build/xref.db\\\"", ); PRODUCT_NAME = darwinxref; + PROVISIONING_PROFILE_SPECIFIER = ""; PUBLIC_HEADERS_FOLDER_PATH = "$(INCDIR)/darwinbuild"; + SYSTEM_HEADER_SEARCH_PATHS = "/usr/local/opt/tcl-tk/include"; }; - name = Public; + name = Debug; }; 725749A41097697300B13BC3 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = darwinxref/darwinxref.entitlements; + CODE_SIGN_STYLE = Manual; GCC_SYMBOLS_PRIVATE_EXTERN = NO; INSTALL_PATH = "$(BINDIR)"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../share/darwinxref"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/darwinxref", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; OTHER_CFLAGS = ( "-DHAVE_TCL_PLUGINS=1", "-DDEFAULT_PLUGIN_PATH=\\\"$(DATDIR)/darwinxref/plugins\\\"", "-DDEFAULT_DB_FILE=\\\".build/xref.db\\\"", ); PRODUCT_NAME = darwinxref; + PROVISIONING_PROFILE_SPECIFIER = ""; PUBLIC_HEADERS_FOLDER_PATH = "$(INCDIR)/darwinbuild"; + SYSTEM_HEADER_SEARCH_PATHS = "/usr/local/opt/tcl-tk/include"; }; name = Release; }; @@ -3523,20 +3554,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72574B5B1097A36400B13BC3 /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72574B5C1097A36400B13BC3 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; @@ -3544,11 +3570,39 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = x86_64; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = 3P242C9ES5; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_MODEL_TUNING = ""; + GCC_NO_COMMON_BLOCKS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -3564,12 +3618,15 @@ GCC_WARN_SIGN_COMPARE = NO; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; LD_OPENMP_FLAGS = ""; + MACOSX_DEPLOYMENT_TARGET = 10.15; + ONLY_ACTIVE_ARCH = YES; STRIP_INSTALLED_PRODUCT = NO; STRIP_STYLE = "non-global"; WARNING_CFLAGS = "-Wall"; @@ -3580,11 +3637,38 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = x86_64; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = 3P242C9ES5; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_MODEL_TUNING = ""; + GCC_NO_COMMON_BLOCKS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -3600,14 +3684,17 @@ GCC_WARN_SIGN_COMPARE = NO; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; LD_OPENMP_FLAGS = ""; + MACOSX_DEPLOYMENT_TARGET = 10.15; STRIP_INSTALLED_PRODUCT = NO; STRIP_STYLE = "non-global"; + SWIFT_COMPILATION_MODE = wholemodule; WARNING_CFLAGS = "-Wall"; }; name = Release; @@ -3616,6 +3703,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; INSTALL_PATH = "$(BINDIR)"; PRODUCT_NAME = darwinbuild; }; @@ -3625,44 +3714,24 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; INSTALL_PATH = "$(BINDIR)"; PRODUCT_NAME = darwinbuild; }; name = Release; }; - 72C86C4A1096609500C66E90 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - INSTALL_PATH = "$(BINDIR)"; - PRODUCT_NAME = darwinup; - }; - name = Debug; - }; - 72C86C4B1096609500C66E90 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEPLOYMENT_POSTPROCESSING = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - INSTALL_PATH = "$(BINDIR)"; - PREFIX = /usr; - PRODUCT_NAME = darwinup; - STRIP_INSTALLED_PRODUCT = YES; - STRIP_STYLE = all; - }; - name = Release; - }; 72C86C53109660CB00C66E90 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_STYLE = Manual; INSTALL_PATH = "$(DATDIR)/darwinbuild"; "INSTALL_PATH[sdk=iphonesimulator*]" = "$(SDKROOT)$(DATDIR)/darwinbuild"; LD_DYLIB_INSTALL_NAME = "$(DATDIR)/darwinbuild/darwintrace.dylib"; PRODUCT_NAME = darwintrace; + PROVISIONING_PROFILE_SPECIFIER = ""; }; name = Debug; }; @@ -3670,10 +3739,13 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_STYLE = Manual; INSTALL_PATH = "$(DATDIR)/darwinbuild"; "INSTALL_PATH[sdk=iphonesimulator*]" = "$(SDKROOT)$(DATDIR)/darwinbuild"; LD_DYLIB_INSTALL_NAME = "$(DATDIR)/darwinbuild/darwintrace.dylib"; PRODUCT_NAME = darwintrace; + PROVISIONING_PROFILE_SPECIFIER = ""; }; name = Release; }; @@ -3681,6 +3753,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; PRODUCT_NAME = world; }; name = Debug; @@ -3689,6 +3762,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7227AB9C1098AAE100BE33D7 /* prefix.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; PRODUCT_NAME = world; }; name = Release; @@ -3697,427 +3771,420 @@ isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Debug; }; - 72D05CB511D267C400B33EDD /* Public */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; - buildSettings = { - }; - name = Public; - }; 72D05CB611D267C400B33EDD /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 1FA2A9EE22E62BF600F53888 /* Build configuration list for PBXNativeTarget "darwinbuild-recursive" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1FA2A9EB22E62BF600F53888 /* Debug */, + 1FA2A9ED22E62BF600F53888 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1FB1351B22E522B5005E9A88 /* Build configuration list for PBXNativeTarget "sign-root" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1FB1351822E522B5005E9A88 /* Debug */, + 1FB1351A22E522B5005E9A88 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1FCA51B822E6562800D55269 /* Build configuration list for PBXNativeTarget "fetch-from-github" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1FCA51B922E6562800D55269 /* Debug */, + 1FCA51BB22E6562800D55269 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 396301231EAB4E01006081C7 /* Build configuration list for PBXNativeTarget "patch_sites" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 396301241EAB4E01006081C7 /* Debug */, + 396301261EAB4E01006081C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 720BE2EE120C90A700B3C4A5 /* Build configuration list for PBXNativeTarget "digest" */ = { isa = XCConfigurationList; buildConfigurations = ( 720BE2EF120C90A700B3C4A5 /* Debug */, - 720BE2F0120C90A700B3C4A5 /* Public */, 720BE2F1120C90A700B3C4A5 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7227AB4A109897E500BE33D7 /* Build configuration list for PBXAggregateTarget "tcl_plugins" */ = { isa = XCConfigurationList; buildConfigurations = ( 7227AB3E1098977D00BE33D7 /* Debug */, - 7227AB3F1098977D00BE33D7 /* Public */, 7227AB401098977D00BE33D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7227AB7310989ACD00BE33D7 /* Build configuration list for PBXNativeTarget "manifest" */ = { isa = XCConfigurationList; buildConfigurations = ( 7227AB6F10989A9A00BE33D7 /* Debug */, - 7227AB7010989A9A00BE33D7 /* Public */, 7227AB7110989A9A00BE33D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7227AC021098D78C00BE33D7 /* Build configuration list for PBXNativeTarget "darwinmaster" */ = { isa = XCConfigurationList; buildConfigurations = ( 7227AC031098D78C00BE33D7 /* Debug */, - 7227AC041098D78C00BE33D7 /* Public */, 7227AC051098D78C00BE33D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7227AC0F1098D84600BE33D7 /* Build configuration list for PBXNativeTarget "packageRoots" */ = { isa = XCConfigurationList; buildConfigurations = ( 7227AC101098D84600BE33D7 /* Debug */, - 7227AC111098D84600BE33D7 /* Public */, 7227AC121098D84600BE33D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7227AC181098D8DB00BE33D7 /* Build configuration list for PBXNativeTarget "thinPackages" */ = { isa = XCConfigurationList; buildConfigurations = ( 7227AC191098D8DB00BE33D7 /* Debug */, - 7227AC1A1098D8DB00BE33D7 /* Public */, 7227AC1B1098D8DB00BE33D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; - }; - 7227AC211098DB9200BE33D7 /* Build configuration list for PBXNativeTarget "installXcode" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7227AC221098DB9200BE33D7 /* Debug */, - 7227AC231098DB9200BE33D7 /* Public */, - 7227AC241098DB9200BE33D7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; - }; - 7227AC2A1098DBDF00BE33D7 /* Build configuration list for PBXNativeTarget "installXcode32" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7227AC2B1098DBDF00BE33D7 /* Debug */, - 7227AC2C1098DBDF00BE33D7 /* Public */, - 7227AC2D1098DBDF00BE33D7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7227AC451098DC9900BE33D7 /* Build configuration list for PBXAggregateTarget "darwinbuild_scripts" */ = { isa = XCConfigurationList; buildConfigurations = ( 7227AC321098DC4F00BE33D7 /* Debug */, - 7227AC331098DC4F00BE33D7 /* Public */, 7227AC341098DC4F00BE33D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72573F7B1097A488008AD4D7 /* Build configuration list for PBXNativeTarget "dependencies" */ = { isa = XCConfigurationList; buildConfigurations = ( 72573F7C1097A488008AD4D7 /* Debug */, - 72573F7D1097A488008AD4D7 /* Public */, 72573F7E1097A488008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72573FCE1097A4B7008AD4D7 /* Build configuration list for PBXNativeTarget "dot" */ = { isa = XCConfigurationList; buildConfigurations = ( 72573FCF1097A4B7008AD4D7 /* Debug */, - 72573FD01097A4B7008AD4D7 /* Public */, 72573FD11097A4B7008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72573FD71097A538008AD4D7 /* Build configuration list for PBXNativeTarget "diff" */ = { isa = XCConfigurationList; buildConfigurations = ( 72573FD81097A538008AD4D7 /* Debug */, - 72573FD91097A538008AD4D7 /* Public */, 72573FDA1097A538008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72573FE01097A5A2008AD4D7 /* Build configuration list for PBXNativeTarget "edit" */ = { isa = XCConfigurationList; buildConfigurations = ( 72573FE11097A5A2008AD4D7 /* Debug */, - 72573FE21097A5A2008AD4D7 /* Public */, 72573FE31097A5A2008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72573FE91097A5BA008AD4D7 /* Build configuration list for PBXNativeTarget "environment" */ = { isa = XCConfigurationList; buildConfigurations = ( 72573FEA1097A5BA008AD4D7 /* Debug */, - 72573FEB1097A5BA008AD4D7 /* Public */, 72573FEC1097A5BA008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72573FF21097A5D8008AD4D7 /* Build configuration list for PBXNativeTarget "exportFiles" */ = { isa = XCConfigurationList; buildConfigurations = ( 72573FF31097A5D8008AD4D7 /* Debug */, - 72573FF41097A5D8008AD4D7 /* Public */, 72573FF51097A5D8008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740011097A6CC008AD4D7 /* Build configuration list for PBXNativeTarget "exportIndex" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740021097A6CC008AD4D7 /* Debug */, - 725740031097A6CC008AD4D7 /* Public */, 725740041097A6CC008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7257400F1097AA25008AD4D7 /* Build configuration list for PBXNativeTarget "exportProject" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740101097AA25008AD4D7 /* Debug */, - 725740111097AA25008AD4D7 /* Public */, 725740121097AA25008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740181097AA5F008AD4D7 /* Build configuration list for PBXNativeTarget "findFile" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740191097AA5F008AD4D7 /* Debug */, - 7257401A1097AA5F008AD4D7 /* Public */, 7257401B1097AA5F008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740201097AA6E008AD4D7 /* Build configuration list for PBXNativeTarget "inherits" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740211097AA6E008AD4D7 /* Debug */, - 725740221097AA6E008AD4D7 /* Public */, 725740231097AA6E008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740281097AA79008AD4D7 /* Build configuration list for PBXNativeTarget "loadDeps" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740291097AA79008AD4D7 /* Debug */, - 7257402A1097AA79008AD4D7 /* Public */, 7257402B1097AA79008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740321097AA95008AD4D7 /* Build configuration list for PBXNativeTarget "loadFiles" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740331097AA95008AD4D7 /* Debug */, - 725740341097AA95008AD4D7 /* Public */, 725740351097AA95008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7257403A1097AAA6008AD4D7 /* Build configuration list for PBXNativeTarget "loadIndex" */ = { isa = XCConfigurationList; buildConfigurations = ( 7257403B1097AAA6008AD4D7 /* Debug */, - 7257403C1097AAA6008AD4D7 /* Public */, 7257403D1097AAA6008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740421097AABA008AD4D7 /* Build configuration list for PBXNativeTarget "mergeBuild" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740431097AABA008AD4D7 /* Debug */, - 725740441097AABA008AD4D7 /* Public */, 725740451097AABA008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7257404A1097ABDC008AD4D7 /* Build configuration list for PBXNativeTarget "original" */ = { isa = XCConfigurationList; buildConfigurations = ( 7257404B1097ABDC008AD4D7 /* Debug */, - 7257404C1097ABDC008AD4D7 /* Public */, 7257404D1097ABDC008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740521097AEC1008AD4D7 /* Build configuration list for PBXNativeTarget "patchfiles" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740531097AEC1008AD4D7 /* Debug */, - 725740541097AEC1008AD4D7 /* Public */, 725740551097AEC1008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7257405A1097AECC008AD4D7 /* Build configuration list for PBXNativeTarget "plist_sites" */ = { isa = XCConfigurationList; buildConfigurations = ( 7257405B1097AECC008AD4D7 /* Debug */, - 7257405C1097AECC008AD4D7 /* Public */, 7257405D1097AECC008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740621097AEDE008AD4D7 /* Build configuration list for PBXNativeTarget "register" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740631097AEDE008AD4D7 /* Debug */, - 725740641097AEDE008AD4D7 /* Public */, 725740651097AEDE008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7257406A1097AEF0008AD4D7 /* Build configuration list for PBXNativeTarget "resolveDeps" */ = { isa = XCConfigurationList; buildConfigurations = ( 7257406B1097AEF0008AD4D7 /* Debug */, - 7257406C1097AEF0008AD4D7 /* Public */, 7257406D1097AEF0008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740721097AEFE008AD4D7 /* Build configuration list for PBXNativeTarget "source_sites" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740731097AEFE008AD4D7 /* Debug */, - 725740741097AEFE008AD4D7 /* Public */, 725740751097AEFE008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 7257407A1097AF0A008AD4D7 /* Build configuration list for PBXNativeTarget "target" */ = { isa = XCConfigurationList; buildConfigurations = ( 7257407B1097AF0A008AD4D7 /* Debug */, - 7257407C1097AF0A008AD4D7 /* Public */, 7257407D1097AF0A008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740821097AF30008AD4D7 /* Build configuration list for PBXNativeTarget "version" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740831097AF30008AD4D7 /* Debug */, - 725740841097AF30008AD4D7 /* Public */, 725740851097AF30008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725740A01097B08A008AD4D7 /* Build configuration list for PBXAggregateTarget "darwinxref_plugins" */ = { isa = XCConfigurationList; buildConfigurations = ( 725740991097B051008AD4D7 /* Debug */, - 7257409A1097B051008AD4D7 /* Public */, 7257409B1097B051008AD4D7 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 725749A61097699B00B13BC3 /* Build configuration list for PBXNativeTarget "darwinxref" */ = { isa = XCConfigurationList; buildConfigurations = ( 725749A21097697300B13BC3 /* Debug */, - 725749A31097697300B13BC3 /* Public */, 725749A41097697300B13BC3 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72574B641097A38F00B13BC3 /* Build configuration list for PBXNativeTarget "configuration" */ = { isa = XCConfigurationList; buildConfigurations = ( 72574B5A1097A36400B13BC3 /* Debug */, - 72574B5B1097A36400B13BC3 /* Public */, 72574B5C1097A36400B13BC3 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 726DD14C10965C5700D5AEAB /* Build configuration list for PBXProject "darwinbuild" */ = { isa = XCConfigurationList; buildConfigurations = ( 726DD14A10965C5700D5AEAB /* Debug */, - 725749861097633500B13BC3 /* Public */, 726DD14B10965C5700D5AEAB /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72C86C3D1096607A00C66E90 /* Build configuration list for PBXNativeTarget "darwinbuild" */ = { isa = XCConfigurationList; buildConfigurations = ( 72C86C3B1096607A00C66E90 /* Debug */, - 725749881097633500B13BC3 /* Public */, 72C86C3C1096607A00C66E90 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; - }; - 72C86C4D109660B300C66E90 /* Build configuration list for PBXNativeTarget "darwinup" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72C86C4A1096609500C66E90 /* Debug */, - 7257498A1097633500B13BC3 /* Public */, - 72C86C4B1096609500C66E90 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72C86C55109660E900C66E90 /* Build configuration list for PBXNativeTarget "darwintrace" */ = { isa = XCConfigurationList; buildConfigurations = ( 72C86C53109660CB00C66E90 /* Debug */, - 7257498B1097633500B13BC3 /* Public */, 72C86C54109660CB00C66E90 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72C86C591096616A00C66E90 /* Build configuration list for PBXAggregateTarget "world" */ = { isa = XCConfigurationList; buildConfigurations = ( 72C86C571096614C00C66E90 /* Debug */, - 725749871097633500B13BC3 /* Public */, 72C86C581096614C00C66E90 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; 72D05CB311D267C400B33EDD /* Build configuration list for PBXNativeTarget "query" */ = { isa = XCConfigurationList; buildConfigurations = ( 72D05CB411D267C400B33EDD /* Debug */, - 72D05CB511D267C400B33EDD /* Public */, 72D05CB611D267C400B33EDD /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Public; + defaultConfigurationName = Debug; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 1F7D730B22E52DFD003F8A67 /* XCRemoteSwiftPackageReference "SwiftCLI" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/jakeheis/SwiftCLI"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.3.2; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 1F7D730C22E52DFD003F8A67 /* SwiftCLI */ = { + isa = XCSwiftPackageProductDependency; + package = 1F7D730B22E52DFD003F8A67 /* XCRemoteSwiftPackageReference "SwiftCLI" */; + productName = SwiftCLI; + }; + 1FA2A9F122E62C1900F53888 /* SwiftCLI */ = { + isa = XCSwiftPackageProductDependency; + package = 1F7D730B22E52DFD003F8A67 /* XCRemoteSwiftPackageReference "SwiftCLI" */; + productName = SwiftCLI; + }; + 1FCA51BE22E6563C00D55269 /* SwiftCLI */ = { + isa = XCSwiftPackageProductDependency; + package = 1F7D730B22E52DFD003F8A67 /* XCRemoteSwiftPackageReference "SwiftCLI" */; + productName = SwiftCLI; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 726DD14910965C5700D5AEAB /* Project object */; } diff --git a/darwinbuild.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/darwinbuild.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/darwinbuild.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/darwinbuild.xcodeproj/project.xcworkspace/xcuserdata/insane.xcuserdatad/UserInterfaceState.xcuserstate b/darwinbuild.xcodeproj/project.xcworkspace/xcuserdata/insane.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..4d84831 Binary files /dev/null and b/darwinbuild.xcodeproj/project.xcworkspace/xcuserdata/insane.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/darwinbuild.xcodeproj/xcshareddata/xcschemes/darwinbuild-codesign.xcscheme b/darwinbuild.xcodeproj/xcshareddata/xcschemes/darwinbuild-codesign.xcscheme new file mode 100644 index 0000000..26779f9 --- /dev/null +++ b/darwinbuild.xcodeproj/xcshareddata/xcschemes/darwinbuild-codesign.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcshareddata/xcschemes/darwinbuild-recursive.xcscheme b/darwinbuild.xcodeproj/xcshareddata/xcschemes/darwinbuild-recursive.xcscheme new file mode 100644 index 0000000..2deec36 --- /dev/null +++ b/darwinbuild.xcodeproj/xcshareddata/xcschemes/darwinbuild-recursive.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcshareddata/xcschemes/world.xcscheme b/darwinbuild.xcodeproj/xcshareddata/xcschemes/world.xcscheme new file mode 100644 index 0000000..f7e3d41 --- /dev/null +++ b/darwinbuild.xcodeproj/xcshareddata/xcschemes/world.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/configuration.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/configuration.xcscheme new file mode 100644 index 0000000..0be9cc1 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/configuration.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinbuild.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinbuild.xcscheme new file mode 100644 index 0000000..b61c38c --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinbuild.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinbuild_scripts.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinbuild_scripts.xcscheme new file mode 100644 index 0000000..6eda752 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinbuild_scripts.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinmaster.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinmaster.xcscheme new file mode 100644 index 0000000..82fa429 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinmaster.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwintrace.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwintrace.xcscheme new file mode 100644 index 0000000..0512430 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwintrace.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinup.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinup.xcscheme new file mode 100644 index 0000000..7f5fd43 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinup.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinxref.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinxref.xcscheme new file mode 100644 index 0000000..e923c54 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinxref.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinxref_plugins.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinxref_plugins.xcscheme new file mode 100644 index 0000000..45092c5 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/darwinxref_plugins.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/dependencies.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/dependencies.xcscheme new file mode 100644 index 0000000..8c56963 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/dependencies.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/diff.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/diff.xcscheme new file mode 100644 index 0000000..bc898cc --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/diff.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/digest.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/digest.xcscheme new file mode 100644 index 0000000..dd01be4 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/digest.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/dot.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/dot.xcscheme new file mode 100644 index 0000000..0a05736 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/dot.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/edit.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/edit.xcscheme new file mode 100644 index 0000000..a81426d --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/edit.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/environment.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/environment.xcscheme new file mode 100644 index 0000000..e21dfb1 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/environment.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportFiles.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportFiles.xcscheme new file mode 100644 index 0000000..cde1f67 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportFiles.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportIndex.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportIndex.xcscheme new file mode 100644 index 0000000..4597720 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportIndex.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportProject.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportProject.xcscheme new file mode 100644 index 0000000..bd83e40 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/exportProject.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/findFile.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/findFile.xcscheme new file mode 100644 index 0000000..66f6d03 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/findFile.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/inherits.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/inherits.xcscheme new file mode 100644 index 0000000..f3dfdb5 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/inherits.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/installXcode.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/installXcode.xcscheme new file mode 100644 index 0000000..3061dd9 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/installXcode.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/installXcode32.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/installXcode32.xcscheme new file mode 100644 index 0000000..87f8a46 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/installXcode32.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadDeps.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadDeps.xcscheme new file mode 100644 index 0000000..67b1b27 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadDeps.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadFiles.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadFiles.xcscheme new file mode 100644 index 0000000..75e1c69 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadFiles.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadIndex.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadIndex.xcscheme new file mode 100644 index 0000000..ff2fb92 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/loadIndex.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/manifest.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/manifest.xcscheme new file mode 100644 index 0000000..2b91ea9 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/manifest.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/mergeBuild.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/mergeBuild.xcscheme new file mode 100644 index 0000000..39f8936 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/mergeBuild.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/original.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/original.xcscheme new file mode 100644 index 0000000..dd1ce14 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/original.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/packageRoots.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/packageRoots.xcscheme new file mode 100644 index 0000000..305c531 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/packageRoots.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/patchfiles.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/patchfiles.xcscheme new file mode 100644 index 0000000..a270ba5 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/patchfiles.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/plist_sites.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/plist_sites.xcscheme new file mode 100644 index 0000000..1d742c4 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/plist_sites.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/query.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/query.xcscheme new file mode 100644 index 0000000..de82e0a --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/query.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/register.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/register.xcscheme new file mode 100644 index 0000000..4de3f0e --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/register.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/resolveDeps.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/resolveDeps.xcscheme new file mode 100644 index 0000000..78464d2 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/resolveDeps.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/source_sites.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/source_sites.xcscheme new file mode 100644 index 0000000..9394a32 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/source_sites.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/target.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/target.xcscheme new file mode 100644 index 0000000..a7847da --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/target.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/tcl_plugins.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/tcl_plugins.xcscheme new file mode 100644 index 0000000..6cb0fc0 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/tcl_plugins.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/thinPackages.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/thinPackages.xcscheme new file mode 100644 index 0000000..99d1477 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/thinPackages.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/version.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/version.xcscheme new file mode 100644 index 0000000..336ae5f --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/version.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/world.xcscheme b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/world.xcscheme new file mode 100644 index 0000000..0b0d334 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/world.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/xcschememanagement.plist b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..075f3f8 --- /dev/null +++ b/darwinbuild.xcodeproj/xcuserdata/insane.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,412 @@ + + + + + SchemeUserState + + configuration.xcscheme + + orderHint + 6 + + darwinbuild.xcscheme + + orderHint + 31 + + darwinbuild_scripts.xcscheme + + orderHint + 1 + + darwinmaster.xcscheme + + orderHint + 33 + + darwintrace.xcscheme + + orderHint + 4 + + darwinup.xcscheme + + orderHint + 3 + + darwinxref.xcscheme + + orderHint + 5 + + darwinxref_plugins.xcscheme + + orderHint + 2 + + dependencies.xcscheme + + orderHint + 7 + + diff.xcscheme + + orderHint + 8 + + digest.xcscheme + + orderHint + 38 + + dot.xcscheme + + orderHint + 9 + + edit.xcscheme + + orderHint + 10 + + environment.xcscheme + + orderHint + 11 + + exportFiles.xcscheme + + orderHint + 12 + + exportIndex.xcscheme + + orderHint + 13 + + exportProject.xcscheme + + orderHint + 14 + + findFile.xcscheme + + orderHint + 15 + + inherits.xcscheme + + orderHint + 16 + + installXcode.xcscheme + + orderHint + 36 + + installXcode32.xcscheme + + orderHint + 37 + + loadDeps.xcscheme + + orderHint + 17 + + loadFiles.xcscheme + + orderHint + 18 + + loadIndex.xcscheme + + orderHint + 19 + + manifest.xcscheme + + orderHint + 32 + + mergeBuild.xcscheme + + orderHint + 20 + + original.xcscheme + + orderHint + 21 + + packageRoots.xcscheme + + orderHint + 34 + + patchfiles.xcscheme + + orderHint + 22 + + plist_sites.xcscheme + + orderHint + 23 + + query.xcscheme + + orderHint + 24 + + register.xcscheme + + orderHint + 25 + + resolveDeps.xcscheme + + orderHint + 26 + + source_sites copy.xcscheme + + orderHint + 39 + + source_sites.xcscheme + + orderHint + 27 + + target.xcscheme + + orderHint + 28 + + tcl_plugins.xcscheme + + orderHint + 30 + + thinPackages.xcscheme + + orderHint + 35 + + version.xcscheme + + orderHint + 29 + + world.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 3963011C1EAB4E01006081C7 + + primary + + + 720BE2EA120C90A700B3C4A5 + + primary + + + 7227AB3D1098977C00BE33D7 + + primary + + + 7227AB6C10989A9900BE33D7 + + primary + + + 7227ABFF1098D78C00BE33D7 + + primary + + + 7227AC0C1098D84600BE33D7 + + primary + + + 7227AC151098D8DB00BE33D7 + + primary + + + 7227AC1E1098DB9200BE33D7 + + primary + + + 7227AC271098DBDF00BE33D7 + + primary + + + 7227AC311098DC4E00BE33D7 + + primary + + + 72573F771097A488008AD4D7 + + primary + + + 72573FCA1097A4B7008AD4D7 + + primary + + + 72573FD31097A538008AD4D7 + + primary + + + 72573FDC1097A5A2008AD4D7 + + primary + + + 72573FE51097A5BA008AD4D7 + + primary + + + 72573FEE1097A5D8008AD4D7 + + primary + + + 72573FFD1097A6CC008AD4D7 + + primary + + + 7257400B1097AA25008AD4D7 + + primary + + + 725740151097AA5F008AD4D7 + + primary + + + 7257401D1097AA6E008AD4D7 + + primary + + + 725740251097AA79008AD4D7 + + primary + + + 7257402F1097AA95008AD4D7 + + primary + + + 725740371097AAA6008AD4D7 + + primary + + + 7257403F1097AABA008AD4D7 + + primary + + + 725740471097ABDC008AD4D7 + + primary + + + 7257404F1097AEC1008AD4D7 + + primary + + + 725740571097AECC008AD4D7 + + primary + + + 7257405F1097AEDE008AD4D7 + + primary + + + 725740671097AEF0008AD4D7 + + primary + + + 7257406F1097AEFE008AD4D7 + + primary + + + 725740771097AF0A008AD4D7 + + primary + + + 7257407F1097AF30008AD4D7 + + primary + + + 725740981097B051008AD4D7 + + primary + + + 7257499F1097697300B13BC3 + + primary + + + 72574B581097A36300B13BC3 + + primary + + + 72C86C371096607900C66E90 + + primary + + + 72C86C471096609500C66E90 + + primary + + + 72C86C51109660CA00C66E90 + + primary + + + 72C86C561096614C00C66E90 + + primary + + + 72D05CAD11D267C400B33EDD + + primary + + + + + diff --git a/darwinbuild/Info.plist b/darwinbuild/Info.plist deleted file mode 100644 index 01b20c6..0000000 --- a/darwinbuild/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - org.macosforge.darwinbuild.platforms.%%PLATFORM%% - CFBundleName - %%PLATFORM%% SDKs - CFBundleShortVersionString - 1 - Description - %%PLATFORM%% - FamilyIdentifier - %%PLATFORM%% - FamilyName - %%PLATFORM%% - Identifier - org.macosforge.darwinbuild.platforms.%%PLATFORM%% - Name - %%PLATFORM%% - Type - Platform - Version - 1 - - diff --git a/darwinbuild/PDSDKSettings.plist b/darwinbuild/PDSDKSettings.plist new file mode 100644 index 0000000..a08a57f --- /dev/null +++ b/darwinbuild/PDSDKSettings.plist @@ -0,0 +1,276 @@ + + + + + CanonicalName + puredarwin1.0 + CustomProperties + + KERNEL_EXTENSION_HEADER_SEARCH_PATHS + $(KERNEL_FRAMEWORK)/PrivateHeaders $(KERNEL_FRAMEWORK_HEADERS) + + DebuggerOptions + + SupportsViewDebugging + YES + + DefaultDeploymentTarget + 11.0 + DefaultProperties + + AD_HOC_CODE_SIGNING_ALLOWED + YES + CODE_SIGNING_ALLOWED + YES + DEFAULT_COMPILER + com.apple.compilers.llvm.clang.1_0 + DEPLOYMENT_TARGET_SUGGESTED_VALUES + + 10.9 + 10.10 + 10.11 + 10.12 + 10.13 + 10.14 + 10.15 + 11.0 + + ENTITLEMENTS_DESTINATION + Signature + IOS_UNZIPPERED_TWIN_PREFIX_PATH + /System/iOSSupport + KASAN_DEFAULT_CFLAGS + -DKASAN=1 -fsanitize=address -mllvm -asan-globals-live-support -mllvm -asan-force-dynamic-shadow + MACOSX_DEPLOYMENT_TARGET + 11.0 + PLATFORM_NAME + macosx + TEST_FRAMEWORK_SEARCH_PATHS + $(inherited) $(PLATFORM_DIR)/Developer/$(TEST_FRAMEWORK_DEVELOPER_VARIANT_SUBPATH)Library/Frameworks + TEST_LIBRARY_SEARCH_PATHS + $(inherited) $(PLATFORM_DIR)/Developer/$(TEST_FRAMEWORK_DEVELOPER_VARIANT_SUBPATH)usr/lib + + DefaultVariant + macos + DisplayName + PureDarwin 11.0 + IsBaseSDK + YES + MaximumDeploymentTarget + 11.0.99 + MinimalDisplayName + 11.0 + PropertyConditionFallbackNames + + SupportedTargets + + iosmac + + Archs + + x86_64 + x86_64h + arm64 + arm64e + + BuildVersionPlatformID + 6 + DefaultDeploymentTarget + 14.0 + DeploymentTargetSettingName + IPHONEOS_DEPLOYMENT_TARGET + LLVMTargetTripleEnvironment + macabi + LLVMTargetTripleSys + ios + LLVMTargetTripleVendor + apple + MaximumDeploymentTarget + 14.2.99 + MinimumDeploymentTarget + 13.1 + ValidDeploymentTargets + + 13.1 + 13.2 + 13.3 + 13.3.1 + 13.4 + 13.5 + 14.0 + 14.1 + 14.2 + + + macosx + + Archs + + x86_64 + x86_64h + arm64 + arm64e + + BuildVersionPlatformID + 1 + DefaultDeploymentTarget + 11.0 + DeploymentTargetSettingName + MACOSX_DEPLOYMENT_TARGET + LLVMTargetTripleEnvironment + + LLVMTargetTripleSys + macosx + LLVMTargetTripleVendor + apple + MaximumDeploymentTarget + 11.0.99 + MinimumDeploymentTarget + 10.9 + PlatformFamilyName + macOS + ValidDeploymentTargets + + 10.9 + 10.10 + 10.11 + 10.12 + 10.13 + 10.14 + 10.15 + 11.0 + + + + Variants + + + BuildSettings + + CODE_SIGN_IDENTITY + $(CODE_SIGN_IDENTITY_$(_DEVELOPMENT_TEAM_IS_EMPTY)) + CODE_SIGN_IDENTITY_NO + Apple Development + CODE_SIGN_IDENTITY_YES + - + IPHONEOS_DEPLOYMENT_TARGET + 14.0 + LLVM_TARGET_TRIPLE_OS_VERSION + $(LLVM_TARGET_TRIPLE_OS_VERSION_$(_MACOSX_DEPLOYMENT_TARGET_IS_EMPTY)) + LLVM_TARGET_TRIPLE_OS_VERSION_NO + macos$(MACOSX_DEPLOYMENT_TARGET) + LLVM_TARGET_TRIPLE_OS_VERSION_YES + macos11.0 + LLVM_TARGET_TRIPLE_SUFFIX + + _BOOL_ + NO + _BOOL_NO + NO + _BOOL_YES + YES + _DEVELOPMENT_TEAM_IS_EMPTY + $(_BOOL_$(_IS_EMPTY_$(DEVELOPMENT_TEAM))) + _IS_EMPTY_ + YES + _MACOSX_DEPLOYMENT_TARGET_IS_EMPTY + $(_BOOL_$(_IS_EMPTY_$(MACOSX_DEPLOYMENT_TARGET))) + + Name + macos + + + BuildSettings + + CODE_SIGN_IDENTITY + Apple Development + ENABLE_HARDENED_RUNTIME + YES + IPHONEOS_DEPLOYMENT_TARGET + 14.0 + LIBRARY_SEARCH_PATHS + $(inherited) $(SDKROOT)$(IOS_UNZIPPERED_TWIN_PREFIX_PATH)/usr/lib $(TOOLCHAIN_DIR)/usr/lib/swift/maccatalyst + LLVM_TARGET_TRIPLE_OS_VERSION + $(LLVM_TARGET_TRIPLE_OS_VERSION_$(_IPHONEOS_DEPLOYMENT_TARGET_IS_EMPTY)) + LLVM_TARGET_TRIPLE_OS_VERSION_NO + ios$(IPHONEOS_DEPLOYMENT_TARGET) + LLVM_TARGET_TRIPLE_OS_VERSION_YES + ios14.0 + LLVM_TARGET_TRIPLE_SUFFIX + -macabi + RESOURCES_MINIMUM_DEPLOYMENT_TARGET + $(IPHONEOS_DEPLOYMENT_TARGET) + RESOURCES_PLATFORM_NAME + macosx + RESOURCES_UI_FRAMEWORK_FAMILY + uikit + SWIFT_DEPLOYMENT_TARGET + $(IPHONEOS_DEPLOYMENT_TARGET) + SWIFT_PLATFORM_TARGET_PREFIX + ios + SYSTEM_FRAMEWORK_SEARCH_PATHS + $(inherited) $(SDKROOT)$(IOS_UNZIPPERED_TWIN_PREFIX_PATH)/System/Library/Frameworks + SYSTEM_HEADER_SEARCH_PATHS + $(inherited) $(SDKROOT)$(IOS_UNZIPPERED_TWIN_PREFIX_PATH)/usr/include + TARGETED_DEVICE_FAMILY + 2 + _BOOL_ + NO + _BOOL_NO + NO + _BOOL_YES + YES + _IPHONEOS_DEPLOYMENT_TARGET_IS_EMPTY + $(_BOOL_$(_IS_EMPTY_$(IPHONEOS_DEPLOYMENT_TARGET))) + _IS_EMPTY_ + YES + + Name + iosmac + + + Version + 11.0 + VersionMap + + iOSMac_macOS + + 13.1 + 10.15 + 13.2 + 10.15.1 + 13.3 + 10.15.2 + 13.3.1 + 10.15.3 + 13.4 + 10.15.4 + 13.5 + 10.15.5 + 14.0 + 11.0 + 14.1 + 11.0 + 14.2 + 11.0 + + macOS_iOSMac + + 10.15 + 13.1 + 10.15.1 + 13.2 + 10.15.2 + 13.3 + 10.15.3 + 13.3.1 + 10.15.4 + 13.4 + 10.15.5 + 13.5 + 11.0 + 14.0 + + + + diff --git a/darwinbuild/SDKSettings.plist b/darwinbuild/SDKSettings.plist deleted file mode 100644 index 8f55117..0000000 --- a/darwinbuild/SDKSettings.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - CanonicalName - %%PLATFORM%% - DefaultProperties - - MACOSX_DEPLOYMENT_TARGET - 10.6 - PLATFORM_NAME - %%PLATFORM%% - - DisplayName - %%PLATFORM%% - MaximumDeploymentTarget - 10.6 - MinimalDisplayName - 10.6 - MinimumSupportedToolsVersion - 3.2 - Version - 10.6 - isBaseSDK - YES - - diff --git a/darwinbuild/buildlist b/darwinbuild/buildlist old mode 100755 new mode 100644 diff --git a/darwinbuild/buildorder b/darwinbuild/buildorder old mode 100755 new mode 100644 index 88d941e..87a0341 --- a/darwinbuild/buildorder +++ b/darwinbuild/buildorder @@ -32,9 +32,11 @@ my %BuiltProjectsHash = (); # has project built? my %Dependencies = (); my %InvertedDependencies = (); -my %DepExceptions = ( "passwordserver_sasl" => { "Kerberos" => 1}, - "IOKitUser" => { "configd" => 1 }, - "configd" => { "configd_plugins" => 1}); +my %DepExceptions = ( + "passwordserver_sasl" => { "Kerberos" => 1}, + "IOKitUser" => { "configd" => 1 }, + "configd" => { "configd_plugins" => 1} +); print "Considering projects: @UnbuiltProjects\n"; print "Compilers: @Compilers\n"; @@ -43,31 +45,31 @@ print "Generating dependency graph..."; foreach my $proj (@UnbuiltProjects) { my @deps = (); - my @xrefdeps = CommandAsList("darwinxref dependencies -lib $proj; " . - "darwinxref dependencies -staticlib $proj"); -# print "$proj depends on @xrefdeps\n"; + my @xrefdeps = CommandAsList( + "darwinxref dependencies -build $proj; " . + "darwinxref dependencies -header $proj" + ); foreach my $xdep (@xrefdeps) { - # don't depend on ourself, compilers, or projects - # not being built currently - if ($xdep eq $proj - || $CompilersHash{$xdep} - || !defined($UnbuiltProjectsHash{$xdep}) - || ( defined($DepExceptions{$proj}) && $DepExceptions{$proj}->{$xdep})) { - next; - } - push @deps, ($xdep); - if(defined($InvertedDependencies{$xdep})) { - push @{$InvertedDependencies{$xdep}}, ( $proj ); - } else { - $InvertedDependencies{$xdep} = [ $proj ]; - } + # don't depend on ourself, compilers, or projects + # not being built currently + next if ($xdep eq $proj + || $CompilersHash{$xdep} + || !defined($UnbuiltProjectsHash{$xdep}) + || ( defined($DepExceptions{$proj}) && $DepExceptions{$proj}->{$xdep})); + + push @deps, ($xdep); + if(defined($InvertedDependencies{$xdep})) { + push @{$InvertedDependencies{$xdep}}, ( $proj ); + } else { + $InvertedDependencies{$xdep} = [ $proj ]; + } } $Dependencies{$proj} = \@deps; # try to make sure there's even an empty list of # inverted deps (things that depend on me) if(!defined($InvertedDependencies{$proj})) { - $InvertedDependencies{$proj} = []; + $InvertedDependencies{$proj} = []; } } @@ -88,27 +90,27 @@ while ($#UnbuiltProjects > 0) { # got back to he beginning. Make sure we're making forward progress if($proj eq "SENTINEL") { - print "SENTINEL reached\n" if $loopdebug; - if($builtone) { - # great! - $builtone = 0; - goto Unmet; - } else { - print STDERR "Aborting, unmet dependency loop\n"; - print STDERR "Remaining projects: @UnbuiltProjects\n"; - exit(1); - } + print "SENTINEL reached\n" if $loopdebug; + if($builtone) { + # great! + $builtone = 0; + goto Unmet; + } else { + print STDERR "Aborting, unmet dependency loop\n"; + print STDERR "Remaining projects: @UnbuiltProjects\n"; + exit(1); + } } # See if all dependencies have been built my @deps = @{$Dependencies{$proj}}; print "$proj: " if $loopdebug; foreach my $dep (@deps) { - if(!defined($BuiltProjectsHash{$dep})) { - # dep hasn't built yet - print "$dep unbuilt\n" if $loopdebug; - goto Unmet; - } + if(!defined($BuiltProjectsHash{$dep})) { + # dep hasn't built yet + print "$dep unbuilt\n" if $loopdebug; + goto Unmet; + } } print "all deps built\n" if $loopdebug; diff --git a/darwinbuild/createChroot b/darwinbuild/createChroot deleted file mode 100755 index 7c3a5bd..0000000 --- a/darwinbuild/createChroot +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh - -FORCE="YES" - -XCODEBUILD=/usr/bin/xcodebuild -BUILDROOT="$1" - -EXTRADIR=( \ - /.vol \ - /cores \ - /dev \ - /private/tmp \ - /private/var \ - /private/var/tmp ) - -EXTRACOPY=( \ - /Developer/Makefiles \ - /Library/Application\ Support \ - /System/Library/Frameworks \ - /System/Library/PrivateFrameworks \ - /System/Library/DTDs \ - /System/Library/Fonts \ - /System/Library/Keyboard\ Layouts \ - /System/Library/Perl \ - /System/Library/Tcl \ - /System/Library/CoreServices/CharacterSets \ - /bin \ - /private/etc \ - /sbin \ - /usr/bin \ - /usr/include \ - /usr/lib \ - /usr/libexec \ - /usr/sbin \ - /usr/share ) - -EXTRALINKS=( \ - private/tmp \ - private/var \ - private/etc ) - -if [ -z "$BUILDROOT" ]; then - echo "Usage: $0 /Volumes/DarwinBuild/BuildRoot" 1>&2 - exit 1 -fi - -mkdir -p "$BUILDROOT" - -RemoveTemps() { - rm -f /tmp/installXcode.libs.$$ - rm -f /tmp/installXcode.seen.$$ - rm -f /tmp/installXcode.tmplibs.$$ - rm -f /tmp/installXcode.tmpfiles.$$ - rm -f /tmp/installXcode.files.$$ -} - -AppendExtraFiles() { - for X in "${EXTRACOPY[@]}"; do - echo "$X" >> /tmp/installXcode.libs.$$ - done -} - -GenerateFileNames() { - cat /tmp/installXcode.libs.$$ | sort -u | while read X; do - # echo adding children for "$X" - - # first mkdir parent directories - PARENT=$(dirname "$X") - while [ "$PARENT" != "/" -a "$PARENT" != "." ]; do - echo ".$PARENT" >> /tmp/installXcode.tmpfiles.$$ - PARENT=$(dirname "$PARENT") - done - find -x ".$X" \! \( -name \*_debug\* -o -name \*_profile\* -o -path \*.lproj\* -o -path \*.dict\* \) >> /tmp/installXcode.tmpfiles.$$ - done - sort -u /tmp/installXcode.tmpfiles.$$ > /tmp/installXcode.files.$$ -} - -CopyFiles() { -# VERBOSECPIO="v" - VERBOSECPIO="" - echo -n "Copying system ..." - cpio -o -c < /tmp/installXcode.files.$$ | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - echo "done" -} - - - -### -### Find all the framework and library dependencies of Xcode build -### For frameworks, copy over all supporting files. -### - -pushd / > /dev/null - -RemoveTemps -touch /tmp/installXcode.seen.$$ -echo Analyzing files to copy into chroot ... -AppendExtraFiles -GenerateFileNames -CopyFiles - -for X in "${EXTRADIR[@]}"; do - mkdir -p $BUILDROOT/$X -done - -for X in "${EXTRALINKS[@]}"; do - ln -sf $X $BUILDROOT/ -done - -# We provide this functionality, at least -mkdir -p $BUILDROOT/usr/local/darwinbuild/receipts -for i in "files" "bash"; do - touch $BUILDROOT/usr/local/darwinbuild/receipts/$i -done - -popd > /dev/null - -RemoveTemps diff --git a/darwinbuild/darwinbuild-create-tarball b/darwinbuild/darwinbuild-create-tarball new file mode 100755 index 0000000..5ed7a40 --- /dev/null +++ b/darwinbuild/darwinbuild-create-tarball @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2017 William Kent. All rights reserved. +# +# 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 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. +# + +import sys +import os +import subprocess +import tarfile + +if len(sys.argv) < 3: + print('usage:', sys.argv[0], '/path/to/output project-version', file=sys.stderr) + exit(1) + +def process_submodule(base_path): + module_files = subprocess.check_output(['git', 'ls-files'], universal_newlines=True, cwd=base_path).split('\n') + + gitmodules_path = os.path.join(base_path, '.gitmodules') if base_path is not None else '.gitmodules' + if not os.path.isfile(gitmodules_path): + return module_files + + submodules = [] + with open(gitmodules_path) as fh: + module_file_lines = fh.read().decode('utf-8').split('\n') + for line in module_file_lines: + line = line.strip() + if line.startswith('path = '): + submodules.append(line.replace('path = ', '')) + + for module_path in submodules: + sub_path = os.path.join(base_path, module_path) if base_path is not None else module_path + for subfile in process_submodule(sub_path): + module_files.append(os.path.join(module_path, subfile)) + + return module_files + +outdir = sys.argv[1] +project_and_version = sys.argv[2] + +all_files = [] +try: + all_files = process_submodule(None) +except subprocess.CalledProcessError as e: + print(e.cmd, 'exited with code', e.returncode, file=sys.stderr) + exit(1) + +tarball = tarfile.open(os.path.join(outdir, project_and_version + '.tar.gz'), 'w:gz') + +counter = 0 +for filename in all_files: + if filename == '': continue + + counter += 1 + if (counter % 1000) == 0: + print('Processed', counter, 'files...') + + tarball.add(filename, os.path.join(project_and_version, filename)) + +tarball.close() diff --git a/darwinbuild/darwinbuild.common b/darwinbuild/darwinbuild.common index f370723..9faf072 100644 --- a/darwinbuild/darwinbuild.common +++ b/darwinbuild/darwinbuild.common @@ -1,21 +1,21 @@ #!/bin/sh # # Copyright (c) 2005-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. +# 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. +# 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. -# +# 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 @@ -46,21 +46,17 @@ function CheckDarwinBuildRoot() { cd "$DARWIN_BUILDROOT" fi fi - if [ -d Roots -a \ - -d Sources -a \ - -d Symbols -a \ - -d Headers -a \ - -d Logs ]; then + if [ -d Roots -a -d Sources -a -d Symbols -a -d Headers -a -d Logs ]; then export DARWIN_BUILDROOT="$(pwd -P)" else cat 1>&2 <<- EOB - ERROR: please change your working directory to one initialized by: - darwinbuild -init - Alternatively, you may set the DARWIN_BUILDROOT environment variable to the - absolute path of that directory. + ERROR: please change your working directory to one initialized by: + darwinbuild -init + Alternatively, you may set the DARWIN_BUILDROOT environment variable to the + absolute path of that directory. - EOB - exit 1 + EOB + exit 1 fi } @@ -80,7 +76,7 @@ function GetBuildVersion() { build=$(echo $X | sed -e 's/^.*~\([0-9]*\)$/\1/') # If the regex fails, it somtimes prints the same line if [ "$build" != "$X" -a "$build" != "" ]; then - # [ seems to things on the left of the -a, + # [ seems to things on the left of the -a, # so do this in a different statement to avoid # errors about non-numeric values of $build if [ "$build" -gt "$maxbuild" ]; then @@ -91,42 +87,8 @@ function GetBuildVersion() { echo $maxbuild } -### -### Trap calls to ditto since it is only available on Mac OS X -### Warning: only supports the directory-to-directory form -function ditto() { - local srcdir="$1" - local dstdir="$2" - if [ -x /usr/bin/ditto ]; then - /usr/bin/ditto "$srcdir" "$dstdir" - else - tar c -C "$srcdir" . | tar xf - -C "$dstdir" - fi -} - CURLARGS=${CURLARGS:-} -### -### Checkout or update a project from subversion repository -### -function CheckoutOrUpdate() { - local destination="$1" - local branch="$2" - local master_sites="$3" - - for master_site in $master_sites ; - do - if [ ! -d "$destination/.svn" ]; then - echo "Checking out working copy" - mkdir -p "$destination" - svn co "$master_site/$branch" "$destination" && break - else - echo "Updating working copy" - svn up "$destination" && break - fi - done -} - ### ### Download a .tar.gz file ### @@ -141,7 +103,7 @@ function Download() { echo "Found $extracted in $destination" return fi - + ### ### Download the sources, ### @@ -153,18 +115,21 @@ function Download() { proj=$(echo "$filename" | sed -e 's,.tar.gz$,,' | sed -e 's,.root$,,') projnam=$(echo "$proj" | sed -e 's,-[0-9.]*$,,') srcdir=$(echo "$master_site/$projnam" | sed -e 's,^file://,,') - if [ -d "$srcdir/$proj" ]; then + if [ -f "$srcdir/$filename" ]; then + echo "Copying $srcdir/$filename ..." + cp "$srcdir/$filename" "$destination/.tmp.${filename}" + elif [ -d "$srcdir/$proj" ]; then echo "Copying $srcdir/$proj ..." tar czf \ - "$destination/.tmp.${filename}" \ - -C "$srcdir" \ - "$proj" + "$destination/.tmp.${filename}" \ + -C "$srcdir" \ + "$proj" elif [ -d "$srcdir" ]; then echo "Copying $srcdir ..." tar czf \ - "$destination/.tmp.${filename}" \ - -C "$srcdir" \ - . + "$destination/.tmp.${filename}" \ + -C "$srcdir" \ + . else echo "No such directory: $srcdir" break @@ -190,6 +155,54 @@ function Download() { done } +function _CopyRoot() { + local src="$1" + local dstroot="$2" + + OLD_IFS=$IFS + IFS=' +' + find $src '!' -type l > /tmp/root.$$.txt + while read line; do + line=$(echo $line | sed -Ee "s,$src/?,,g") + + if [ -L "$src/$line" ]; then + echo "Error: We should not see any symbolic links here" + exit 1 + else + if [ -d "$src/$line" ]; then + if [ -L $dstroot/$line ]; then + rm $dstroot/$line + fi + + mkdir -p $dstroot/$line + else + mkdir -p $(dirname $dstroot/$line) + rm -f $dstroot/$line + ditto $src/$line $dstroot/$line + fi + fi + done < /tmp/root.$$.txt + rm /tmp/root.$$.txt + + # Symbolic links must be processed last, so that their + # targets are all created beforehand. + find $src -type l > /tmp/root-links.$$.txt + while read line; do + line=$(echo $line | sed -Ee "s,$src/?,,g") + dirname=$(dirname $line) + basename=$(basename $line) + + pushd $dstroot/$dirname > /dev/null + rm -f $basename + ln -s "$(readlink $src/$line)" $basename + popd > /dev/null + done < /tmp/root-links.$$.txt + rm -f /tmp/root-links.$$.txt + + IFS=$OLD_IFS +} + ### ### Installs a root into the BuildRoot. Mediates between ### receipts, pre-built roots, and self-built roots, so that @@ -214,44 +227,45 @@ function InstallRoot() { ### has already been installed. (Test for the presence of a receipt). ### if [ -d "$DARWIN_BUILDROOT/Roots/$Project" ]; then - ProjectAndVersion=$($DARWINXREF $dbfile version "$Project") - bv=$(GetBuildVersion $DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root*) - if [ -n "$bv" ]; then - SelfBuiltRoot="$DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root~$bv" - fi + ProjectAndVersion=$($DARWINXREF $dbfile version "$Project") + bv=$(GetBuildVersion $DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root*) + if [ -n "$bv" ]; then + SelfBuiltRoot="$DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root~$bv" + fi fi CheckForReceipt "$BuildRoot" "$Project" "root" if [ $? -eq 0 ]; then - # receipt is present. But do we have a newer local build? - CheckIfNewerThanReceipt "$BuildRoot" "$Project" "root" "$SelfBuiltRoot" - if [ $? -eq 0 ]; then - # we're newer. Load us - InstallSelfBuiltRoot=1 - fi + # receipt is present. But do we have a newer local build? + CheckIfNewerThanReceipt "$BuildRoot" "$Project" "root" "$SelfBuiltRoot" + if [ $? -eq 0 ]; then + # we're newer. Load us + InstallSelfBuiltRoot=1 + fi else - # there wasn't a receipt. but if we have a self-built root, we should use it - if [ -n "$SelfBuiltRoot" ]; then - InstallSelfBuiltRoot=1 - else - InstallPreBuiltRoot=1 - fi + # there wasn't a receipt. but if we have a self-built root, we should use it + if [ -n "$SelfBuiltRoot" ]; then + InstallSelfBuiltRoot=1 + else + InstallPreBuiltRoot=1 + fi fi # install a self-built root, or a prebuilt root, or nothing if [ $InstallSelfBuiltRoot -eq 1 ]; then - echo "Copying $Project from $SelfBuiltRoot ..." - ditto "$SelfBuiltRoot" "$BuildRoot" - "$DARWINXREF" register "$Project" "$SelfBuiltRoot" > /dev/null - TouchReceipt "$BuildRoot" "$Project" "root" - return 0 + echo "Copying $Project from $SelfBuiltRoot ..." + _CopyRoot "$SelfBuiltRoot" "$BuildRoot/Developer/SDKs/PureDarwin.sdk" + + "$DARWINXREF" register "$Project" "$SelfBuiltRoot" > /dev/null + TouchReceipt "$BuildRoot" "$Project" "root" + return 0 elif [ $InstallPreBuiltRoot -eq 1 ]; then - # install a pre-built root, in inheritance order + # install a pre-built root, in inheritance order while [ "$dbuild" != "" ]; do - sites=$($DARWINXREF $dbfile -b $dbuild binary_sites "$Project") + sites=$($DARWINXREF $dbfile -b $dbuild binary_sites "$Project") Download "$CACHEDIR" \ "$Project.root.tar.gz" \ - "$sites" + "$sites" if [ -f "$CACHEDIR/$Project.root.tar.gz" ]; then cd "$BuildRoot" tar xzf "$CACHEDIR/$Project.root.tar.gz" @@ -261,8 +275,8 @@ function InstallRoot() { > /dev/null CheckForReceipt "$BuildRoot" "$Project" "root" if [ $? -ne 0 ]; then - echo -n | CreateReceipt "$BuildRoot" "$Project" "root" \ - "$CACHEDIR/$Project.root.tar.gz" + echo -n | CreateReceipt "$BuildRoot" "$Project" "root" \ + "$CACHEDIR/$Project.root.tar.gz" fi return 0 fi @@ -270,11 +284,11 @@ function InstallRoot() { dbuild=$($DARWINXREF $dbfile -b $dbuild inherits) fi - # if we didn't find the root for this build, keep looking in the next build - done - # we look through all inherited builds and couldn't actually install anything + # if we didn't find the root for this build, keep looking in the next build + done + # we look through all inherited builds and couldn't actually install anything echo "ERROR: could not find root: $Project" 1>&2 - exit 1 + exit 1 fi # we had a receipt, so no need to install @@ -308,34 +322,34 @@ function InstallHeader() { ### has already been installed. (Test for the presence of a receipt). ### if [ -d "$DARWIN_BUILDROOT/Roots/$Project" ]; then - ProjectAndVersion=$($DARWINXREF $dbfile version "$Project") - bv=$(GetBuildVersion $DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root*) - if [ -n "$bv" ]; then - SelfBuiltRoot="$DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root~$bv" - fi + ProjectAndVersion=$($DARWINXREF $dbfile version "$Project") + bv=$(GetBuildVersion $DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root*) + if [ -n "$bv" ]; then + SelfBuiltRoot="$DARWIN_BUILDROOT/Roots/$Project/$ProjectAndVersion.root~$bv" + fi fi if [ -d "$DARWIN_BUILDROOT/Headers/$Project" ]; then - ProjectAndVersion=$($DARWINXREF $dbfile version "$Project") - bv=$(GetBuildVersion $DARWIN_BUILDROOT/Headers/$Project/$ProjectAndVersion.hdrs*) - if [ -n "$bv" ]; then - SelfBuiltHeader="$DARWIN_BUILDROOT/Headers/$Project/$ProjectAndVersion.hdrs~$bv" - fi + ProjectAndVersion=$($DARWINXREF $dbfile version "$Project") + bv=$(GetBuildVersion $DARWIN_BUILDROOT/Headers/$Project/$ProjectAndVersion.hdrs*) + if [ -n "$bv" ]; then + SelfBuiltHeader="$DARWIN_BUILDROOT/Headers/$Project/$ProjectAndVersion.hdrs~$bv" + fi fi # Install self-built headers only if they're newer than anything # else that's been installed (Headers and Roots) if [ -n "$SelfBuiltHeader" ]; then - CheckIfNewerThanReceipt "$BuildRoot" "$Project" "hdrs" "$SelfBuiltHeader" - if [ $? -eq 0 ]; then + CheckIfNewerThanReceipt "$BuildRoot" "$Project" "hdrs" "$SelfBuiltHeader" + if [ $? -eq 0 ]; then CheckIfNewerThanReceipt "$BuildRoot" "$Project" "root" "$SelfBuiltHeader" if [ $? -eq 0 ]; then # we're newer Headers. Load us InstallSelfBuiltHeader=1 fi - fi + fi fi - + # If we can't find self-built headers, install a self-built root only # if it's newer than anything else that's been installed (Headers and Roots) if [ $InstallSelfBuiltHeader -eq 0 -a -n "$SelfBuiltRoot" ]; then @@ -363,35 +377,35 @@ function InstallHeader() { # install a self-built root, or a prebuilt root, or nothing if [ $InstallSelfBuiltHeader -eq 1 ]; then - echo "Copying $Project from $SelfBuiltHeader ..." - ditto "$SelfBuiltHeader" "$BuildRoot" - "$DARWINXREF" register "$Project" "$SelfBuiltHeader" > /dev/null - TouchReceipt "$BuildRoot" "$Project" "hdrs" - return 0 + echo "Copying $Project from $SelfBuiltHeader ..." + _CopyRoot $SelfBuiltHeader/ "$BuildRoot/Developer/SDKs/PureDarwin.sdk" + "$DARWINXREF" register "$Project" "$SelfBuiltHeader" > /dev/null + TouchReceipt "$BuildRoot" "$Project" "hdrs" + return 0 elif [ $InstallSelfBuiltRoot -eq 1 ]; then - echo "Copying $Project from $SelfBuiltRoot ..." - ditto "$SelfBuiltRoot" "$BuildRoot" - "$DARWINXREF" register "$Project" "$SelfBuiltRoot" > /dev/null - TouchReceipt "$BuildRoot" "$Project" "root" - return 0 + echo "Copying $Project from $SelfBuiltRoot ..." + _CopyRoot $SelfBuiltRoot/ "$BuildRoot/Developer/SDKs/PureDarwin.sdk" + "$DARWINXREF" register "$Project" "$SelfBuiltRoot" > /dev/null + TouchReceipt "$BuildRoot" "$Project" "root" + return 0 elif [ $InstallPreBuiltRoot -eq 1 ]; then - # install a pre-built root, in inheritance order + # install a pre-built root, in inheritance order while [ "$dbuild" != "" ]; do - sites=$($DARWINXREF $dbfile -b $dbuild binary_sites "$Project") + sites=$($DARWINXREF $dbfile -b $dbuild binary_sites "$Project") Download "$CACHEDIR" \ "$Project.hdrs.tar.gz" \ - "$sites" + "$sites" if [ -f "$CACHEDIR/$Project.hdrs.tar.gz" ]; then cd "$BuildRoot" tar xzf "$CACHEDIR/$Project.hdrs.tar.gz" if [ $? -eq 0 ]; then tar tzf "$CACHEDIR/$Project.hdrs.tar.gz" | \ - "$DARWINXREF" register -stdin "$Project" "$BuildRoot" \ + "$DARWINXREF" register -stdin "$Project" "$BuildRoot" \ > /dev/null CheckForReceipt "$BuildRoot" "$Project" "hdrs" if [ $? -ne 0 ]; then - echo -n | CreateReceipt "$BuildRoot" "$Project" "hdrs" \ - "$CACHEDIR/$Project.hdrs.tar.gz" + echo -n | CreateReceipt "$BuildRoot" "$Project" "hdrs" \ + "$CACHEDIR/$Project.hdrs.tar.gz" fi return 0 fi @@ -400,7 +414,7 @@ function InstallHeader() { # try the full root Download "$CACHEDIR" \ "$Project.root.tar.gz" \ - "$sites" + "$sites" if [ -f "$CACHEDIR/$Project.root.tar.gz" ]; then cd "$BuildRoot" tar xzf "$CACHEDIR/$Project.root.tar.gz" @@ -410,8 +424,8 @@ function InstallHeader() { > /dev/null CheckForReceipt "$BuildRoot" "$Project" "root" if [ $? -ne 0 ]; then - echo -n | CreateReceipt "$BuildRoot" "$Project" "root" \ - "$CACHEDIR/$Project.root.tar.gz" + echo -n | CreateReceipt "$BuildRoot" "$Project" "root" \ + "$CACHEDIR/$Project.root.tar.gz" fi return 0 fi @@ -420,11 +434,11 @@ function InstallHeader() { fi fi - # if we didn't find the root for this build, keep looking in the next build - done - # we look through all inherited builds and couldn't actually install anything + # if we didn't find the root for this build, keep looking in the next build + done + # we look through all inherited builds and couldn't actually install anything echo "ERROR: could not find root: $Project" 1>&2 - exit 1 + exit 1 fi # we had a receipt, so nothing was request @@ -437,41 +451,41 @@ RECEIPTDIR=/usr/local/darwinbuild/receipts # For the given project and root type ("root" or "hdrs"), see if # a receipt is present in the build root function CheckForReceipt() { - local BuildRoot="$1" - local Project="$2" - local RootType=".$3" - local receipts="$BuildRoot/$RECEIPTDIR" - - if [ "$RootType" = ".root" ]; then - RootType="" - fi - - if [ -e "$receipts/$Project$RootType" ]; then - return 0 # success - else - return 1 - fi + local BuildRoot="$1" + local Project="$2" + local RootType=".$3" + local receipts="$BuildRoot/$RECEIPTDIR" + + if [ "$RootType" = ".root" ]; then + RootType="" + fi + + if [ -e "$receipts/$Project$RootType" ]; then + return 0 # success + else + return 1 + fi } ### # For the given project and root type ("root" or "hdrs"), touch the # a receipt so that it's timestamp is current function TouchReceipt() { - local BuildRoot="$1" - local Project="$2" - local RootType=".$3" - local receipts="$BuildRoot/$RECEIPTDIR" - - if [ "$RootType" = ".root" ]; then - RootType="" - fi - - if [ -e "$receipts/$Project$RootType" ]; then - touch "$receipts/$Project$RootType" - return 0 # success - else - return 1 - fi + local BuildRoot="$1" + local Project="$2" + local RootType=".$3" + local receipts="$BuildRoot/$RECEIPTDIR" + + if [ "$RootType" = ".root" ]; then + RootType="" + fi + + if [ -e "$receipts/$Project$RootType" ]; then + touch "$receipts/$Project$RootType" + return 0 # success + else + return 1 + fi } ### @@ -480,25 +494,25 @@ function TouchReceipt() { # By definition, something is newer than a non-existent receipt # If CmpDir is "", this will return false (1) function CheckIfNewerThanReceipt() { - local BuildRoot="$1" - local Project="$2" - local RootType=".$3" - local CmpDir="$4" - local receipts="$BuildRoot/$RECEIPTDIR" - - if [ "$RootType" = ".root" ]; then - RootType="" - fi - - if [ -e "$receipts/$Project$RootType" ]; then - if [ "$CmpDir" -nt "$receipts/$Project$RootType" ]; then - return 0 + local BuildRoot="$1" + local Project="$2" + local RootType=".$3" + local CmpDir="$4" + local receipts="$BuildRoot/$RECEIPTDIR" + + if [ "$RootType" = ".root" ]; then + RootType="" + fi + + if [ -e "$receipts/$Project$RootType" ]; then + if [ "$CmpDir" -nt "$receipts/$Project$RootType" ]; then + return 0 + else + return 1 + fi else - return 1 + return 0 fi - else - return 0 - fi } @@ -510,39 +524,39 @@ function CheckIfNewerThanReceipt() { # an optional hash source. The latter would be used to # hash a pre-built tarball instead of the receipt function CreateReceipt() { - local BuildRoot="$1" - local Project="$2" - local RootType=".$3" - local HashSource="$4" + local BuildRoot="$1" + local Project="$2" + local RootType=".$3" + local HashSource="$4" - local receipts="$BuildRoot/$RECEIPTDIR" - local TmpFile=$(mktemp -t "$Project") - local Hash="" + local receipts="$BuildRoot/$RECEIPTDIR" + local TmpFile=$(mktemp -t "$Project") + local Hash="" - if [ "$RootType" = ".root" ]; then - RootType="" - fi + if [ "$RootType" = ".root" ]; then + RootType="" + fi - mkdir -p "$receipts" + mkdir -p "$receipts" - # consume stdin - cat > "$TmpFile" + # consume stdin + cat > "$TmpFile" - if [ -n "$HashSource" ]; then - if [ ! -r "$HashSource" ]; then - echo "ERROR: Could not access $HashSource" 1>&2 - exit 1 + if [ -n "$HashSource" ]; then + if [ ! -r "$HashSource" ]; then + echo "ERROR: Could not access $HashSource" 1>&2 + exit 1 + fi + Hash=$($DIGEST < "$HashSource") + echo "# Hash of $HashSource" >> "$TmpFile" + else + Hash=$($DIGEST < "$TmpFile") fi - Hash=$($DIGEST < "$HashSource") - echo "# Hash of $HashSource" >> "$TmpFile" - else - Hash=$($DIGEST < "$TmpFile") - fi - - cp "$TmpFile" "$receipts/$Hash" - ln -sf "$Hash" "$receipts/$Project$RootType" - rm "$TmpFile" - return 0 + + cp "$TmpFile" "$receipts/$Hash" + ln -sf "$Hash" "$receipts/$Project$RootType" + rm "$TmpFile" + return 0 } # If a directory is empty, return 0 (success) @@ -559,3 +573,87 @@ function IsDirectoryEmpty() { fi } +function WriteDarwinbuildXcodeConfig() { + local BuildRoot="$1" + local SRCROOT="$2" + + cat <<-EOF > $SRCROOT/darwinbuild.xcconfig +DEPROOT = $BuildRoot/Developer/SDKs/MacOSX.sdk +SDKROOT = \$(DEPROOT) +ADDITIONAL_SDKS = \$(DEPROOT) +EOF +} + +function _CreatePureDarwinSDKFile() { + local OUR_SDK=$1 + local APPLE_SDK=$2 + + local APPLE_FILE=$APPLE_SDK/$3 + local OUR_FILE=$OUR_SDK/$3 + + local OUR_FILE_DIR=$(dirname $OUR_FILE) + local OUR_FILE_BASE=$(basename $OUR_FILE) + + if [ -e "$OUR_FILE" ]; then + return 0 + fi + + mkdir -p "$OUR_FILE_DIR" + pushd "$OUR_FILE_DIR" > /dev/null + + if [ -L $OUR_FILE_BASE ]; then + # Delete any old symlinks, so we don't follow them. + rm -f $OUR_FILE_BASE + fi + + ln -s $APPLE_FILE $OUR_FILE_BASE + popd > /dev/null +} + +function CreatePureDarwinSDK() { + local OUR_SDK=$1 + local APPLE_SDK=$(xcrun -sdk macosx --show-sdk-path) + + mkdir -p $OUR_SDK + cp /usr/local/share/darwinbuild/PDSDKSettings.plist $OUR_SDK/SDKSettings.plist + + mkdir -p $OUR_SDK/usr/include + pushd $APPLE_SDK/usr/include > /dev/null + find . -name '*.h' -print > /tmp/sdk-usr-include.$$.txt + find . -name '*.modulemap' -print >> /tmp/sdk-usr-include.$$.txt + popd > /dev/null + + OLD_IFS=$IFS + IFS=' +' + while read line; do + _CreatePureDarwinSDKFile $OUR_SDK $APPLE_SDK "usr/include/$line" + done < /tmp/sdk-usr-include.$$.txt + rm -f /tmp/sdk-usr-include.$$.txt + + mkdir -p $OUR_SDK/usr/lib + pushd $APPLE_SDK/usr/lib > /dev/null + find . -name '*.tbd' -print > /tmp/sdk-usr-lib.$$.txt + while read line; do + _CreatePureDarwinSDKFile $OUR_SDK $APPLE_SDK "usr/lib/$line" + done < /tmp/sdk-usr-lib.$$.txt + rm -f /tmp/sdk-usr-lib.$$.txt + + # Swift requires special handling, since there are more than tbd's in there. + rm -rf ${OUR_SDK}/usr/lib/swift + ditto ${APPLE_SDK}/usr/lib/swift ${OUR_SDK}/usr/lib/swift + + mkdir -p $OUR_SDK/System/Library/Frameworks + pushd $APPLE_SDK/System/Library/Frameworks > /dev/null + + find . -name \*.framework -depth 1 > /tmp/sdk-sys.$$.txt + mkdir -p $OUR_SDK/System/Library/Frameworks + mkdir -p $OUR_SDK/System/Library/PrivateFrameworks + while read line; do + _CreatePureDarwinSDKFile $OUR_SDK $APPLE_SDK "System/Library/Frameworks/$line" + done < /tmp/sdk-sys.$$.txt + rm -f /tmp/sdk-sys.$$.txt + + popd > /dev/null + IFS=$OLD_IFS +} diff --git a/darwinbuild/darwinbuild.in b/darwinbuild/darwinbuild.in old mode 100755 new mode 100644 index 5d05774..2ad5bdc --- a/darwinbuild/darwinbuild.in +++ b/darwinbuild/darwinbuild.in @@ -1,19 +1,19 @@ #!/bin/sh # # 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 # are met: # 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# 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. +# 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. -# +# 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 @@ -33,8 +33,7 @@ ### This script sets up the proper environment to build Darwin projects ### ### Building takes place in the BuildRoot, which by default is backed by -### a sparse disk image, but can also be mounted over NFS loopback (see -### -init options). The BuildRoot location can by specified by +### a sparse disk image. The BuildRoot location can by specified by ### the DARWIN_BUILDROOT environment variable. If not set, it will default ### to the current working directory. However, if the current working directory ### does not contain a Sources, Roots, Logs, and other necessary directories @@ -59,32 +58,19 @@ ### The script checks its source cache (BuildRoot/Sources) for a .tar.gz archive ### of the given project-version. If one exists, it is used. If it does not ### exist, then this script will attempt to use curl(1) to fetch the sources -### from the source sites specified in the plist. -### -### If the -chroot option is specified, the script will use the darwinxref tool -### to populate the build root with the "Roots" necessary to build the project -### (Roots are pre-compiled projects ready for installation). This script -### will look for an existing root in the root cache (BuildRoot/Roots). If a -### root is missing, then this script will attempt to use curl(1) to fetch the -### roots from the binary sites specified in the build plist. -### -### If the specified project requires Xcode to build (i.e. it does not use -### a makefile, but instead has a .pbproj or .xcodeproj file), then an SDK -### will be synthesized and chroot will not be used. +### from the source sites specified in the plist. ### -### PREFIX=%%PREFIX%% PWDP=$(pwd -P) XREFDB=.build/xref.db DMGFILE=.build/buildroot.sparsebundle -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 +DITTO=ditto DEFAULTPLISTSITE=http://svn.macosforge.org/repository/darwinbuild/trunk/plists/ build="" @@ -99,8 +85,9 @@ action="install" target="" configuration="" version="" +codesign="-" +use_sdkroot="true" -USE_CHROOT="YES" INSTALL_XCODE="NO" ### @@ -111,14 +98,6 @@ INSTALL_XCODE="NO" shopt -s nullglob -### -### DarwinBuild must be run as root. Enforce this. -### -if [ "$EUID" != "0" ]; then - echo "Error: DarwinBuild must be run as root." 1>&2 - exit 1 -fi - ### ### The "-init" command sets up the build environment ### in the current working directory. @@ -126,14 +105,13 @@ fi ### if [ "$1" == "-init" ]; then if [ "$2" == "" ]; then - echo "usage: $(basename $0) -init [-nodmg | -nfs]" 1>&2 + echo "usage: $(basename $0) -init [-nodmg ]" 1>&2 echo "" 1>&2 echo "\t\t can be a standard build number or a path to a plist." 1>&2 echo "\t\t supported paths: /dir/file.plist, " 1>&2 echo "\t\t\t\t http://host/dir/file.plist, " 1>&2 echo "\t\t\t\t user@host:/dir/file.plist" 1>&2 echo "\t-nodmg \t do not use a sparse image for build root (use a regular directory)" 1>&2 - echo "\t-nfs \t use NFS over loopback to mount the build root (implies -nodmg)" 1>&2 exit 1 fi build="$2" @@ -150,7 +128,7 @@ if [ "$1" == "-init" ]; then # user gave a local path to a plist # since we don't want to download this, copy it cp "$build" ".build/$filename" - elif [ $(echo $build | grep 'http://') ]; then + elif [ $(echo $build | egrep 'https?://') ]; then # user gave a URL to a webserver host=$(dirname $build) Download .build $filename $host @@ -160,34 +138,27 @@ if [ "$1" == "-init" ]; then fi build=$(echo "$filename" | sed 's/.plist$//') - echo "$build" > .build/build + echo "$build" > .build/build ### ### Create the build root ### - stamp=$(date +'%Y%m%d%H%M%S') - if [ "$3" == "-nfs" ]; then - mkdir -p $NFSDIR - mkdir -p BuildRoot - exportline="${PWDP}/${NFSDIR} -maproot=0:10" - grep "$exportline" /etc/exports >> /dev/null 2>&1 - if [ ! $? -eq 0 ]; then - echo "Adding build root to NFS exports file ..." - echo "# Added by darwinbuild on ${stamp}" >> /etc/exports - echo $exportline >> /etc/exports - fi - nfsd update - echo "Checking exports file ..." - nfsd checkexports - elif [ "$3" == "-nodmg" ]; then + if [ "$3" == "-nodmg" ]; then mkdir -p BuildRoot else - echo "Creating build root disk image ..." - DMGVOLUME="BuildRoot_${build}_${stamp}" - hdiutil create -size 1t -fs HFSX -quiet -uid 0 -gid 0 \ - -volname $DMGVOLUME \ - $DMGFILE - ln -s "/Volumes/${DMGVOLUME}" BuildRoot + DMGVOLUME="BuildRoot_${build}" + if [ -d "/Volumes/$DMGVOLUME" ]; then + stamp=$(date +'%Y%m%d%H%M%S') + DMGVOLUME="BuildRoot_${build}_${stamp}" + fi + + if [ ! -e "$DMGFILE" ]; then + echo "Creating build root disk image ..." + hdiutil create -size 1t -fs HFSX -quiet -uid $(id -u) -gid $(id -g) \ + -volname $DMGVOLUME \ + $DMGFILE + ln -s "/Volumes/${DMGVOLUME}" BuildRoot + fi fi ### @@ -208,11 +179,11 @@ fi function PrintUsage() { cat <<-EOF 1>&2 usage: $(basename $0) [action] [options] [] - actions: [-headers] [-fetch] [-source] [-load] [-loadonly] + actions: [-headers] [-fetch] [-source] [-load] [-loadonly] [-recursive] [-group] options: [-build=X] [-target=X] [-configuration=X] - [-logdeps] [-nochroot] [-nopatch] [-noload] - [-depsbuild=X [-depsbuild=Y]] [-nosource] - + [-logdeps] [-nopatch] [-noload] [-codesign=] + [-depsbuild=X [-depsbuild=Y]] [-nosource] [-nosdk] + EOF exit 1 } @@ -225,16 +196,9 @@ BuildRoot="$DARWIN_BUILDROOT/BuildRoot" export DARWINXREF_DB_FILE="$DARWIN_BUILDROOT/$XREFDB" ### -### See if we need to attach a disk image or mount an NFS share +### See if we need to attach a disk image ### -if [ ! -d "$BuildRoot/var" -a -d $NFSDIR ]; then - echo "*** Mounting build root over NFS loopback ..." - mount -t nfs localhost:${PWDP}/${NFSDIR} BuildRoot - if [ $? -ne 0 ]; then - echo "Error: Unable to mount build root"; - exit 72 - fi -elif [ -d $DMGFILE ]; then +if [ -d $DMGFILE ]; then stat -L $BuildRoot >> /dev/null 2>&1 if [ $? -eq 1 ]; then echo "*** Attaching build root disk image ..." @@ -242,8 +206,10 @@ elif [ -d $DMGFILE ]; then if [ $? -ne 0 ]; then echo "Error: Unable to attach sparse disk image"; exit 70 - fi + fi fi + + BuildRoot=$(cd "$BuildRoot" && pwd -P) fi ### @@ -273,25 +239,26 @@ fi ### Interpret our arguments: ### ### Actions: -### -headers Do the installhdrs phase, instead of install -### -fetch Only download necessary source and patch files -### -source Extract, patch, and stage source -### -load Populate the BuildRoot with one project -### -loadonly Only load dependencies into the chroot, but -### don't build. +### -headers Do the installhdrs phase, instead of install +### -fetch Only download necessary source and patch files +### -source Extract, patch, and stage source +### -load Populate the BuildRoot with one project +### -loadonly Only load dependencies into the build root, but don't build. +### -recursive Build given project(s) and all required dependencies +### -group Build all projects in the given darwinxref group, +### as with darwinbuild -recursive ### ### Options: -### -nosource Do not fetch or stage source. This assumes that the -### source is already in place in the BuildRoot. +### -nosource Do not fetch or stage source. This assumes that the +### source is already in place in the BuildRoot. ### -logdeps Do magic to log the build-time dependencies ### -nopatch Don't patch sources before building. -### -noload Don't load dependencies into the chroot. -### Has no effect if -nochroot is specified. -### -nochroot Do not chroot into the BuildRoot when building +### -noload Don't load dependencies into the build root. ### -target=X The makefile or xcode target to build ### -configuration=X Specify the build configuration to use ### -build=X Specify the darwin build number to buld, e.g. 8B15 -### -depsbuild=X Specify the darwin build number to populate the BuildRoot +### -depsbuild=X Specify the darwin build number to populate the BuildRoot +### -codesign= Sign the built root, using the given CODE_SIGN_IDENTITY value ### ### Parameters: ### The name of the project to build @@ -303,6 +270,11 @@ if [ "$DARWINBUILD_BUILD" != "" ]; then build="$DARWINBUILD_BUILD" fi +if [ "$1" == "-recursive" ]; then + shift + exec $DATADIR/darwinbuild-recursive -p "$@" +fi + for ARG in "$@"; do if [ "$projnam" == "" ]; then if [ "$ARG" == "-headers" ]; then @@ -315,6 +287,11 @@ for ARG in "$@"; do action="fetch" elif [ "$ARG" == "-source" ]; then action="source" + elif [ "$ARG" = "-recursive" ]; then + echo "Error: -recursive only supported as first argument to darwinbuild" 1>&2 + exit 1 + elif [ "$ARG" = "-group" ]; then + action="group" elif [ "${ARG/=*/}" == "-target" ]; then target="${ARG/*=/}" elif [ "${ARG/=*/}" == "-configuration" ]; then @@ -324,8 +301,11 @@ for ARG in "$@"; do elif [ "${ARG/=*/}" == "-depsbuild" ]; then depsbuild="${depsbuild} ${ARG/*=/}" elif [ "$ARG" == "-nochroot" ]; then - export INSTALL_XCODE="NO" - export USE_CHROOT="NO" + # Ignore this flag. + : # Don't remove this colon, or a syntax error will occur on the next line. + elif [ "$ARG" == "-chroot" ]; then + echo "WARNING: Building in the chroot is no longer supported." 1>&2 + echo "The -chroot flag will be ignored." 1>&2 elif [ "$ARG" == "-nopatch" ]; then nopatch="YES" elif [ "$ARG" == "-load" ]; then @@ -343,6 +323,17 @@ for ARG in "$@"; do elif [ "$ARG" == "-nosource" ]; then nosource="YES" nopatch="YES" + elif [ "${ARG/=*/}" == "-codesign" ]; then + codesign=${ARG/*=/} + + # $codesign and $ARG will be equal if there is no '=' in $ARG. + if [ "$codesign" == "$ARG" -o "$codesign" == "" ]; then + echo "WARNING: Code signing identity not specified." 1>&2 + echo "Using default ad-hoc signing." 1>&2 + codesign=- + fi + elif [ "${ARG}" == "-nosdk" ]; then + use_sdkroot="false" elif [ "${ARG:0:1}" != "-" ]; then projnam="$ARG" else @@ -387,6 +378,7 @@ fi ### ### If we are doing a -load, install the root and exit. +### Also handle -group here. ### if [ "$action" == "load" ]; then InstallRoot "$BuildRoot" "$projnam" "$depsbuild" @@ -394,6 +386,8 @@ if [ "$action" == "load" ]; then elif [ "$action" == "loadhdrs" ]; then InstallHeader "$BuildRoot" "$projnam" "$depsbuild" exit 0 +elif [ "$action" == "group" ]; then + exec $DATADIR/darwinbuild-recursive -g "$projnam" fi # @@ -414,7 +408,7 @@ alias=$($DARWINXREF original "$projnam") # # Look for an alternate target in the database # -if [ "$target" == "" -a "$action" == "install" ]; then +if [ "$target" == "" ]; then target=$($DARWINXREF target "$projnam") fi @@ -433,13 +427,6 @@ if [ "$project" == "" ]; then exit 1 fi -# check for the project being subversion based -branch=$($DARWINXREF branch $projnam) -if [ "$branch" != "" ]; then - # using subversion implies nosource - nosource="YES" -fi - ### ### Download the sources, ### and any applicable patches. @@ -454,11 +441,34 @@ if [ "$nosource" != "YES" ]; then filename="$project.tar.gz" fi - Download "$SourceCache" "$filename" "$($DARWINXREF source_sites $projnam)" + # prepare for the opensource.apple.com/tarballs case as it's no more redirected + if echo "$($DARWINXREF source_sites $projnam)" | grep "opensource.apple.com/tarballs" > /dev/null 2> /dev/null ; then + targetfilename=$(echo $(basename "$filename" .tar.gz) | sed -e 's,-[0-9.]*$,,') + Download "$SourceCache" "$filename" "$($DARWINXREF source_sites $projnam)/$targetfilename" + else + Download "$SourceCache" "$filename" "$($DARWINXREF source_sites $projnam)" + fi + + if [ ! -f "$SourceCache/$filename" ]; then + github_projname=$(echo $filename | sed -e 's,-.*$,,') + github_projversion=$(echo $filename | sed -e 's,\.tar\.gz$,,' | sed -e 's,^.*-,,') + github_dxref_plist=.build/$($DARWINXREF currentBuild).plist + $DATADIR/fetch-from-github "$github_dxref_plist" $github_projname $github_projversion "$SourceCache" + fi + + if [ ! -f "$SourceCache/$filename" ]; then + echo "ERROR: Source tarball could not be found: $projnam" 1>&2 + exit 1 + fi patchfilenames=$($DARWINXREF patchfiles $projnam) for p in $patchfilenames; do - Download "$SourceCache" "$p" "$($DARWINXREF source_sites $projnam)" + Download "$SourceCache" "$p" "$($DARWINXREF patch_sites $projnam)" + + if [ ! -f "$SourceCache/$p" ]; then + echo "ERROR: Patch could not be found: $p" 1>&2 + exit 1 + fi done ### If we are doing a -fetch, stop here. @@ -467,65 +477,73 @@ if [ "$nosource" != "YES" ]; then fi fi -### -### We do our building in private/var/tmp since it's -### likely to be out of the way of our dependencies -### and is supposed to be writable by everyone. -### - -vartmp="private/var/tmp" +vartmp="BuildCache" mkdir -p "$BuildRoot/$vartmp" chmod 1777 "$BuildRoot/$vartmp" ### ### Define the SRCROOT, OBJROOT, SYMROOT, and DSTROOT. -### This script refers to the absolute paths of the build -### directory, and should use REAL_SRCROOT, etc. -### If USE_CHROOT, then the environment variables will have -### the BuildRoot prefix omitted because the chroot -### will make all paths relative to that point. ### -REAL_SRCROOT="$BuildRoot/SourceCache/$projnam/$project" -REAL_OBJROOT="$BuildRoot/$vartmp/$projnam/$project.obj" -REAL_SYMROOT="$BuildRoot/$vartmp/$projnam/$project.sym" -REAL_DSTROOT="$BuildRoot/$vartmp/$projnam/$project.root" +SRCROOT="$BuildRoot/SourceCache/$projnam/$project" +OBJROOT="$BuildRoot/$vartmp/$projnam/$project.obj" +SYMROOT="$BuildRoot/$vartmp/$projnam/$project.sym" +DSTROOT="$BuildRoot/$vartmp/$projnam/$project.root" + +### +### Create the PureDarwin Xcode SDK. +### +mkdir -p $BuildRoot/Developer/SDKs +if [ ! -f "$BuildRoot/Developer/.CreatedPureDarwinSDK" -a "$use_sdkroot" == "true" ]; then + echo "*** Creating fresh PureDarwin SDK, this may take a while ..." + + # Remove the entire old SDK, to guarantee that we don't + # mistakenly follow a symlink into Apple's SDK and overwrite + # files provided by Apple. If this happens, Xcode must be + # reinstalled, and that takes a long time. + rm -rf "$BuildRoot/Developer/SDKs/PureDarwin.sdk" + CreatePureDarwinSDK "$BuildRoot/Developer/SDKs/PureDarwin.sdk" + + rmdir "$BuildRoot/usr/local/darwinbuild/receipts" || : + pushd "$BuildRoot/usr/local/darwinbuild" > /dev/null + ln -sfh ../../../Developer/SDKs/PureDarwin.sdk/usr/local/darwinbuild/receipts receipts + popd > /dev/null + + # This is necessary to squelch an Xcode warning. + pushd "$BuildRoot/Developer/SDKs" > /dev/null + ln -sfh PureDarwin.sdk MacOSX.sdk + popd > /dev/null + + touch "$BuildRoot/Developer/.CreatedPureDarwinSDK" +fi if [ "$nosource" != "YES" ]; then ### ### Remove any pre-existing directories that might be in the way - ### and create new directories in their place. Make sure the - ### directories have root:wheel ownership, otherwise things may - ### not build correctly. + ### and create new directories in their place. ### - rm -Rf "$REAL_SRCROOT" "$REAL_OBJROOT" "$REAL_SYMROOT" "$REAL_DSTROOT" - mkdir -p "$REAL_SRCROOT" "$REAL_OBJROOT" "$REAL_SYMROOT" "$REAL_DSTROOT" - chown root:wheel "$REAL_SRCROOT" "$REAL_OBJROOT" "$REAL_SYMROOT" "$REAL_DSTROOT" - + rm -Rf "$SRCROOT" "$OBJROOT" "$SYMROOT" "$DSTROOT" + mkdir -p "$SRCROOT" "$OBJROOT" "$SYMROOT" "$DSTROOT" + ### ### Install the sources and patches into the BuildRoot ### - cd "$REAL_SRCROOT/.." + cd "$SRCROOT/.." echo "*** Copying Sources ..." if [ -d "$SourceCache/$project" ]; then - tar c -C "$SourceCache" "$project" | tar xf - + tar c -C "$SourceCache" "$project" | tar xf - elif [ "$alias" != "" -a -d "$SourceCache/$alias-$version" ]; then tar c -C "$SourceCache" "$alias-$version" | tar xf - - rmdir "$REAL_SRCROOT" + rmdir "$SRCROOT" ln -fhs "$alias-$version" "$project" elif [ "$alias" != "" ]; then tar xzf "$SourceCache/$alias-$version.tar.gz" - rmdir "$REAL_SRCROOT" + rmdir "$SRCROOT" ln -fhs "$alias-$version" "$project" else tar xzf "$SourceCache/$filename" fi fi -if [ "$branch" != "" ]; then - mkdir -p "$REAL_SRCROOT" "$REAL_OBJROOT" "$REAL_SYMROOT" "$REAL_DSTROOT" - CheckoutOrUpdate "$REAL_SRCROOT" "$branch" "$($DARWINXREF source_sites $projnam)" -fi - # you can avoid registering patches in the DB by using "xnu-792--patches.tar.gz" if [ -r "$SourceCache/$project-patches.tar.gz" -a "$nosource" != "YES" ]; then tar xzf "$SourceCache/$project-patches.tar.gz" @@ -535,11 +553,11 @@ fi ### Apply the patches ### Current working directory should be the SRCROOT ### -cd "$REAL_SRCROOT" +cd "$SRCROOT" if [ "$nopatch" != "YES" ]; then -if [ -d "$REAL_SRCROOT/../$project-patches" ]; then +if [ -d "$SRCROOT/../$project-patches" ]; then echo "*** Applying Patches ..." - cat $REAL_SRCROOT/../$project-patches/* | patch -p0 + cat $SRCROOT/../$project-patches/* | patch -p0 fi for patchfile in $patchfilenames; do echo "*** Applying Patch $patchfile ..." @@ -558,10 +576,10 @@ for patchfile in $patchfilenames; do esac case $patchfile in *.p1.patch*) - $catprog "$SourceCache/$patchfile" | patch -l -f -p1 + $catprog "$SourceCache/$patchfile" | patch -p1 -N -r /dev/null ;; *.patch*) - $catprog "$SourceCache/$patchfile" | patch -l -f -p0 + $catprog "$SourceCache/$patchfile" | patch -p0 -N -r /dev/null ;; *.add*) newfile=`echo $patchfile | sed -e 's/^.*-\([^-]*\)\.add.*/\1/' -e 's,_,/,g'` @@ -583,95 +601,46 @@ fi ### ### Look for the build tool: make, xcodebuild ### -numfiles=$(echo *.pbxproj *.pbproj *.xcode *.xcodeproj 2> /dev/null ) +numfiles=$(echo *.xcodeproj 2> /dev/null ) if [ -n "$numfiles" ]; then - buildtool="xcodebuild" - # we use a platform/sdk instead of chrooting for Xcode projects - # but allow -nochroot to disable Xcode integration - if [ $USE_CHROOT == "YES" ]; then - export USE_CHROOT="NO" - export INSTALL_XCODE="YES" - fi + buildtool="xcodebuild" + export INSTALL_XCODE="YES" else buildtool="make" - - # test for hybrid make-xcode project - uses_xcrun=$(grep -Elir 'xcodebuild|xcrun|Commands.make|BSDCommon.make|Standard.make|Common.make' .) - if [ -n "$uses_xcrun" -a $USE_CHROOT == "YES" ]; then - export USE_CHROOT="NO" - export INSTALL_XCODE="YES" - fi fi receipts="$BuildRoot/usr/local/darwinbuild/receipts" mkdir -p "$receipts" -### xcodebuild is a special case because it is not open source -### we try to integrate the host copy of Xcode if required -if [ $INSTALL_XCODE == "YES" ]; then - if [ ! -f "$receipts/xcodebuild" ]; then - echo "*** Installing Xcode Tools ..." - "$DATADIR/installXcode" "$BuildRoot" - touch "$receipts/xcodebuild" - fi -fi - -### -### If we are going to build in a chroot, -### install the roots into the BuildRoot. -### Make sure we have at least a minimally functioning root -### by installing bash and its dependencies. -### -### Also install CoreOSMakefiles and Perl for make based projects -### - -NEED_ROOTS="YES" -if [ $USE_CHROOT == "NO" -a $INSTALL_XCODE == "NO" ]; then - NEED_ROOTS="NO" -fi - -if [ "$NEED_ROOTS" == "YES" -a "$noload" != "YES" ]; then +if [ "$noload" != "YES" ]; then echo "*** Installing Roots ..." - bash_deps=$($DARWINXREF dependencies -run "bash") deps=$($DARWINXREF dependencies -build "$projnam") - for X in files bash $bash_deps $deps ; do - InstallRoot "$BuildRoot" "$X" "$depsbuild" + for X in $deps ; do + if [ "$action" != "installhdrs" ]; then + InstallRoot "$BuildRoot" "$X" "$depsbuild" "$BuildRoot" + fi done - ### so many things require ditto, we have hacked around it - if [ ! -x "$BuildRoot/usr/bin/ditto" ]; then - cp "$DITTO" "$BuildRoot/usr/bin/ditto" - fi - - ### need dsymutil - if [ ! -x "$BuildRoot/usr/bin/dsymutil" ]; then - cp "/usr/bin/dsymutil" "$BuildRoot/usr/bin/dsymutil" - fi - - ### CoreOSMakefiles - if [ ! -d "$BuildRoot/Developer/Makefiles/CoreOS" ]; then - InstallRoot "$BuildRoot" "CoreOSMakefiles" "$depsbuild" - fi - - ### Perl - if [ ! -x "$BuildRoot/usr/bin/perl" ]; then - InstallRoot "$BuildRoot" "perl" "$depsbuild" - fi - echo "*** Installing Headers ..." deps=$($DARWINXREF dependencies -header "$projnam") for X in $deps ; do - InstallHeader "$BuildRoot" "$X" "$depsbuild" + InstallHeader "$BuildRoot" "$X" "$depsbuild" "$BuildRoot" done if [ "$loadonly" = "YES" ]; then - exit + WriteDarwinbuildXcodeConfig "$BuildRoot" "$SRCROOT" + exit fi fi +"$DATADIR/setXcodePlatform" "$PWDP" || { + echo Could not set Xcode platform, build cannot continue 1>&2 + exit 1 +} + ### ### Read in the environment ### @@ -683,22 +652,9 @@ LOG="$DARWIN_BUILDROOT/Logs/$projnam/$project.log~$build_version" TRACELOG="$BuildRoot/private/var/tmp/$projnam/$project.trace~$build_version" mkdir -p "$DARWIN_BUILDROOT/Logs/$projnam" -if [ "$USE_CHROOT" == "YES" ]; then - prefix="$BuildRoot" -else - prefix="" -fi -export SRCROOT="${REAL_SRCROOT/$prefix/}" -export OBJROOT="${REAL_OBJROOT/$prefix/}" -export SYMROOT="${REAL_SYMROOT/$prefix/}" -export DSTROOT="${REAL_DSTROOT/$prefix/}" - - - # Hide this variable from the unset export -n SRCROOT OBJROOT SYMROOT DSTROOT export -n DARWIN_BUILDROOT DARWINBUILD_BUILD DARWINXREF_DB_FILE -export -n USE_CHROOT INSTALL_XCODE # Screen sets this to a multi-line value which causes trouble unset TERMCAP @@ -712,7 +668,6 @@ IFS="$OLDIFS" export SRCROOT OBJROOT SYMROOT DSTROOT export DARWIN_BUILDROOT DARWINBUILD_BUILD DARWINXREF_DB_FILE -export USE_CHROOT INSTALL_XCODE export PATH=/bin:/sbin:/usr/bin:/usr/sbin/:/usr/local/bin:/usr/local/sbin export SHELL="/bin/sh" @@ -721,23 +676,17 @@ export LOGNAME="root" export USER="root" export GROUP="wheel" -# read the platform data installed by installXcode -if [ $INSTALL_XCODE == "YES" ]; then - platform=$(cat "${DARWIN_BUILDROOT}/.build/platform") - # set SDKROOT for Makefiles that use xcrun - export SDKROOT="$BuildRoot" -fi - build_string="" -if [ "$buildtool" == "xcodebuild" -a $INSTALL_XCODE == "YES" ]; then - build_string="-sdk $platform" -fi if [ "$buildtool" == "xcodebuild" -a "$target" != "" ]; then build_string="$build_string -target \"$target\"" elif [ "$target" != "" ]; then action="$target" fi +if [ "$buildtool" == "make" ]; then + build_string="$build_string DEPROOT=$BuildRoot/Developer/SDKs/MacOSX.sdk" +fi + # # append build configuration to $action, if any # this is only applicable to xcodebuild @@ -746,11 +695,22 @@ if [ "$buildtool" == "xcodebuild" -a "$configuration" != "" ]; then build_string="$build_string -configuration \"$configuration\"" fi +if [ "$buildtool" == "xcodebuild" ]; then + build_string="$build_string CODE_SIGN_IDENTITY=\"$codesign\"" + + if [ "$codesign" != "-" ]; then + build_string="$build_string CODE_SIGN_STYLE=Manual" + fi +fi + +### +### Write out the xcconfig file to override the Xcode SDK. +### + +WriteDarwinbuildXcodeConfig "$BuildRoot" "$SRCROOT" + ### ### Write out the build script that will be used. -### This may or may not be executed in a chroot. -### We want things like the gcc version to be picked -### up from the chroot. ### SCRIPT="$BuildRoot/$vartmp/$projnam/build-$project~$build_version.sh" @@ -766,43 +726,12 @@ cat <<-EOF > $SCRIPT echo ' Build action: $action' echo " Build number: $build" echo " Host kernel version: \$(uname -v 2>/dev/null)" - echo " cc version: \$(gcc -v 2>&1 | tail -n 1 2>/dev/null)" - # Panther cctools unlinks -o target, so don't use /dev/null - echo " cctools version: \$(as -v -o /.devnull < /dev/null 2>&1 | cut -c 22- 2>/dev/null)" + echo " clang version: \$(clang -v 2>&1 | grep version 2>/dev/null)" EOF -if [ "$logdeps" == "YES" ]; then - if [ "$USE_CHROOT" == "YES" ]; then - if [ "$DARWINTRACE" -nt "$BuildRoot/usr/lib/darwintrace.dylib" ]; then - mkdir -p "$BuildRoot/usr/lib" - cp "$DARWINTRACE" \ - "$BuildRoot/usr/lib/darwintrace.dylib" - fi - echo "export DARWINTRACE_LOG=\"${TRACELOG/$BuildRoot/}\"" >> $SCRIPT - echo "export DYLD_INSERT_LIBRARIES=/usr/lib/darwintrace.dylib" >> $SCRIPT - else - echo "export DARWINTRACE_LOG=\"${TRACELOG}\"" >> $SCRIPT - echo "export DYLD_INSERT_LIBRARIES=$DARWINTRACE" >> $SCRIPT - fi - - echo "export DYLD_FORCE_FLAT_NAMESPACE=1" >> $SCRIPT -fi - -if [ "$INSTALL_XCODE" == "YES" ]; then - echo "*** Redirecting ..." - echo "DARWINTRACE_REDIRECT=\"${BuildRoot}\"" - echo "DARWINTRACE_LOG=\"${TRACELOG}\"" - echo "DYLD_INSERT_LIBRARIES=$DARWINTRACE" - echo "DYLD_FORCE_FLAT_NAMESPACE=1" - echo "" - echo "export DARWINTRACE_REDIRECT=\"${BuildRoot}\"" >> $SCRIPT - echo "export DARWINTRACE_LOG=\"${TRACELOG}\"" >> $SCRIPT - echo "export DYLD_INSERT_LIBRARIES=$DARWINTRACE" >> $SCRIPT - echo "export DYLD_FORCE_FLAT_NAMESPACE=1" >> $SCRIPT -fi if [ "$buildtool" == "xcodebuild" ]; then cat <<-EOF >> $SCRIPT - echo " xcode version: \$(sh -c \\\"$buildtool -version\\\")" + echo " xcode version: \$(sh -c \\\"$buildtool -version\\\" | head -1 2> /dev/null)" EOF else cat <<-EOF >> $SCRIPT @@ -823,14 +752,15 @@ EOF ### build_string="$build_string \"SRCROOT=$SRCROOT\" \"OBJROOT=$OBJROOT\" \"SYMROOT=$SYMROOT\" \"DSTROOT=$DSTROOT\"" +if [ "$buildtool" == "xcodebuild" -a "$use_sdkroot" == "true" ]; then + build_string="$build_string SDKROOT=$BuildRoot/Developer/SDKs/MacOSX.sdk" +fi + XREF_ENV=$($DARWINXREF environment $projnam) OLDIFS="$IFS" IFS=$'\n' for X in \ "RC_ProjectName=$projnam" \ - "RC_ProjectSourceVersion=$version" \ - "RC_ProjectNameAndSourceVersion=$project" \ - "RC_ProjectBuildVersion=$build_version" \ $XREF_ENV ; do echo "echo '${X/=*/}: ${X/*=/}'" >> $SCRIPT eval "export -- \"$X\"" @@ -854,29 +784,13 @@ cat <<-EOF >> $SCRIPT echo '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++' echo 'Installed Roots:' EOF -# I didn't really want to use perl(1) here, but ls(1) doesn't support this. -# For now, execute this outside the chroot so we don't require perl to be -# installed in there. This should probably be re-written as a C tool -# that can be installed into the chroot. -# Uses tail +3 to avoid getting . and .. +# Print symlinks to receipts without relying on perl RECEIPTS=$DARWIN_BUILDROOT/BuildRoot/usr/local/darwinbuild/receipts -perl -e "opendir(DIR,\"$RECEIPTS\"); - @files = sort(readdir(DIR)); - my %seen; - foreach my \$x (@files) { - if ( -l \"$RECEIPTS/\$x\" ) { - \$seen{readlink(\"$RECEIPTS/\$x\")} = 1; - } - } - foreach my \$x (@files) { - my \$str = undef; - if ( -l \"$RECEIPTS/\$x\" ) { - \$str = sprintf \"%-20s -> %s\", \"\$x\", readlink(\"$RECEIPTS/\$x\"); - } elsif (!exists(\$seen{\$x})) { - \$str = sprintf \"%-24s%s\", \"\", \"\$x\"; - } - print \"echo \\\"\$str\\\"\n\" if \$str; - } closedir(DIR);" | tail +3 >> $SCRIPT +find -H $RECEIPTS -maxdepth 1 -type l -exec sh -c ' + for f do + printf "echo \"%-30s -> \t $(readlink $f)\" \n" $(basename -- "$f"); + done' \ +sh {} + >> $SCRIPT cat <<-EOF >> $SCRIPT echo '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++' echo $buildtool $action '$build_string' \< /dev/null @@ -890,7 +804,7 @@ cat <<-EOF >> $SCRIPT if [ -x /bin/date ]; then START_DATE=\$(date "+%s") fi - $buildtool $action $build_string < /dev/null + $buildtool $action $build_string < /dev/null EXIT_STATUS="\$?" if [ -x /bin/date ]; then END_DATE=\$(date "+%s") @@ -907,82 +821,34 @@ EOF chmod ugo+x $SCRIPT -ExitHandler() { - ### Once for fdsec - [ -z "$(echo $BuildRoot/dev/*)" ] || umount "$BuildRoot/dev" - ### Twice for devfs - [ -z "$(echo $BuildRoot/dev/*)" ] || umount "$BuildRoot/dev" - ### Thrice for volfs - [ -z "$(echo $BuildRoot/.vol/*)" ] || chroot "$BuildRoot" umount /.vol -} - - -if [ "$USE_CHROOT" == "YES" ] ; then - ### - ### Mount devfs in the chroot - ### We'll make /dev/null our de-facto test for the existence of devfs - ### - ### Warning: - ### This must be done *BEFORE* the call to chroot, otherwise there is - ### no way to unmount the filesystem except rebooting. - ### - echo "*** Mounting special filesystems ..." - trap ExitHandler EXIT - - if [ ! -c "$BuildRoot/dev/null" ]; then - echo "Mounting devfs ..." - mkdir -p "$BuildRoot/dev" - mount -t devfs stdin "$BuildRoot/dev" - mount -t fdesc -o union stdin "$BuildRoot/dev" - else - echo "devfs appears to exist ..." - fi - - if [ -x /sbin/mount_volfs ]; then - # volfs is no longer present (nor needed) on Leopard. - if [ -z "$(echo $BuildRoot/.vol/*)" ]; then - echo "Mounting volfs ..." - [ -d "$BuildRoot/sbin" ] || mkdir -p "$BuildRoot/sbin" - [ -x "$BuildRoot/sbin/mount_volfs" ] || \ - cp /sbin/mount_volfs "$BuildRoot/sbin/" - [ -x "$BuildRoot/sbin/umount" ] || \ - cp /sbin/umount "$BuildRoot/sbin/" - [ -d "$BuildRoot/.vol" ] || mkdir -p "$BuildRoot/.vol" - ## If the directory is empty, assume volfs not mounted - chroot "$BuildRoot" /sbin/mount_volfs "/.vol" - else - echo "volfs appears to be mounted ..." - fi - fi - ### - ### Actually invoke the build tool here - ### - chroot -u root -g wheel $BuildRoot $vartmp/$projnam/build-$project~$build_version.sh 2>&1 | tee -a "$LOG"; - EXIT_STATUS="${PIPESTATUS[0]}" -else - ### - ### Actually invoke the build tool here - ### - $BuildRoot/$vartmp/$projnam/build-$project~$build_version.sh 2>&1 | tee -a "$LOG" - EXIT_STATUS="${PIPESTATUS[0]}" - - ### - ### Clean up the logging - ### - if [ "$logdeps" == "YES" ]; then - export -n DYLD_INSERT_LIBRARIES DYLD_FORCE_FLAT_NAMESPACE DARWINTRACE_LOG - fi -fi +### +### Actually invoke the build tool here +### +$BuildRoot/$vartmp/$projnam/build-$project~$build_version.sh 2>&1 | tee -a "$LOG" +EXIT_STATUS="${PIPESTATUS[0]}" if [ $EXIT_STATUS -eq 0 ]; then - IsDirectoryEmpty "$REAL_DSTROOT" + IsDirectoryEmpty "$DSTROOT" if [ $? -eq 0 ]; then - echo "$REAL_DSTROOT is empty. Build verification failed." 1>&2 + echo "$DSTROOT is empty. Build verification failed." 1>&2 EXIT_STATUS=3 fi fi +if [ "$EXIT_STATUS" == "0" -a "$action" != "installhdrs" -a "$codesign" != "-" ]; then + if [ "$codesign" != "-" -a -f "$DSTROOT/usr/local/darwinbuild/darwinbuild-codesign.plist" ]; then + $DATADIR/sign-root "$codesign" "$DSTROOT" + EXIT_STATUS=$? + + if [ "$EXIT_STATUS" == "0" ]; then + # Delete the darwinbuild-codesign.plist file after the signing + # process has completed, so it isn't copied into the Root cache. + rm $DSTROOT/usr/local/darwinbuild/darwinbuild-codesign.plist + fi + fi +fi + if [ "$EXIT_STATUS" == "0" ]; then ### @@ -991,33 +857,33 @@ if [ "$EXIT_STATUS" == "0" ]; then ### if [ "$action" == "installhdrs" ]; then - ### Output the manifest + ### Output the manifest MANIFEST="/tmp/$projnam.$$" - "$DARWINXREF" register "$projnam" "$REAL_DSTROOT" | tee "$MANIFEST" + "$DARWINXREF" register "$projnam" "$DSTROOT" | tee "$MANIFEST" 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" + mkdir -p "$DSTROOT/usr/local/darwinbuild/receipts" + cp "$MANIFEST" "$DSTROOT/usr/local/darwinbuild/receipts/$SHA1" + ln -s "$SHA1" "$DSTROOT/usr/local/darwinbuild/receipts/$projnam.hdrs" rm -f "$MANIFEST" mkdir -p "$DARWIN_BUILDROOT/Headers/$projnam/$project.hdrs~$build_version" - ditto "$REAL_DSTROOT" "$DARWIN_BUILDROOT/Headers/$projnam/$project.hdrs~$build_version" + ditto "$DSTROOT" "$DARWIN_BUILDROOT/Headers/$projnam/$project.hdrs~$build_version" else ### Register the root with the darwinxref database. This will output a manifest ### which can be used to uniquely identify the root. Store the unique identifier ### in the receipts directory after registration. MANIFEST="/tmp/$projnam.$$" - "$DARWINXREF" register "$projnam" "$REAL_DSTROOT" | tee "$MANIFEST" + "$DARWINXREF" register "$projnam" "$DSTROOT" | tee "$MANIFEST" 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" + mkdir -p "$DSTROOT/usr/local/darwinbuild/receipts" + cp "$MANIFEST" "$DSTROOT/usr/local/darwinbuild/receipts/$SHA1" + ln -s "$SHA1" "$DSTROOT/usr/local/darwinbuild/receipts/$projnam" rm -f "$MANIFEST" mkdir -p "$DARWIN_BUILDROOT/Symbols/$projnam/$project.sym~$build_version" mkdir -p "$DARWIN_BUILDROOT/Roots/$projnam/$project.root~$build_version" - ditto "$REAL_SYMROOT" "$DARWIN_BUILDROOT/Symbols/$projnam/$project.sym~$build_version" - ditto "$REAL_DSTROOT" "$DARWIN_BUILDROOT/Roots/$projnam/$project.root~$build_version" + ditto "$SYMROOT" "$DARWIN_BUILDROOT/Symbols/$projnam/$project.sym~$build_version" + ditto "$DSTROOT" "$DARWIN_BUILDROOT/Roots/$projnam/$project.root~$build_version" if [ "$logdeps" == "YES" ]; then ### Log dependencies, but filter out duplicates, relative paths, and temporary files diff --git a/darwinbuild/darwinmaster.in b/darwinbuild/darwinmaster.in old mode 100755 new mode 100644 index d51e198..ccdb796 --- a/darwinbuild/darwinmaster.in +++ b/darwinbuild/darwinmaster.in @@ -39,18 +39,15 @@ # Chuck Remes function PrintUsage() { - cat 1>&2 <<- EOB -usage: $(basename "$0") [-arch=arch] - arch = {ppc, i386} + cat 1>&2 <<-EOB +usage: $(basename "$0") EOB exit 1 } for ARG in "$@"; do if [ "$VOLNAME" == "" ]; then - if [ "${ARG/=*/}" == "-arch" ]; then - ARCH="${ARCH/*=/}" - elif [ "${ARG:0:1}" != "-" ]; then + if [ "${ARG:0:1}" != "-" ]; then VOLNAME="$ARG" else PrintUsage "$0" @@ -60,8 +57,7 @@ for ARG in "$@"; do fi done -if [ "$ARCH" != "" -a "$ARCH" != "ppc" -a "$ARCH" != "i386" \ - -o "$VOLNAME" == "" ]; then +if [ "$VOLNAME" == "" ]; then PrintUsage "$0" fi @@ -87,12 +83,15 @@ DMG="/tmp/$VOLNAME.dmg" CDR="/tmp/$VOLNAME.cdr" ISO="/tmp/$VOLNAME.iso" PKGDIR="$DARWIN_BUILDROOT/Packages" -MKISOFS="/opt/local/bin/mkisofs" SIZE="650m" -if [ ! -z "$ARCH" ]; then - ARCHSFX="_$ARCH" -else - ARCHSFX="" + +if [ -z "$MKISOFS" ]; then + MKISOFS=$(which mkisofs) +fi + +if [ -z "$MKISOFS" ]; then + echo "Error: mkisofs not found, this tool is required." 1>&2 + exit 1 fi export DARWINXREF_DB_FILE="$DARWIN_BUILDROOT/$XREFDB" @@ -136,13 +135,6 @@ export DARWINBUILD_BUILD="$build" ### "$DATADIR/packageRoots" -### -### Update thin packages -### -if [ ! -z "$ARCH" ]; then - "$DATADIR/thinPackages" "$ARCH" -fi - ### ### Mount a disk image, create if necessary @@ -161,7 +153,7 @@ DESTDIR=$(hdiutil attach "$DMG" \ ### ### Copy roots necessary for booting / installation onto disk image ### -cd "$DESTDIR" || exit +pushd "$DESTDIR" > /dev/null || exit chown root:admin "$DESTDIR" chmod 1775 "$DESTDIR" @@ -170,127 +162,101 @@ for Project in $("$DARWINXREF" group boot) ; do InstallRoot "$DESTDIR" "$Project" "$build" done -### -### Generate the mkext cache -### -echo "Generating MKext ..." - -export TMPDIR="$DESTDIR/private/tmp" -if [ -z "$ARCH" ]; then - KEXTARCH="-a ppc -a i386" -else - KEXTARCH="-a $ARCH" -fi -kextcache $KEXTARCH -k -K "$DESTDIR/mach_kernel" -m "$DESTDIR/System/Library/Extensions.mkext" "$DESTDIR/System/Library/Extensions" -export -n TMPDIR - ### ### Remove extraneous files ### echo "Pruning ..." -find "$DESTDIR" -type f \( -name '*.[ch]' -or -name '*.cp' -or -name '*.cpp' \) -print -exec rm -f {} ';' +find "$DESTDIR" -type f \( -name '*.[ch]' -or -name '*.cp' -or -name '*.cpp' \) -print0 | xargs -0 rm -f +rm -Rf "$DESTDIR/Applications/Xcode.app" rm -Rf "$DESTDIR/AppleInternal" rm -Rf "$DESTDIR/Developer" rm -Rf "$DESTDIR/usr/local" rm -Rf "$DESTDIR/usr/share/doc" rm -Rf "$DESTDIR"/usr/share/man/man3/* +rmdir "$DESTDIR/Applications" 2> /dev/null ### ### Modify the root password to blank ### echo "Modifying Root Password ..." -nicl -raw "$DESTDIR/var/db/netinfo/local.nidb" -create /users/root passwd '' +echo "(Not implemented, making no changes)" ### ### Copy installation packages ### -mkdir -p "$DESTDIR/System/Installation/BinaryDrivers${ARCHSFX}" +mkdir -p "$DESTDIR/System/Installation/BinaryDrivers" echo "Copying binary drivers ..." -for X in $DARWIN_BUILDROOT/BinaryDrivers${ARCHSFX}/*-*.tar.bz2 ; do - Y="$DESTDIR"/System/Installation/BinaryDrivers${ARCHSFX}/$(basename $X) +for X in $DARWIN_BUILDROOT/BinaryDrivers/*-*.tar.bz2 ; do + Y="$DESTDIR"/System/Installation/BinaryDrivers/$(basename $X) if [ $X -nt $Y ]; then cp $X $Y fi done echo "Copying packages ..." -mkdir -p "$DESTDIR"/System/Installation/Packages${ARCHSFX} -for X in $DARWIN_BUILDROOT/Packages${ARCHSFX}/*-*.tar.bz2 ; do +mkdir -p "$DESTDIR"/System/Installation/Packages +for X in $DARWIN_BUILDROOT/Packages/*-*.tar.bz2 ; do f=$(basename $X) if [ "${f/-*/}" != "DarwinInstaller" ]; then - Y="$DESTDIR"/System/Installation/Packages${ARCHSFX}/$(basename $X) - if [ $X -nt $Y ]; then - echo $f - cp $X $Y - fi + Y="$DESTDIR"/System/Installation/Packages/$(basename $X) + if [ $X -nt $Y ]; then + echo $f + cp $X $Y + fi fi done +# Now chown to root:wheel, if possible. (Build invocations run as a +# non-privileged user will propagate that user's uid/gid to the build +# outputs it generates.) +if [ $EUID -eq 0 ]; then + echo "Setting file ownership to root/wheel ..." + chown -R root:wheel "$DESTDIR" +fi + ### -### Architecture-specific boot setup +### Create a bootable ISO filesystem ### -if [ "$ARCH" == "ppc" ]; then - ### - ### Bless the volume for powerpc booting - ### - echo "Blessing Volume ..." - bless --verbose \ - --label "$VOLNAME" \ - --folder "$DESTDIR/System/Library/CoreServices" \ - --bootinfo "$DESTDIR/usr/standalone/ppc/bootx.bootinfo" - - ### Generate CDR image - rm -f "$CDR" - hdiutil convert \ - "$DMG" \ - -format UDTO \ - -o "$CDR" - - -elif [ "$ARCH" == "i386" -o -z "$ARCH" ]; then - ### - ### Create a bootable ISO filesystem - ### - ditto "$DESTDIR/usr/standalone/i386" /tmp/i386 - rm -f "$ISO.boot" - $MKISOFS -R \ - -V "$VOLNAME" \ - -no-emul-boot \ - -T \ - -J \ - -c boot.cat \ - -b cdboot \ - -hide-joliet-trans-tbl \ - -quiet \ - -o "$ISO.boot" \ - /tmp/i386 - SECTORS=$(du "$ISO.boot" | tail -1 | awk '{print $1}') - - ### - ### Create a hybrid image - ### - rm -f "$ISO.dmg" - hdiutil create "$ISO.dmg" -size "$SIZE" -layout NONE - DEV=$(hdid -nomount "$ISO.dmg" | tail -1 | awk '{print $1}') - RDEV=$(echo $DEV | sed s/disk/rdisk/) - - pdisk "$RDEV" -initialize - BLOCKS=$(pdisk "$RDEV" -dump | grep 2: | awk -F" " '{print $4}') - - pdisk "$RDEV" -createPartition "$VOLNAME" Apple_HFS $SECTORS $(($BLOCKS - $SECTORS)) - SLICE=$(pdisk "$RDEV" -dump | grep "$VOLNAME" | awk -F: '{print $1}' | awk -F" " '{print $1}') - - ### Copy ISO boot data onto the disk image - dd if="$ISO.boot" of="$RDEV" skip=64 seek=64 bs=512 - - newfs_hfs -v "$VOLNAME" "${RDEV}s${SLICE}" - mkdir -p /mnt - mount -t hfs -o perm "${DEV}s${SLICE}" /mnt - ditto -rsrc "$DESTDIR" /mnt - bless -folder /mnt/System/Library/CoreServices \ - -bootinfo /mnt/usr/standalone/ppc/bootx.bootinfo \ - -label "$VOLNAME" - umount /mnt - hdiutil eject "$DEV" - mv "$ISO.dmg" "$ISO" -fi +ditto "$DESTDIR/usr/standalone/i386" /tmp/i386 +rm -f "$ISO.boot" +$MKISOFS -R \ + -V "$VOLNAME" \ + -no-emul-boot \ + -T \ + -J \ + -c boot.cat \ + -b cdboot \ + -hide-joliet-trans-tbl \ + -quiet \ + -o "$ISO.boot" \ + /tmp/i386 +SECTORS=$(du "$ISO.boot" | tail -1 | awk '{print $1}') + +### +### Create a hybrid image +### +rm -f "$ISO.dmg" +hdiutil create "$ISO.dmg" -size "$SIZE" -layout NONE +DEV=$(hdid -nomount "$ISO.dmg" | tail -1 | awk '{print $1}') +RDEV=$(echo $DEV | sed s/disk/rdisk/) + +pdisk "$RDEV" -initialize +BLOCKS=$(pdisk "$RDEV" -dump | grep 2: | awk -F" " '{print $4}') + +pdisk "$RDEV" -createPartition "$VOLNAME" Apple_HFS $SECTORS $(($BLOCKS - $SECTORS)) +SLICE=$(pdisk "$RDEV" -dump | grep "$VOLNAME" | awk -F: '{print $1}' | awk -F" " '{print $1}') + +### Copy ISO boot data onto the disk image +dd if="$ISO.boot" of="$RDEV" skip=64 seek=64 bs=512 + +newfs_hfs -v "$VOLNAME" "${RDEV}s${SLICE}" +mkdir -p /mnt +mount -t hfs -o perm "${DEV}s${SLICE}" /mnt +ditto -rsrc "$DESTDIR" /mnt +umount /mnt +rmdir /mnt +hdiutil eject "$DEV" +mv "$ISO.dmg" "$ISO" + +popd > /dev/null +hdiutil eject "$DESTDIR" diff --git a/darwinbuild/ditto b/darwinbuild/ditto deleted file mode 100755 index 8711a80..0000000 --- a/darwinbuild/ditto +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -INDEX=0 -COUNT=$# -for ARG in "$@" ; do - INDEX=$(($INDEX + 1)) - if [ "$ARG" == "-c" -o "$ARG" == "-x" ]; then - echo "Error: -c and -x are not supported by this ditto." 1>&2 - exit 1 - elif [ "${ARG:0:1}" != "-" -o "$ARG" == "--" ]; then - break - fi -done - -DST=${@:$COUNT:1} -for SRC in ${@:$INDEX:$(($COUNT - $INDEX))} ; do - if [ -d "$SRC" ]; then - if [ ! -d "$DST" ]; then - mkdir -p "$DST" - fi - tar cf - -C "$SRC" . | tar xpf - -C "$DST" - elif [ -f "$SRC" ]; then - cp -p "$SRC" "$DST" - fi -done diff --git a/darwinbuild/installXcode.in b/darwinbuild/installXcode.in deleted file mode 100755 index 45b40e2..0000000 --- a/darwinbuild/installXcode.in +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -PREFIX=%%PREFIX%% -BINDIR=$PREFIX/share/darwinbuild - -BROOT=$1 -VER=$(/usr/bin/xcodebuild -version | grep version | cut -d "-" -f 2 | cut -d ";" -f 1 | cut -d "." -f 1) - -if [ "$VER" -gt "920" ]; -then - if [ "$VER" -gt "1000" ]; - then - if [ "$VER" -gt "1600" ]; - then - "$BINDIR/installXcode32" "$BROOT"; - else - "$BINDIR/installXcode31" "$BROOT"; - fi - else - "$BINDIR/installXcode3" "$BROOT"; - fi -else - "$BINDIR/installXcode2" "$BROOT"; -fi - - diff --git a/darwinbuild/installXcode2 b/darwinbuild/installXcode2 deleted file mode 100755 index 695e9a2..0000000 --- a/darwinbuild/installXcode2 +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh - -FORCE="YES" - -XCODEBUILD=/usr/bin/xcodebuild -BUILDROOT="$1" - -EXTRACOPY=( \ - /usr/lib/dyld \ - /usr/share/icu \ - /System/Library/CoreServices/CharacterSets \ - /Developer/Private \ - /Developer/Tools \ - /usr/bin/xcodebuild \ - /Developer/Makefiles/pbx_jamfiles \ - /Library/Application\ Support/Xcode) - -JAMFILES=/Developer/Makefiles/pbx_jamfiles -XCODESETTINGS="/System/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/BuildSettings-macosx.plist" -XCODECOMP="/System/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/Built-in compilers.pbcompspec" - -if [ -z "$BUILDROOT" ]; then - echo "Usage: $0 /Volumes/DarwinBuild/BuildRoot" 1>&2 - exit 1 -fi - -mkdir -p "$BUILDROOT" - -### -### Recurse through frameworks and libraries looking for dependencies -### -RecurseLibs() { - echo $1 >> /tmp/installXcode.seen.$$ - otool -L $1 | tail -n +2 | awk '{ print $1 }' > /tmp/installXcode.tmplibs.$$ - cat /tmp/installXcode.tmplibs.$$ >> /tmp/installXcode.libs.$$ - cat /tmp/installXcode.tmplibs.$$ | while read X; do - if ! grep -q "^$X\$" /tmp/installXcode.seen.$$ ; then - RecurseLibs $X - fi - done -} - -RemoveTemps() { - rm -f /tmp/installXcode.libs.$$ - rm -f /tmp/installXcode.seen.$$ - rm -f /tmp/installXcode.tmplibs.$$ - rm -f /tmp/installXcode.tmpfiles.$$ - rm -f /tmp/installXcode.files.$$ -} - -AppendExtraFiles() { - for X in "${EXTRACOPY[@]}"; do - echo "$X" >> /tmp/installXcode.libs.$$ - done -} - -TransformLibs() { -# set -x - while read X; do - NEWX=$(echo $X | sed -n 's/\(.*\.framework\).*/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a framework binary, copy the entire bundle - echo "$NEWX" - continue - fi - - NEWX=$(echo $X | sed -n 's/\([^.]*\)\..*dylib$/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a dylib, copy associate symlinks and stuff - for Y in "$NEWX"*.dylib; do - echo "$Y" - done - continue - fi - - echo "$X" - done -# set +x -} - -GenerateFileNames() { - cat /tmp/installXcode.libs.$$ | sort -u | TransformLibs | sort -u | while read X; do - # echo adding children for "$X" - - # first mkdir parent directories - PARENT=$(dirname "$X") - while [ "$PARENT" != "/" -a "$PARENT" != "." ]; do - echo ".$PARENT" >> /tmp/installXcode.tmpfiles.$$ - PARENT=$(dirname "$PARENT") - done - find ".$X" \! \( -name \*_debug\* -o -name \*_profile\* -o -path \*/Headers\* -o -path \*/PrivateHeaders\* -o -path \*.dict\* \) >> /tmp/installXcode.tmpfiles.$$ - done - sort -u /tmp/installXcode.tmpfiles.$$ > /tmp/installXcode.files.$$ -} - -CopyFiles() { -# VERBOSECPIO="v" - VERBOSECPIO="" - echo -n "Copying Xcode and dependencies ..." - cpio -o -c < /tmp/installXcode.files.$$ | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,/Developer,/XCD/loper,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - find ".$JAMFILES" ".$XCODECOMP" | cpio -o -c | \ - sed -e 's,$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks,/XCD/SY///////Library/PrivateFrameworks,g' \ - -e 's,/Developer/Makefiles/pbx_jamfiles,/XCD/loper/Makefiles/pbx_jamfiles,g' \ - -e 's,/System/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - find ".$XCODESETTINGS" | cpio -o -c | \ - sed -e 's,/System/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - echo "done" -} - - - -### -### Find all the framework and library dependencies of Xcode build -### For frameworks, copy over all supporting files. -### - -pushd / > /dev/null - -RemoveTemps -touch /tmp/installXcode.seen.$$ -echo Analyzing Xcode dependencies ... -RecurseLibs $XCODEBUILD -AppendExtraFiles -GenerateFileNames -CopyFiles - -popd > /dev/null - -if [ ! -e "$BUILDROOT/Library/Application Support/Xcode/Specifications/GCC 3.5.xcspec" ]; -then - echo "Generating GCC 3.5.xcspec" - SRC="$BUILDROOT/Library/Application Support/Xcode/Specifications/GCC 4.0.xcspec" - if [ ! -e "$SRC" ]; then - SRC="$BUILDROOT/Library/Application Support/Xcode/Specifications/GCC 4.0.xcplugin/Contents/Resources/GCC 4.0.xcspec" - if [ ! -e "$SRC" ]; then - echo "No template for 3.5 spec" 1>&2 - exit 1 - fi - fi - sed \ - -e 's/4\.0/3.5/g' \ - -e 's/4_0/3_5/g' \ - -e '/DashIFlagAcceptsHeadermaps/d' \ - -e '/SupportsPredictiveCompilation/d' \ - -e '/SupportsSeparateUserHeaderPaths/d' \ - -e '/SupportsSymbolSeparation/d' \ - -e '/SupportsMacOSXMinVersionFlag/d' \ - -e '/SupportsIsysroot/d' \ - -e 's/SupportsHeadermaps = Yes/SupportsHeadermaps = No/' \ - -e '/USE_HEADERMAP/,/}/ s/DefaultValue = YES/DefaultValue = NO/' \ - -e '/USE_HEADER_SYMLINKS/,/}/ s/DefaultValue = NO/DefaultValue = YES/' \ - -e '/Name = GCC_MACOSX_VERSION_MIN/,/},/d' \ - -e '/Name = GCC_ENABLE_SYMBOL_SEPARATION/,/},/d' \ - -e '/Name = GCC_ENABLE_SSE3_EXTENSIONS/,/},/d' \ - -e '/Name = GCC_THREADSAFE_STATICS/,/},/d' \ - -e '/Name = GCC_OBJC_CALL_CXX_CDTORS/,/},/d' \ - -e '/Name = GCC_USE_NASM_FOR_ASM_FILETYPE/,/},/d' \ - -e '/OptionsForSDKPackages/,/};/d' \ - < "$SRC" \ - > "$BUILDROOT/Library/Application Support/Xcode/Specifications/GCC 3.5.xcspec" - -fi - -RemoveTemps diff --git a/darwinbuild/installXcode3 b/darwinbuild/installXcode3 deleted file mode 100755 index fc4e06b..0000000 --- a/darwinbuild/installXcode3 +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/sh - -FORCE="YES" - -XCODEBUILD=/Developer/usr/bin/xcodebuild -BUILDROOT="$1" - -EXTRACOPY=( \ - /usr/lib/dyld \ - /usr/share/icu \ - /Developer/Private \ - /Developer/Tools \ - /usr/bin/xcodebuild \ - /usr/bin/xcode-select \ - /Developer/usr/bin/xcodebuild \ - /Developer/Makefiles/pbx_jamfiles) - - -JAMFILES=/Developer/Makefiles/pbx_jamfiles -XCODESETTINGS="/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/BuildSettings-macosx.plist" -XCODECOMP="/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/Built-in compilers.pbcompspec" - -RPATH=/Developer/Library/PrivateFrameworks - -if [ -z "$BUILDROOT" ]; then - echo "Usage: $0 " 1>&2 - exit 1 -fi - -mkdir -p "$BUILDROOT" - -### -### Recurse through frameworks and libraries looking for dependencies -### -RecurseLibs() { - echo $1 >> /tmp/installXcode.seen.$$ - otool -L $1 | tail -n +2 | awk '{ print $1 }' > /tmp/installXcode.tmplibs.$$ - sed -e s,@rpath,${RPATH}, < /tmp/installXcode.tmplibs.$$ > /tmp/installXcode.outlibs.$$ - cat /tmp/installXcode.outlibs.$$ >> /tmp/installXcode.libs.$$ - cat /tmp/installXcode.outlibs.$$ | while read X; do - if ! grep -q "^$X\$" /tmp/installXcode.seen.$$ ; then - RecurseLibs $X - fi - done -} - -RemoveTemps() { - rm -f /tmp/installXcode.libs.$$ - rm -f /tmp/installXcode.outlibs.$$ - rm -f /tmp/installXcode.seen.$$ - rm -f /tmp/installXcode.tmplibs.$$ - rm -f /tmp/installXcode.tmpfiles.$$ - rm -f /tmp/installXcode.files.$$ -} - -AppendExtraFiles() { - for X in "${EXTRACOPY[@]}"; do - echo "$X" >> /tmp/installXcode.libs.$$ - done -} - -TransformLibs() { -# set -x - while read X; do - NEWX=$(echo $X | sed -n 's/\(.*\.framework\).*/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a framework binary, copy the entire bundle - echo "$NEWX" - continue - fi - - NEWX=$(echo $X | sed -n 's/\([^.]*\)\..*dylib$/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a dylib, copy associate symlinks and stuff - for Y in "$NEWX"*.dylib; do - echo "$Y" - done - continue - fi - - echo "$X" - done -# set +x -} - -GenerateFileNames() { - cat /tmp/installXcode.libs.$$ | sort -u | TransformLibs | sort -u | while read X; do - # echo adding children for "$X" - - # first mkdir parent directories - PARENT=$(dirname "$X") - while [ "$PARENT" != "/" -a "$PARENT" != "." ]; do - echo ".$PARENT" >> /tmp/installXcode.tmpfiles.$$ - PARENT=$(dirname "$PARENT") - done - find ".$X" \! \( -name \*_debug\* -o -name \*_profile\* -o -path \*/Headers\* -o -path \*/PrivateHeaders\* -o -path \*.dict\* \) >> /tmp/installXcode.tmpfiles.$$ - done - sort -u /tmp/installXcode.tmpfiles.$$ > /tmp/installXcode.files.$$ -} - -CopyFiles() { -# VERBOSECPIO="v" - VERBOSECPIO="" - echo "Copying Xcode and dependencies ..." - - # copy files and use sed to rewrite paths during copy - cpio -o -c < /tmp/installXcode.files.$$ | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - # symlink R to @rpath so we can replace uses of @rpath - pushd "$BUILDROOT/XCD" > /dev/null - ln -s loper/Library/PrivateFrameworks R - popd > /dev/null - - find ".$JAMFILES" ".$XCODECOMP" | cpio -o -c | \ - sed -e 's,$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks,/XCD/SY///////Library/PrivateFrameworks,g' \ - -e 's,/Developer/Makefiles/pbx_jamfiles,/XCD/loper/Makefiles/pbx_jamfiles,g' \ - -e 's,/Developer/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - find ".$XCODESETTINGS" | cpio -o -c | \ - sed -e 's,/Developer/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - echo "done" -} - - - -### -### Find all the framework and library dependencies of Xcode build -### For frameworks, copy over all supporting files. -### - -pushd / > /dev/null - -RemoveTemps -touch /tmp/installXcode.seen.$$ -echo Analyzing Xcode dependencies ... -RecurseLibs $XCODEBUILD -AppendExtraFiles -GenerateFileNames -CopyFiles - -popd > /dev/null - -RemoveTemps diff --git a/darwinbuild/installXcode31 b/darwinbuild/installXcode31 deleted file mode 100755 index 14e718f..0000000 --- a/darwinbuild/installXcode31 +++ /dev/null @@ -1,259 +0,0 @@ -#!/bin/sh - -FORCE="YES" - -XCODEBUILD=/Developer/usr/bin/xcodebuild -BUILDROOT="$1" - -EXTRACOPY=( \ - /usr/lib/dyld \ - /usr/share/icu \ - /Developer/Private \ - /Developer/Tools \ - /usr/bin/xcodebuild \ - /usr/bin/xcode-select \ - /Developer/Library/version.plist \ - /Developer/usr/bin/xcodebuild) - -BINSYMLINKS=( \ - cc \ - dsymutil \ - gcc \ - gcc-4.0 \ - gcc-4.2 \ - gcov \ - gcov-4.0 \ - gcov-4.2 \ - g++ \ - g++-4.0 \ - g++-4.2 \ - lex \ - libtool \ - mig \ - ranlib \ - strip \ - yacc) - -LIBEXECLINKS=( \ - migcom) - -JAMFILES="/Developer/Makefiles/pbx_jamfiles" -#XCODERESOURCES="/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/" - -RPATH=/Developer/Library/PrivateFrameworks - -if [ -z "$BUILDROOT" ]; then - echo "Usage: $0 " 1>&2 - exit 1 -fi - -mkdir -p "$BUILDROOT" - -### -### Symlink opensource binaries used by Xcode to /usr/bin -### so the opensource-built binary can be used instead -### of the one that ships with Xcode -### -SymlinkBinaries() { - echo "Creating symlinks for binaries ..." - - BIN_DIR="$BUILDROOT/XCD/loper/usr/bin/" - mkdir -p $BIN_DIR - pushd $BIN_DIR > /dev/null - for B in "${BINSYMLINKS[@]}"; do - ln -s "/usr/bin/$B" "$B" - done - popd > /dev/null - - LIBEXEC_DIR="$BUILDROOT/XCD/loper/usr/libexec/" - mkdir -p $LIBEXEC_DIR - pushd $LIBEXEC_DIR > /dev/null - for L in "${LIBEXECLINKS[@]}"; do - ln -s "/usr/libexec/$L" "$L" - done - popd > /dev/null - - -} - -### -### Load opensource binaries if they dont exist so we can symlink to them -### -LoadBinaries() { - echo "Loading binaries ..." - if [ ! -f "$BUILDROOT/usr/bin/gcc" ]; then - darwinbuild -load gcc - fi - if [ ! -f "$BUILDROOT/usr/bin/gcc-4.2" ]; then - darwinbuild -load gcc_42 - fi -} - -### -### Recurse through frameworks and libraries looking for dependencies -### -RecurseLibs() { - echo $1 >> /tmp/installXcode.seen.$$ - otool -L $1 | tail -n +2 | awk '{ print $1 }' > /tmp/installXcode.tmplibs.$$ - sed -e s,@rpath,${RPATH}, < /tmp/installXcode.tmplibs.$$ > /tmp/installXcode.outlibs.$$ - cat /tmp/installXcode.outlibs.$$ >> /tmp/installXcode.libs.$$ - cat /tmp/installXcode.outlibs.$$ | while read X; do - if ! grep -q "^$X\$" /tmp/installXcode.seen.$$ ; then - RecurseLibs $X - fi - done -} - -RemoveTemps() { - rm -f /tmp/installXcode.libs.$$ - rm -f /tmp/installXcode.outlibs.$$ - rm -f /tmp/installXcode.seen.$$ - rm -f /tmp/installXcode.tmplibs.$$ - rm -f /tmp/installXcode.tmpfiles.$$ - rm -f /tmp/installXcode.files.$$ -} - -AppendExtraFiles() { - for X in "${EXTRACOPY[@]}"; do - echo "$X" >> /tmp/installXcode.libs.$$ - done -} - -TransformLibs() { -# set -x - while read X; do - NEWX=$(echo $X | sed -n 's/\(.*\.framework\).*/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a framework binary, copy the entire bundle - echo "$NEWX" - continue - fi - - NEWX=$(echo $X | sed -n 's/\([^.]*\)\..*dylib$/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a dylib, copy associate symlinks and stuff - for Y in "$NEWX"*.dylib; do - echo "$Y" - done - continue - fi - - echo "$X" - done -# set +x -} - -GenerateFileNames() { - cat /tmp/installXcode.libs.$$ | sort -u | TransformLibs | sort -u | while read X; do - # echo adding children for "$X" - - # first mkdir parent directories - PARENT=$(dirname "$X") - while [ "$PARENT" != "/" -a "$PARENT" != "." ]; do - echo ".$PARENT" >> /tmp/installXcode.tmpfiles.$$ - PARENT=$(dirname "$PARENT") - done - find ".$X" \! \( -name \*_debug\* -o -name \*_profile\* -o -path \*/Headers\* -o -path \*/PrivateHeaders\* -o -path \*.dict\* \) >> /tmp/installXcode.tmpfiles.$$ - done - sort -u /tmp/installXcode.tmpfiles.$$ > /tmp/installXcode.files.$$ -} - -CopyFiles() { -# VERBOSECPIO="v" - VERBOSECPIO="" - echo "Copying Xcode and dependencies ..." - - # copy files and use sed to rewrite paths during copy - cpio -o -c < /tmp/installXcode.files.$$ | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - echo "Symlinking for RPATH ..." - # symlink R to @rpath so we can replace uses of @rpath - pushd "$BUILDROOT/XCD" > /dev/null - ln -s loper/Library/PrivateFrameworks R - popd > /dev/null - - echo "Copying Jamfiles ..." - find ".$JAMFILES" | cpio -o -c | \ - sed -e 's,$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks,/XCD/SY///////Library/PrivateFrameworks,g' \ - -e 's,/Developer/Makefiles/pbx_jamfiles,/XCD/loper/Makefiles/pbx_jamfiles,g' \ - -e 's,/Developer/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/loper/Library/PrivateFrameworks/DevToolsCore.framework,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - - echo "Copying CoreServices ..." - find ./System/Library/CoreServices/System*.{plist,bundle} \ - ./System/Library/CoreServices/CoreTypes.bundle/ \ - | cpio -o -c | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - # copy xcode support files such as plugins - # but do not copy svn plugins since they are unecessary - echo "Copying Xcode library support files ..." - find "./Developer/Library/Xcode/" \! -ipath '*subversion*' \ - | cpio -o -c | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - # Platform - echo "Copying Mac OS X Platform ..." - find "./Developer/Platforms/MacOSX.platform" | cpio -o -c | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - -} - - - -### -### Find all the framework and library dependencies of Xcode build -### For frameworks, copy over all supporting files. -### - -pushd / > /dev/null - -RemoveTemps -touch /tmp/installXcode.seen.$$ -echo Analyzing Xcode dependencies ... -RecurseLibs $XCODEBUILD -AppendExtraFiles -GenerateFileNames -CopyFiles -LoadBinaries -SymlinkBinaries - -popd > /dev/null - -#RemoveTemps - -echo "Completed Xcode installation!" diff --git a/darwinbuild/installXcode32.in b/darwinbuild/installXcode32.in deleted file mode 100755 index df6703d..0000000 --- a/darwinbuild/installXcode32.in +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -FORCE="YES" -XCODEBUILD=/Developer/usr/bin/xcodebuild -BUILDROOT="$1" -DBROOT=$(dirname $BUILDROOT) -PLATFORMDIR="${DBROOT}/Platform" -STAMP=$(date +%Y%m%d%H%M%S) -BUILD=$(cat $DBROOT/.build/build) -PLATFORM="Darwinbuild_${BUILD}_${STAMP}" -INFOPLIST=%%PREFIX%%/share/darwinbuild/Info.plist -SDKPLIST=%%PREFIX%%/share/darwinbuild/SDKSettings.plist - -echo $PLATFORM > "${DBROOT}/.build/platform" -echo "Installing Platform/SDK $PLATFORM for Xcode 3.2" - -mkdir -p "${PLATFORMDIR}/Developer/SDKs" -mkdir -p "${PLATFORMDIR}/Developer/Library/Xcode" - -rsync -a "/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/" \ - "${PLATFORMDIR}/Developer/Library/Xcode" - -sed -e "s,%%PLATFORM%%,${PLATFORM}," $INFOPLIST > "${PLATFORMDIR}/Info.plist" -sed -e "s,%%PLATFORM%%,${PLATFORM}," $SDKPLIST > "${BUILDROOT}/SDKSettings.plist" - -pushd "${PLATFORMDIR}/Developer" > /dev/null -ln -s ../../BuildRoot/usr/ usr -popd > /dev/null - -pushd "${PLATFORMDIR}/Developer/SDKs" > /dev/null -ln -s ../../../BuildRoot/ "${PLATFORM}.sdk" -popd > /dev/null - -pushd "/Developer/Platforms" > /dev/null -ln -s "$PLATFORMDIR" "${PLATFORM}.platform" -popd > /dev/null - -mkdir -p "${DBROOT}/BuildRoot/Developer/" -pushd "${DBROOT}/BuildRoot/Developer/" > /dev/null -ln -s ../usr usr -popd > /dev/null - -echo "Completed Platform/SDK install" - diff --git a/darwinbuild/log-index.pl b/darwinbuild/log-index.pl old mode 100755 new mode 100644 diff --git a/darwinbuild/manifest.c b/darwinbuild/manifest.c index 4e87a03..146a595 100644 --- a/darwinbuild/manifest.c +++ b/darwinbuild/manifest.c @@ -110,7 +110,7 @@ static size_t ent_filename(FTSENT* ent, char* filename, size_t bufsiz) { } strncat(filename, "/", bufsiz); bufsiz -= 1; - if (ent->fts_name) { + if (ent->fts_namelen != 0) { strncat(filename, ent->fts_name, bufsiz); bufsiz -= strlen(ent->fts_name); } diff --git a/darwinbuild/packageRoots.in b/darwinbuild/packageRoots.in old mode 100755 new mode 100644 diff --git a/darwinbuild/processtrace.sh b/darwinbuild/processtrace.sh old mode 100755 new mode 100644 diff --git a/darwinbuild/setXcodePlatform b/darwinbuild/setXcodePlatform new file mode 100755 index 0000000..110eba3 --- /dev/null +++ b/darwinbuild/setXcodePlatform @@ -0,0 +1,46 @@ +#!/bin/sh +# +# Copyright (c) 2017 William Kent. All rights reserved. +# +# 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 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. +# + +# Don't overwrite the platform if it already exists +[ -f $1/.build/platform ] && exit 0 + +set -e + +HOST_DARWIN_VERSION=$(sw_vers -productVersion | sed -Ee 's,([0-9]+\.[0-9]{2}).*,\1,') + +[[ "$HOST_DARWIN_VERSION" =~ ^11 ]] && echo 'macosx11.0' > $1/.build/platform +[[ "$HOST_DARWIN_VERSION" =~ ^10.15 ]] && echo 'macosx10.15' > $1/.build/platform +[[ "$HOST_DARWIN_VERSION" =~ ^10.14 ]] && echo 'macosx10.14' > $1/.build/platform +[[ "$HOST_DARWIN_VERSION" =~ ^10.13 ]] && echo 'macosx10.13' > $1/.build/platform +[[ "$HOST_DARWIN_VERSION" =~ ^10.12 ]] && echo 'macosx10.12' > $1/.build/platform + +if [ ! -f $1/.build/platform ]; then + echo Unrecognized macOS version 1>&2 + exit 1 +fi diff --git a/darwinbuild/synthfat b/darwinbuild/synthfat old mode 100755 new mode 100644 diff --git a/darwinbuild/thinFile b/darwinbuild/thinFile old mode 100755 new mode 100644 diff --git a/darwinbuild/thinPackages.in b/darwinbuild/thinPackages.in old mode 100755 new mode 100644 diff --git a/darwintrace/darwintrace.c b/darwintrace/darwintrace.c index 94f499b..138aa79 100644 --- a/darwintrace/darwintrace.c +++ b/darwintrace/darwintrace.c @@ -2,20 +2,20 @@ * Copyright (c) 2005-2012 Apple 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. + * 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. + * 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. - * + * 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 @@ -26,7 +26,7 @@ * 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@ */ @@ -57,47 +57,41 @@ #define dprintf(...) #endif -#define LION_OR_LATER (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ -__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) +#define LION_OR_LATER (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) #define DARWINTRACE_INTERPOSE(_replacement,_replacee) \ -__attribute__((used)) static struct { \ - const void* replacement; \ - const void* replacee; \ -} _interpose_##_replacee \ -__attribute__ ((section ("__DATA,__interpose"))) = { \ - (const void*)(unsigned long)&_replacement, \ - (const void*)(unsigned long)&_replacee \ -} + __attribute__((used)) static struct { \ + const void* replacement; \ + const void* replacee; \ + } _interpose_##_replacee \ + __attribute__ ((section ("__DATA,__interpose"))) = { \ + (const void*)(unsigned long)&_replacement, \ + (const void*)(unsigned long)&_replacee \ + } static int darwintrace_fd = -2; static char darwintrace_progname[DARWINTRACE_BUFFER_SIZE]; static pid_t darwintrace_pid = -1; /** - * Redirect file access + * Redirect file access */ static char *darwintrace_redirect = NULL; static char *darwintrace_buildroot = NULL; static const char *darwintrace_exceptions[] = { - "/Developer/Library/Private", - "/Developer/Library/Frameworks", - "/Developer/usr/bin/../../Library/Private", - "/Developer/usr/bin/../../Library/Frameworks", - "/Developer/Library/Xcode", - "/Developer/Platforms/", - "/Developer/usr/bin/xcode", - "/System/Library/Frameworks/Carbon", - "/Volumes/BuildRoot_", - "/usr/bin/xcrun", - "/usr/bin/xcode", - "/usr/local/share/darwin", - "/usr/share/xcode", - "/var/folders/", - "/var/tmp/", - "/.vol/", - "/tmp/", - "/dev/", + "/Applications/Xcode.app/Contents/Developer", + "/System/Library", + "/Volumes/BuildRoot_", + "/usr/bin/xcrun", + "/usr/bin/xcode", + "/usr/lib", + "/usr/local/share/darwin", + "/usr/share/xcode", + "/var/folders/", + "/var/tmp/", + "/.vol/", + "/tmp/", + "/dev/", }; /* store root paths so we can ignore them when logging */ @@ -110,115 +104,115 @@ static char *darwintrace_log_path; /* check if str starts with one of the exceptions */ static inline bool darwintrace_except(const char *str) { - size_t c = sizeof(darwintrace_exceptions)/sizeof(*darwintrace_exceptions); - size_t i; - for (i = 0; i < c; i++) { - if (strncmp(darwintrace_exceptions[i], str, strlen(darwintrace_exceptions[i])) == 0) { - return true; - } - } - return false; + size_t c = sizeof(darwintrace_exceptions)/sizeof(*darwintrace_exceptions); + size_t i; + for (i = 0; i < c; i++) { + if (strncmp(darwintrace_exceptions[i], str, strlen(darwintrace_exceptions[i])) == 0) { + return true; + } + } + return false; } /* apply redirection heuristic to path */ static inline char* darwintrace_redirect_path(const char* path) { - if (!darwintrace_redirect) return (char*)path; - - char *redirpath; - redirpath = (char *)path; - if (path[0] == '/' - && !darwintrace_except(path) - && strncmp(darwintrace_buildroot, path, strlen(darwintrace_buildroot))!=0 - && strncmp(darwintrace_redirect, path, strlen(darwintrace_redirect))!=0 ) { - asprintf(&redirpath, "%s%s%s", darwintrace_redirect, (*path == '/' ? "" : "/"), path); - dprintf("darwintrace: redirect %s -> %s\n", path, redirpath); - } - - return redirpath; + if (!darwintrace_redirect) return (char*)path; + + char *redirpath; + redirpath = (char *)path; + if (path[0] == '/' + && !darwintrace_except(path) + && strncmp(darwintrace_buildroot, path, strlen(darwintrace_buildroot))!=0 + && strncmp(darwintrace_redirect, path, strlen(darwintrace_redirect))!=0 ) { + asprintf(&redirpath, "%s%s%s", darwintrace_redirect, (*path == '/' ? "" : "/"), path); + dprintf("darwintrace: redirect %s -> %s\n", path, redirpath); + } + + return redirpath; } /* free path if not the same as test */ static inline void darwintrace_free_path(char* path, const char* test) { - if (path != test) free(path); + if (path != test) free(path); } static void _darwintrace_setup(void) { - char* path = getenv("DARWINTRACE_LOG"); - if (path != NULL) { - int olderrno = errno; - int fd = open(path, - O_CREAT | O_WRONLY | O_APPEND, - DEFFILEMODE); - int newfd; - for(newfd = DARWINTRACE_START_FD; newfd < DARWINTRACE_STOP_FD; newfd++) { - if(-1 == write(newfd, "", 0) && errno == EBADF) { - if(-1 != dup2(fd, newfd)) darwintrace_fd = newfd; - close(fd); - fcntl(darwintrace_fd, F_SETFD, 1); /* close-on-exec */ - break; - } - } - darwintrace_log_path = strdup(path); - errno = olderrno; - } - - /* read env vars needed for redirection */ - darwintrace_redirect = getenv("DARWINTRACE_REDIRECT"); - darwintrace_buildroot = getenv("DARWIN_BUILDROOT"); - - darwintrace_pid = getpid(); - char** progname = _NSGetProgname(); - if (progname && *progname) { - if (strlcpy(darwintrace_progname, *progname, sizeof(darwintrace_progname)) >= sizeof(darwintrace_progname)) { - dprintf("darwintrace: progname too long to copy: %s\n", *progname); - } - } - - /* create ignores list from root env vars */ - if (getenv("DARWINTRACE_IGNORE_ROOTS")) { - darwintrace_ignores = (char**)calloc(4, sizeof(char*)); - darwintrace_ignore_lens = (size_t*)calloc(4, sizeof(size_t)); - if (darwintrace_ignores && darwintrace_ignore_lens) { - darwintrace_ignores[0] = getenv("OBJROOT"); - if (darwintrace_ignores[0]) - darwintrace_ignore_lens[0] = strlen(darwintrace_ignores[0]); - darwintrace_ignores[1] = getenv("SRCROOT"); - if (darwintrace_ignores[1]) - darwintrace_ignore_lens[1] = strlen(darwintrace_ignores[1]); - darwintrace_ignores[2] = getenv("DSTROOT"); - if (darwintrace_ignores[2]) - darwintrace_ignore_lens[2] = strlen(darwintrace_ignores[2]); - darwintrace_ignores[3] = getenv("SYMROOT"); - if (darwintrace_ignores[3]) - darwintrace_ignore_lens[3] = strlen(darwintrace_ignores[3]); - } else { - dprintf("unable to allocate memory for darwintrace_ignores"); - } - } - - /* find the install path of the darwintrace dylib for later use */ - path = getenv("DYLD_INSERT_LIBRARIES"); - if (path != NULL) { - char *ptr = strstr(path, "darwintrace.dylib"); - if (ptr) { - /* scan backward for : or start of string */ - while (ptr > path) { - if (*ptr == ':') { - ++ptr; - break; - } - --ptr; - } - - darwintrace_dylib_path = strdup(ptr); - - /* scan forward for : or end of string and terminate */ - ptr = strchr(darwintrace_dylib_path, ':'); - if (ptr) { - *ptr = 0; - } - } - } + char* path = getenv("DARWINTRACE_LOG"); + if (path != NULL) { + int olderrno = errno; + int fd = open(path, + O_CREAT | O_WRONLY | O_APPEND, + DEFFILEMODE); + int newfd; + for(newfd = DARWINTRACE_START_FD; newfd < DARWINTRACE_STOP_FD; newfd++) { + if(-1 == write(newfd, "", 0) && errno == EBADF) { + if(-1 != dup2(fd, newfd)) darwintrace_fd = newfd; + close(fd); + fcntl(darwintrace_fd, F_SETFD, 1); /* close-on-exec */ + break; + } + } + darwintrace_log_path = strdup(path); + errno = olderrno; + } + + /* read env vars needed for redirection */ + darwintrace_redirect = getenv("DARWINTRACE_REDIRECT"); + darwintrace_buildroot = getenv("DARWIN_BUILDROOT"); + + darwintrace_pid = getpid(); + char** progname = _NSGetProgname(); + if (progname && *progname) { + if (strlcpy(darwintrace_progname, *progname, sizeof(darwintrace_progname)) >= sizeof(darwintrace_progname)) { + dprintf("darwintrace: progname too long to copy: %s\n", *progname); + } + } + + /* create ignores list from root env vars */ + if (getenv("DARWINTRACE_IGNORE_ROOTS")) { + darwintrace_ignores = (char**)calloc(4, sizeof(char*)); + darwintrace_ignore_lens = (size_t*)calloc(4, sizeof(size_t)); + if (darwintrace_ignores && darwintrace_ignore_lens) { + darwintrace_ignores[0] = getenv("OBJROOT"); + if (darwintrace_ignores[0]) + darwintrace_ignore_lens[0] = strlen(darwintrace_ignores[0]); + darwintrace_ignores[1] = getenv("SRCROOT"); + if (darwintrace_ignores[1]) + darwintrace_ignore_lens[1] = strlen(darwintrace_ignores[1]); + darwintrace_ignores[2] = getenv("DSTROOT"); + if (darwintrace_ignores[2]) + darwintrace_ignore_lens[2] = strlen(darwintrace_ignores[2]); + darwintrace_ignores[3] = getenv("SYMROOT"); + if (darwintrace_ignores[3]) + darwintrace_ignore_lens[3] = strlen(darwintrace_ignores[3]); + } else { + dprintf("unable to allocate memory for darwintrace_ignores"); + } + } + + /* find the install path of the darwintrace dylib for later use */ + path = getenv("DYLD_INSERT_LIBRARIES"); + if (path != NULL) { + char *ptr = strstr(path, "darwintrace.dylib"); + if (ptr) { + /* scan backward for : or start of string */ + while (ptr > path) { + if (*ptr == ':') { + ++ptr; + break; + } + --ptr; + } + + darwintrace_dylib_path = strdup(ptr); + + /* scan forward for : or end of string and terminate */ + ptr = strchr(darwintrace_dylib_path, ':'); + if (ptr) { + *ptr = 0; + } + } + } } static inline void darwintrace_setup(void) { @@ -228,88 +222,88 @@ static inline void darwintrace_setup(void) { /* darwintrace_setup must have been called already */ static inline void darwintrace_logpath(int fd, const char *procname, char *tag, const char *path) { - if (darwintrace_ignores) { - for (int i=0; i < 4; i++) { - if (darwintrace_ignores[i] - && strncmp(darwintrace_ignores[i], path, darwintrace_ignore_lens[i]) == 0) { - return; - } - } - } - size_t size; - char pidstr_bytes[16]; - char *pidstr = &pidstr_bytes[sizeof(pidstr_bytes)-1]; - char darwintrace_buf[DARWINTRACE_BUFFER_SIZE]; - - pid_t pid = darwintrace_pid; - *pidstr = 0; - do { - --pidstr; - *pidstr = '0' + (pid % 10); - pid /= 10; - } while (pid > 0); - - /* "%s[%d]\t%s\t%s\n" */ - size = strlcpy(darwintrace_buf, procname ? procname : darwintrace_progname, sizeof(darwintrace_buf)); - size = strlcat(darwintrace_buf, "[", sizeof(darwintrace_buf)); - size = strlcat(darwintrace_buf, pidstr, sizeof(darwintrace_buf)); - size = strlcat(darwintrace_buf, "]\t", sizeof(darwintrace_buf)); - size = strlcat(darwintrace_buf, tag, sizeof(darwintrace_buf)); - size = strlcat(darwintrace_buf, "\t", sizeof(darwintrace_buf)); - size = strlcat(darwintrace_buf, path, sizeof(darwintrace_buf)); - size = strlcat(darwintrace_buf, "\n", sizeof(darwintrace_buf)); - write(fd, darwintrace_buf, size); + if (darwintrace_ignores) { + for (int i=0; i < 4; i++) { + if (darwintrace_ignores[i] + && strncmp(darwintrace_ignores[i], path, darwintrace_ignore_lens[i]) == 0) { + return; + } + } + } + size_t size; + char pidstr_bytes[16]; + char *pidstr = &pidstr_bytes[sizeof(pidstr_bytes)-1]; + char darwintrace_buf[DARWINTRACE_BUFFER_SIZE]; + + pid_t pid = darwintrace_pid; + *pidstr = 0; + do { + --pidstr; + *pidstr = '0' + (pid % 10); + pid /= 10; + } while (pid > 0); + + /* "%s[%d]\t%s\t%s\n" */ + size = strlcpy(darwintrace_buf, procname ? procname : darwintrace_progname, sizeof(darwintrace_buf)); + size = strlcat(darwintrace_buf, "[", sizeof(darwintrace_buf)); + size = strlcat(darwintrace_buf, pidstr, sizeof(darwintrace_buf)); + size = strlcat(darwintrace_buf, "]\t", sizeof(darwintrace_buf)); + size = strlcat(darwintrace_buf, tag, sizeof(darwintrace_buf)); + size = strlcat(darwintrace_buf, "\t", sizeof(darwintrace_buf)); + size = strlcat(darwintrace_buf, path, sizeof(darwintrace_buf)); + size = strlcat(darwintrace_buf, "\n", sizeof(darwintrace_buf)); + write(fd, darwintrace_buf, size); } /* remap resource fork access to the data fork. * do a partial realpath(3) to fix "foo//bar" to "foo/bar" */ static inline void darwintrace_cleanup_path(char *path) { - size_t pathlen, rsrclen; - size_t i, shiftamount; - enum { SAWSLASH, NOTHING } state = NOTHING; - - /* if this is a foo/..namedfork/rsrc, strip it off */ - pathlen = strlen(path); - rsrclen = strlen(_PATH_RSRCFORKSPEC); - if(pathlen > rsrclen - && 0 == strncmp(path + pathlen - rsrclen, - _PATH_RSRCFORKSPEC, rsrclen)) { - path[pathlen - rsrclen] = '\0'; - pathlen -= rsrclen; - } - - /* for each position in string (including - terminal \0), check if we're in a run of - multiple slashes, and only emit the - first one - */ - for(i=0, shiftamount=0; i <= pathlen; i++) { - if(state == SAWSLASH) { - if(path[i] == '/') { - /* consume it */ - shiftamount++; - } else { - state = NOTHING; - path[i - shiftamount] = path[i]; - } - } else { - if(path[i] == '/') { - state = SAWSLASH; - } - path[i - shiftamount] = path[i]; - } - } - - dprintf("darwintrace: cleanup resulted in %s\n", path); + size_t pathlen, rsrclen; + size_t i, shiftamount; + enum { SAWSLASH, NOTHING } state = NOTHING; + + /* if this is a foo/..namedfork/rsrc, strip it off */ + pathlen = strlen(path); + rsrclen = strlen(_PATH_RSRCFORKSPEC); + if(pathlen > rsrclen + && 0 == strncmp(path + pathlen - rsrclen, + _PATH_RSRCFORKSPEC, rsrclen)) { + path[pathlen - rsrclen] = '\0'; + pathlen -= rsrclen; + } + + /* for each position in string (including + terminal \0), check if we're in a run of + multiple slashes, and only emit the + first one + */ + for(i=0, shiftamount=0; i <= pathlen; i++) { + if(state == SAWSLASH) { + if(path[i] == '/') { + /* consume it */ + shiftamount++; + } else { + state = NOTHING; + path[i - shiftamount] = path[i]; + } + } else { + if(path[i] == '/') { + state = SAWSLASH; + } + path[i - shiftamount] = path[i]; + } + } + + dprintf("darwintrace: cleanup resulted in %s\n", path); } /* - Only logs files where the open succeeds. - Only logs files opened for read access, without the O_CREAT flag set. - The assumption is that any file that can be created isn't necessary - to build the project. -*/ + Only logs files where the open succeeds. + Only logs files opened for read access, without the O_CREAT flag set. + The assumption is that any file that can be created isn't necessary + to build the project. + */ int darwintrace_open(const char* path, int flags, ...) { mode_t mode; int result; @@ -322,41 +316,41 @@ int darwintrace_open(const char* path, int flags, ...) { va_end(args); result = open(redirpath, flags, mode); if (result >= 0 && (flags & (O_CREAT | O_WRONLY)) == 0 ) { - darwintrace_setup(); - if (darwintrace_fd >= 0) { - char realpath[MAXPATHLEN]; + darwintrace_setup(); + if (darwintrace_fd >= 0) { + char realpath[MAXPATHLEN]; #if DARWINTRACE_LOG_FULL_PATH - int usegetpath = 1; + int usegetpath = 1; #else - int usegetpath = 0; + int usegetpath = 0; #endif - dprintf("darwintrace: original open path is %s\n", redirpath); - - /* for volfs paths, we need to do a GETPATH anyway */ - if(!usegetpath && strncmp(redirpath, "/.vol/", 6) == 0) { - usegetpath = 1; - } - - if(usegetpath) { - if(0 == fcntl(result, F_GETPATH, realpath)) { - dprintf("darwintrace: resolved %s to %s\n", redirpath, realpath); - } else { - /* use original path */ - dprintf("darwintrace: failed to resolve %s\n", redirpath); - if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { - dprintf("darwintrace: in open: original path too long to copy: %s\n", redirpath); - } - } - } else { - if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { - dprintf("darwintrace: in open (without getpath): path too long to copy: %s\n", redirpath); - } - } - - darwintrace_cleanup_path(realpath); - darwintrace_logpath(darwintrace_fd, NULL, "open", realpath); - } + dprintf("darwintrace: original open path is %s\n", redirpath); + + /* for volfs paths, we need to do a GETPATH anyway */ + if(!usegetpath && strncmp(redirpath, "/.vol/", 6) == 0) { + usegetpath = 1; + } + + if(usegetpath) { + if(0 == fcntl(result, F_GETPATH, realpath)) { + dprintf("darwintrace: resolved %s to %s\n", redirpath, realpath); + } else { + /* use original path */ + dprintf("darwintrace: failed to resolve %s\n", redirpath); + if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { + dprintf("darwintrace: in open: original path too long to copy: %s\n", redirpath); + } + } + } else { + if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { + dprintf("darwintrace: in open (without getpath): path too long to copy: %s\n", redirpath); + } + } + + darwintrace_cleanup_path(realpath); + darwintrace_logpath(darwintrace_fd, NULL, "open", realpath); + } } darwintrace_free_path(redirpath, path); @@ -370,247 +364,247 @@ DARWINTRACE_INTERPOSE(darwintrace_open, __open_nocancel); /* - Only logs files where the readlink succeeds. -*/ + Only logs files where the readlink succeeds. + */ ssize_t darwintrace_readlink(const char * path, char * buf, size_t bufsiz) { ssize_t result; char* redirpath = darwintrace_redirect_path(path); result = readlink(redirpath, buf, bufsiz); if (result >= 0) { - darwintrace_setup(); - if (darwintrace_fd >= 0) { - char realpath[MAXPATHLEN]; - - dprintf("darwintrace: original readlink path is %s\n", redirpath); - - if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { - dprintf("darwintrace: in readlink: path too long to copy: %s\n", redirpath); - } - - darwintrace_cleanup_path(realpath); - darwintrace_logpath(darwintrace_fd, NULL, "readlink", realpath); - } + darwintrace_setup(); + if (darwintrace_fd >= 0) { + char realpath[MAXPATHLEN]; + + dprintf("darwintrace: original readlink path is %s\n", redirpath); + + if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { + dprintf("darwintrace: in readlink: path too long to copy: %s\n", redirpath); + } + + darwintrace_cleanup_path(realpath); + darwintrace_logpath(darwintrace_fd, NULL, "readlink", realpath); + } } - + darwintrace_free_path(redirpath, path); return result; } DARWINTRACE_INTERPOSE(darwintrace_readlink, readlink); static inline int has_prefix(const char *s, const char *p) { - return (strncmp(s, p, strlen(p)) == 0); + return (strncmp(s, p, strlen(p)) == 0); } /* force the values of several environment variables */ static char *const *darwintrace_make_environ(char *const envp[]) { - static const char *DARWINTRACE_IGNORE_ROOTS = "DARWINTRACE_IGNORE_ROOTS="; - static const char *DYLD_INSERT_LIBRARIES = "DYLD_INSERT_LIBRARIES="; - static const char *DARWINTRACE_LOG = "DARWINTRACE_LOG="; - static const char *DARWINTRACE_PLACEHOLDER = "__DARWINTRACE_PLACEHOLDER=UNUSED"; - - char **result = NULL; - char *libs = NULL; - int count = 0; - - /* count the environment variables */ - if (envp) { - while (envp[count] != NULL) { - if (has_prefix(envp[count], DYLD_INSERT_LIBRARIES)) { - libs = envp[count] + strlen(DYLD_INSERT_LIBRARIES); - } - ++count; - } - } - - /* allocate size of envp with enough space for three more values and NULL */ - result = (char **)calloc(count + 4, sizeof(char *)); - if (result != NULL) { - int i = 0; - - if (darwintrace_log_path) { - asprintf(&result[i], "%s%s", DARWINTRACE_LOG, darwintrace_log_path); - } else { - result[i] = strdup(DARWINTRACE_PLACEHOLDER); - } - ++i; - - if (darwintrace_ignores) { - asprintf(&result[i], "%s%s", DARWINTRACE_IGNORE_ROOTS, "1"); - } else { - result[i] = strdup(DARWINTRACE_PLACEHOLDER); - } - ++i; - - if (darwintrace_dylib_path) { - if (libs && strstr(libs, darwintrace_dylib_path)) { - /* inserted libraries already contain dylib */ - asprintf(&result[i], "%s%s", - DYLD_INSERT_LIBRARIES, libs); - } else { - /* otherwise set or insert the dylib path */ - asprintf(&result[i], "%s%s%s%s", - DYLD_INSERT_LIBRARIES, darwintrace_dylib_path, - libs ? ":" : "", libs ? libs : ""); - } - } else { - result[i] = strdup(DARWINTRACE_PLACEHOLDER); - } - ++i; - - if (envp) { - memcpy(&result[i], envp, count * sizeof(char *)); - } - - while (result[i] != NULL) { - if (has_prefix(result[i], DARWINTRACE_IGNORE_ROOTS) || - has_prefix(result[i], DYLD_INSERT_LIBRARIES) || - has_prefix(result[i], DARWINTRACE_LOG)) { - result[i] = (char *)DARWINTRACE_PLACEHOLDER; - } - ++i; - } - } - - return result; + static const char *DARWINTRACE_IGNORE_ROOTS = "DARWINTRACE_IGNORE_ROOTS="; + static const char *DYLD_INSERT_LIBRARIES = "DYLD_INSERT_LIBRARIES="; + static const char *DARWINTRACE_LOG = "DARWINTRACE_LOG="; + static const char *DARWINTRACE_PLACEHOLDER = "__DARWINTRACE_PLACEHOLDER=UNUSED"; + + char **result = NULL; + char *libs = NULL; + int count = 0; + + /* count the environment variables */ + if (envp) { + while (envp[count] != NULL) { + if (has_prefix(envp[count], DYLD_INSERT_LIBRARIES)) { + libs = envp[count] + strlen(DYLD_INSERT_LIBRARIES); + } + ++count; + } + } + + /* allocate size of envp with enough space for three more values and NULL */ + result = (char **)calloc(count + 4, sizeof(char *)); + if (result != NULL) { + int i = 0; + + if (darwintrace_log_path) { + asprintf(&result[i], "%s%s", DARWINTRACE_LOG, darwintrace_log_path); + } else { + result[i] = strdup(DARWINTRACE_PLACEHOLDER); + } + ++i; + + if (darwintrace_ignores) { + asprintf(&result[i], "%s%s", DARWINTRACE_IGNORE_ROOTS, "1"); + } else { + result[i] = strdup(DARWINTRACE_PLACEHOLDER); + } + ++i; + + if (darwintrace_dylib_path) { + if (libs && strstr(libs, darwintrace_dylib_path)) { + /* inserted libraries already contain dylib */ + asprintf(&result[i], "%s%s", + DYLD_INSERT_LIBRARIES, libs); + } else { + /* otherwise set or insert the dylib path */ + asprintf(&result[i], "%s%s%s%s", + DYLD_INSERT_LIBRARIES, darwintrace_dylib_path, + libs ? ":" : "", libs ? libs : ""); + } + } else { + result[i] = strdup(DARWINTRACE_PLACEHOLDER); + } + ++i; + + if (envp) { + memcpy(&result[i], envp, count * sizeof(char *)); + } + + while (result[i] != NULL) { + if (has_prefix(result[i], DARWINTRACE_IGNORE_ROOTS) || + has_prefix(result[i], DYLD_INSERT_LIBRARIES) || + has_prefix(result[i], DARWINTRACE_LOG)) { + result[i] = (char *)DARWINTRACE_PLACEHOLDER; + } + ++i; + } + } + + return result; } static void darwintrace_free_environ(char *const envp[]) { - free(envp[0]); - free(envp[1]); - free(envp[2]); - free((char*)envp); + free(envp[0]); + free(envp[1]); + free(envp[2]); + free((char*)envp); } static void darwintrace_log_exec(const char* redirpath, char* const argv[]) { darwintrace_setup(); if (darwintrace_fd >= 0) { - struct stat sb; - char realpath[MAXPATHLEN]; - int printorig = 0; - int printreal = 0; - int fd; + struct stat sb; + char realpath[MAXPATHLEN]; + int printorig = 0; + int printreal = 0; + int fd; #if DARWINTRACE_LOG_FULL_PATH - int usegetpath = 1; + int usegetpath = 1; #else - int usegetpath = 0; + int usegetpath = 0; #endif - dprintf("darwintrace: original execve path is %s\n", redirpath); - - /* for symlinks, we wan't to capture - * both the original path and the modified one, - * since for /usr/bin/gcc -> gcc-4.0, - * both "gcc_select" and "gcc" are contributors - */ - if (lstat(redirpath, &sb) == 0) { - if(redirpath[0] != '/') { - /* for relative paths, only print full path */ - printreal = 1; - printorig = 0; - } else if(S_ISLNK(sb.st_mode)) { - /* for symlinks, print both */ - printreal = 1; - printorig = 1; - } else { - /* for fully qualified paths, print real */ - printreal = 1; - printorig = 0; - } - - if(printorig) { - if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { - dprintf("darwintrace: in execve: path too long to copy: %s\n", redirpath); - } - - darwintrace_cleanup_path(realpath); - darwintrace_logpath(darwintrace_fd, NULL, "execve", realpath); - } - - fd = open(redirpath, O_RDONLY, 0); - if (fd != -1) { - - char buffer[MAXPATHLEN]; - ssize_t bytes_read; - - /* once we have an open fd, if a full path was requested, do it */ - if(printreal) { - - if(usegetpath) { - if(0 == fcntl(fd, F_GETPATH, realpath)) { - dprintf("darwintrace: resolved execve path %s to %s\n", redirpath, realpath); - } else { - dprintf("darwintrace: failed to resolve %s\n", redirpath); - if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { - dprintf("darwintrace: in execve: original path too long to copy: %s\n", redirpath); - } - } - } else { - if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { - dprintf("darwintrace: in execve (without getpath): path too long to copy: %s\n", redirpath); - } - } - - darwintrace_cleanup_path(realpath); - darwintrace_logpath(darwintrace_fd, NULL, "execve", realpath); - } - - bzero(buffer, sizeof(buffer)); - - bytes_read = read(fd, buffer, MAXPATHLEN); - if (bytes_read > 2 && - buffer[0] == '#' && buffer[1] == '!') { - char* interp = &buffer[2]; - int i; - /* skip past leading whitespace */ - for (i = 2; i < bytes_read; ++i) { - if (buffer[i] != ' ' && buffer[i] != '\t') { - interp = &buffer[i]; - break; - } - } - /* found interpreter (or ran out of data) - skip until next whitespace, then terminate the string */ - for (; i < bytes_read; ++i) { - if (buffer[i] == ' ' || buffer[i] == '\t' || buffer[i] == '\n') { - buffer[i] = 0; - break; - } - } - /* we have liftoff */ - if (interp && interp[0] != '\0') { - const char* procname = NULL; - - /* look for slash to get the basename */ - procname = strrchr(argv[0], '/'); - if (procname == NULL) { - /* no slash found, so assume whole string is basename */ - procname = argv[0]; - } else { - /* advance pointer to just after slash */ - procname++; - } - - darwintrace_cleanup_path(interp); - darwintrace_logpath(darwintrace_fd, procname, "execve", interp); - } - } - - close(fd); - } - } + dprintf("darwintrace: original execve path is %s\n", redirpath); + + /* for symlinks, we wan't to capture + * both the original path and the modified one, + * since for /usr/bin/gcc -> gcc-4.0, + * both "gcc_select" and "gcc" are contributors + */ + if (lstat(redirpath, &sb) == 0) { + if(redirpath[0] != '/') { + /* for relative paths, only print full path */ + printreal = 1; + printorig = 0; + } else if(S_ISLNK(sb.st_mode)) { + /* for symlinks, print both */ + printreal = 1; + printorig = 1; + } else { + /* for fully qualified paths, print real */ + printreal = 1; + printorig = 0; + } + + if(printorig) { + if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { + dprintf("darwintrace: in execve: path too long to copy: %s\n", redirpath); + } + + darwintrace_cleanup_path(realpath); + darwintrace_logpath(darwintrace_fd, NULL, "execve", realpath); + } + + fd = open(redirpath, O_RDONLY, 0); + if (fd != -1) { + + char buffer[MAXPATHLEN]; + ssize_t bytes_read; + + /* once we have an open fd, if a full path was requested, do it */ + if(printreal) { + + if(usegetpath) { + if(0 == fcntl(fd, F_GETPATH, realpath)) { + dprintf("darwintrace: resolved execve path %s to %s\n", redirpath, realpath); + } else { + dprintf("darwintrace: failed to resolve %s\n", redirpath); + if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { + dprintf("darwintrace: in execve: original path too long to copy: %s\n", redirpath); + } + } + } else { + if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) { + dprintf("darwintrace: in execve (without getpath): path too long to copy: %s\n", redirpath); + } + } + + darwintrace_cleanup_path(realpath); + darwintrace_logpath(darwintrace_fd, NULL, "execve", realpath); + } + + bzero(buffer, sizeof(buffer)); + + bytes_read = read(fd, buffer, MAXPATHLEN); + if (bytes_read > 2 && + buffer[0] == '#' && buffer[1] == '!') { + char* interp = &buffer[2]; + int i; + /* skip past leading whitespace */ + for (i = 2; i < bytes_read; ++i) { + if (buffer[i] != ' ' && buffer[i] != '\t') { + interp = &buffer[i]; + break; + } + } + /* found interpreter (or ran out of data) + skip until next whitespace, then terminate the string */ + for (; i < bytes_read; ++i) { + if (buffer[i] == ' ' || buffer[i] == '\t' || buffer[i] == '\n') { + buffer[i] = 0; + break; + } + } + /* we have liftoff */ + if (interp && interp[0] != '\0') { + const char* procname = NULL; + + /* look for slash to get the basename */ + procname = strrchr(argv[0], '/'); + if (procname == NULL) { + /* no slash found, so assume whole string is basename */ + procname = argv[0]; + } else { + /* advance pointer to just after slash */ + procname++; + } + + darwintrace_cleanup_path(interp); + darwintrace_logpath(darwintrace_fd, procname, "execve", interp); + } + } + + close(fd); + } + } } } int darwintrace_execve(const char* path, char* const argv[], char* const envp[]) { - int result; - char* redirpath = darwintrace_redirect_path(path); - darwintrace_log_exec(redirpath, argv); - char *const *new_envp = darwintrace_make_environ(envp); - result = execve(redirpath, argv, new_envp); - darwintrace_free_environ(new_envp); - darwintrace_free_path(redirpath, path); - return result; + int result; + char* redirpath = darwintrace_redirect_path(path); + darwintrace_log_exec(redirpath, argv); + char *const *new_envp = darwintrace_make_environ(envp); + result = execve(redirpath, argv, new_envp); + darwintrace_free_environ(new_envp); + darwintrace_free_path(redirpath, path); + return result; } DARWINTRACE_INTERPOSE(darwintrace_execve, execve); @@ -618,37 +612,37 @@ DARWINTRACE_INTERPOSE(darwintrace_execve, execve); /* weak import __posix_spawn which only exists on 10.7 or later */ extern __attribute__((weak_import)) int __posix_spawn(pid_t * __restrict, const char * __restrict, - void *, - char *const argv[ __restrict], char *const envp[ __restrict]); + void *, + char *const argv[ __restrict], char *const envp[ __restrict]); int darwintrace_posix_spawn(pid_t * __restrict pid, - const char * __restrict path, - void * __restrict desc, - char *const argv[__restrict], - char *const envp[__restrict]) { - int result; - char* redirpath = darwintrace_redirect_path(path); - darwintrace_log_exec(redirpath, argv); - char *const *new_envp = darwintrace_make_environ(envp); - result = __posix_spawn(pid, redirpath, desc, argv, new_envp); - darwintrace_free_environ(new_envp); - darwintrace_free_path(redirpath, path); - return result; + const char * __restrict path, + void * __restrict desc, + char *const argv[__restrict], + char *const envp[__restrict]) { + int result; + char* redirpath = darwintrace_redirect_path(path); + darwintrace_log_exec(redirpath, argv); + char *const *new_envp = darwintrace_make_environ(envp); + result = __posix_spawn(pid, redirpath, desc, argv, new_envp); + darwintrace_free_environ(new_envp); + darwintrace_free_path(redirpath, path); + return result; } DARWINTRACE_INTERPOSE(darwintrace_posix_spawn, __posix_spawn); #endif /* - if darwintrace has been initialized, trap - attempts to close our file descriptor -*/ + if darwintrace has been initialized, trap + attempts to close our file descriptor + */ int darwintrace_close(int fd) { - if(darwintrace_fd != -2 && fd == darwintrace_fd) { - errno = EBADF; - return -1; - } + if(darwintrace_fd != -2 && fd == darwintrace_fd) { + errno = EBADF; + return -1; + } - return close(fd); + return close(fd); } DARWINTRACE_INTERPOSE(darwintrace_close, close); #if LION_OR_LATER diff --git a/darwinup/Archive.cpp b/darwinup/Archive.cpp deleted file mode 100644 index 718cc30..0000000 --- a/darwinup/Archive.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (c) 2005-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 "Archive.h" -#include "Depot.h" -#include "File.h" -#include "Utils.h" - -#include -#include -#include -#include -#include -#include - -#if TARGET_OS_EMBEDDED -# define COMPACT_SUFFIX ".tar" -# define COMPACT_COMPRESSION "" -#else -# define COMPACT_SUFFIX ".tar.bz2" -# define COMPACT_COMPRESSION "j" -#endif - -extern char** environ; - -Archive::Archive(const char* path) { - m_serial = 0; - uuid_generate_random(m_uuid); - m_path = strdup(path); - m_name = strdup(basename(m_path)); - m_info = 0; - m_date_installed = time(NULL); - m_is_superseded = -1; // unknown -} - -Archive::Archive(uint64_t serial, uuid_t uuid, const char* name, const char* path, - uint64_t info, time_t date_installed, const char* build) { - m_serial = serial; - uuid_copy(m_uuid, uuid); - m_name = name ? strdup(name) : NULL; - m_path = path ? strdup(path) : NULL; - m_build = build ? strdup(build) : NULL; - m_info = info; - m_date_installed = date_installed; - m_is_superseded = -1; // unknown -} - - -Archive::~Archive() { - if (m_path) free(m_path); - if (m_name) free(m_name); - if (m_build) free(m_build); -} - -uint64_t Archive::serial() { return m_serial; } -uint8_t* Archive::uuid() { return m_uuid; } -const char* Archive::name() { return m_name; } -const char* Archive::path() { return m_path; } -const char* Archive::build() { return m_build; } -uint64_t Archive::info() { return m_info; } -time_t Archive::date_installed() { return m_date_installed; } - -char* Archive::directory_name(const char* prefix) { - char* path = NULL; - char uuidstr[37]; - uuid_unparse_upper(m_uuid, uuidstr); - asprintf(&path, "%s/%s", prefix, uuidstr); - if (path == NULL) { - fprintf(stderr, "%s:%d: out of memory\n", __FILE__, __LINE__); - } - return path; -} - -char* Archive::create_directory(const char* prefix) { - int res = 0; - char* path = this->directory_name(prefix); - if (path && res == 0) res = mkdir(path, 0777); - if (res != 0) { - fprintf(stderr, "%s:%d: could not create directory: %s: %s (%d)\n", __FILE__, __LINE__, path, strerror(errno), errno); - free(path); - path = NULL; - } - if (res == 0) res = chown(path, 0, 0); - return path; -} - -int Archive::compact_directory(const char* prefix) { - int res = 0; - char* tarpath = NULL; - char uuidstr[37]; - uuid_unparse_upper(m_uuid, uuidstr); - asprintf(&tarpath, "%s/%s" COMPACT_SUFFIX, prefix, uuidstr); - if (tarpath) { - const char* args[] = { - "/usr/bin/tar", - "cf" COMPACT_COMPRESSION, tarpath, - "-C", prefix, - uuidstr, - NULL - }; - res = exec_with_args(args); - free(tarpath); - } else { - fprintf(stderr, "%s:%d: out of memory\n", __FILE__, __LINE__); - res = -1; - } - return res; -} - -int Archive::expand_directory(const char* prefix) { - int res = 0; - char* tarpath = NULL; - char uuidstr[37]; - uuid_unparse_upper(m_uuid, uuidstr); - asprintf(&tarpath, "%s/%s" COMPACT_SUFFIX, prefix, uuidstr); - if (tarpath) { - const char* args[] = { - "/usr/bin/tar", - "xf" COMPACT_COMPRESSION, tarpath, - "-C", prefix, - "-p", // --preserve-permissions - NULL - }; - res = exec_with_args(args); - free(tarpath); - } else { - fprintf(stderr, "%s:%d: out of memory\n", __FILE__, __LINE__); - res = -1; - } - return res; -} - -int Archive::prune_compacted_archive(const char* prefix) { - int res = 0; - char* tarpath = NULL; - char uuidstr[37]; - uuid_unparse_upper(m_uuid, uuidstr); - asprintf(&tarpath, "%s/%s" COMPACT_SUFFIX, prefix, uuidstr); - if (tarpath) { - res = unlink(tarpath); - if (res) perror(tarpath); - free(tarpath); - } - return res; -} - -int Archive::extract(const char* destdir) { - // not implemented - return -1; -} - - - -RollbackArchive::RollbackArchive() : Archive("") { - m_info = ARCHIVE_INFO_ROLLBACK; -} - - - -DittoArchive::DittoArchive(const char* path) : Archive(path) {} - -int DittoArchive::extract(const char* destdir) { - const char* args[] = { - "/usr/bin/ditto", - m_path, destdir, - NULL - }; - return exec_with_args(args); -} - - -DittoXArchive::DittoXArchive(const char* path) : Archive(path) {} - -int DittoXArchive::extract(const char* destdir) { - const char* args[] = { - "/usr/bin/ditto", - "-x", m_path, - destdir, - NULL - }; - return exec_with_args(args); -} - -CpioArchive::CpioArchive(const char* path) : DittoXArchive(path) {} - -CpioGZArchive::CpioGZArchive(const char* path) : DittoXArchive(path) {} - -CpioBZ2Archive::CpioBZ2Archive(const char* path) : DittoXArchive(path) {} - -PaxArchive::PaxArchive(const char* path) : DittoXArchive(path) {} - -PaxGZArchive::PaxGZArchive(const char* path) : DittoXArchive(path) {} - -PaxBZ2Archive::PaxBZ2Archive(const char* path) : DittoXArchive(path) {} - - -TarArchive::TarArchive(const char* path) : Archive(path) {} - -int TarArchive::extract(const char* destdir) { - const char* args[] = { - "/usr/bin/tar", - "xf", m_path, - "-C", destdir, - NULL - }; - return exec_with_args(args); -} - - -TarGZArchive::TarGZArchive(const char* path) : Archive(path) {} - -int TarGZArchive::extract(const char* destdir) { - const char* args[] = { - "/usr/bin/tar", - "xzf", m_path, - "-C", destdir, - NULL - }; - return exec_with_args(args); -} - - -TarBZ2Archive::TarBZ2Archive(const char* path) : Archive(path) {} - -int TarBZ2Archive::extract(const char* destdir) { - const char* args[] = { - "/usr/bin/tar", - "xjf", m_path, - "-C", destdir, - NULL - }; - return exec_with_args(args); -} - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 -XarArchive::XarArchive(const char* path) : Archive(path) {} - -int XarArchive::extract(const char* destdir) { - const char* args[] = { - "/usr/bin/xar", - "-xf", m_path, - "-C", destdir, - NULL - }; - return exec_with_args(args); -} -#endif - -ZipArchive::ZipArchive(const char* path) : Archive(path) {} - -int ZipArchive::extract(const char* destdir) { - const char* args[] = { - "/usr/bin/ditto", - "-xk", m_path, - destdir, - NULL - }; - return exec_with_args(args); -} - - -Archive* ArchiveFactory(const char* path, const char* tmppath) { - Archive* archive = NULL; - - // actual path to archive - char* actpath = NULL; - - // fetch remote archives if needed - if (is_url_path(path)) { - actpath = fetch_url(path, tmppath); - if (!actpath) { - fprintf(stderr, "Error: could not fetch remote URL: %s \n", path); - return NULL; - } - } else if (is_userhost_path(path)) { - IF_DEBUG("fetching userhost path from: %s to: %s \n", path, tmppath); - actpath = fetch_userhost(path, tmppath); - IF_DEBUG("fetched %s \n", actpath); - if (!actpath) { - fprintf(stderr, "Error: could not fetch remote file from: %s \n", path); - return NULL; - } - } else { - actpath = (char *)path; - } - - // make sure the archive exists - struct stat sb; - int res = stat(actpath, &sb); - if (res == -1 && errno == ENOENT) { - return NULL; - } - - // use file extension to guess archive format - if (is_directory(actpath, true)) { - archive = new DittoArchive(actpath); - } else if (has_suffix(actpath, ".cpio")) { - archive = new CpioArchive(actpath); - } else if (has_suffix(actpath, ".cpio.gz") || has_suffix(actpath, ".cpgz")) { - archive = new CpioGZArchive(actpath); - } else if (has_suffix(actpath, ".cpio.bz2") || has_suffix(actpath, ".cpbz2")) { - archive = new CpioBZ2Archive(actpath); - } else if (has_suffix(actpath, ".pax")) { - archive = new PaxArchive(actpath); - } else if (has_suffix(actpath, ".pax.gz") || has_suffix(actpath, ".pgz")) { - archive = new PaxGZArchive(actpath); - } else if (has_suffix(actpath, ".pax.bz2") || has_suffix(actpath, ".pbz2")) { - archive = new PaxBZ2Archive(actpath); - } else if (has_suffix(actpath, ".tar")) { - archive = new TarArchive(actpath); - } else if (has_suffix(actpath, ".tar.gz") || has_suffix(actpath, ".tgz")) { - archive = new TarGZArchive(actpath); - } else if (has_suffix(actpath, ".tar.bz2") - || has_suffix(actpath, ".tbz2") - || has_suffix(actpath, ".tbz")) { - archive = new TarBZ2Archive(actpath); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - } else if (has_suffix(actpath, ".xar")) { - archive = new XarArchive(actpath); -#endif - } else if (has_suffix(actpath, ".zip")) { - archive = new ZipArchive(actpath); - } else { - fprintf(stderr, "Error: unknown archive type: %s\n", path); - } - - if (actpath && actpath != path) free(actpath); - return archive; -} diff --git a/darwinup/Archive.h b/darwinup/Archive.h deleted file mode 100644 index 229b47c..0000000 --- a/darwinup/Archive.h +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (c) 2005-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@ - */ - -#ifndef _ARCHIVE_H -#define _ARCHIVE_H - -#include -#include -#include -#include -#include -#include -#include - -typedef char* archive_name_t; - -enum archive_keyword_t { - DEPOT_ARCHIVE_NEWEST, - DEPOT_ARCHIVE_OLDEST -}; - - -// -// ARCHIVE_INFO flags stored in the database -// -const uint64_t ARCHIVE_INFO_ROLLBACK = 0x0001; - -struct Archive; -struct Depot; - -//// -// Archive -// -// Archive is the root class of all archive formats -// supported by darwinup. -// -// Conceptually it's an abstract class, although that -// hasn't been formalized. -// -// ArchiveFactory exists to return the correct -// concrete subclass for a given archive to be -// installed. Currently this is determined -// by the file's suffix. The tmppath parameter -// is the path where files can be stored during -// processing, such as fetching remote archives. -//// - -Archive* ArchiveFactory(const char* path, const char* tmppath); - -struct Archive { - Archive(const char* path); - virtual ~Archive(); - - //// - // Public Accessor functions - //// - - // Unique serial number for the archive (used by database). - virtual uint64_t serial(); - - // Universally unique identifier for the archive. - virtual uint8_t* uuid(); - - // The name of the archive as it was installed. - // Determined by basename(3). - // Do not modify or free(3). - virtual const char* name(); - - // The path to the archive as it was installed. - // Do not modify or free(3). - virtual const char* path(); - - // the OS build this archive was installed onto - virtual const char* build(); - - // ARCHIVE_INFO flags. - virtual uint64_t info(); - - // The epoch seconds when the archive was installed. - virtual time_t date_installed(); - - - //// - // Member functions - //// - - // Extracts the archive into the specified destination. - // Not implemented for Archive, expected to be implemented - // by concrete subclasses. - virtual int extract(const char* destdir); - - // Returns the backing-store directory name for the archive. - // This is prefix/uuid. - // The result should be released with free(3). - char* directory_name(const char* prefix); - - // Creates the backing-store directory for the archive. - // Same directory name as returned by directory_name(). - char* create_directory(const char* prefix); - - // Compacts the backing-store directory into a single file. - int compact_directory(const char* prefix); - - // Expands the backing-store directory from its single file. - int expand_directory(const char* prefix); - - // Removes the compacted backing-store file from disk. - int prune_compacted_archive(const char* prefix); - - protected: - - // Constructor for subclasses and Depot to use when - // unserializing an archive from the database. - Archive(uint64_t serial, uuid_t uuid, const char* name, const char* path, - uint64_t info, time_t date_installed, const char* build); - - uint64_t m_serial; - uuid_t m_uuid; - char* m_name; - char* m_path; - char* m_build; - uint64_t m_info; - time_t m_date_installed; - - // -1 unknown, 0 false, 1 true - int m_is_superseded; - - friend struct Depot; - friend struct DarwinupDatabase; -}; - - -//// -// RollbackArchive -// -// Not a file format. RollbackArchive is an internal representation -// of archives that are created to store the user-data that darwinup -// archives as part of installation. -//// -struct RollbackArchive : public Archive { - RollbackArchive(); -}; - - -//// -// DittoArchive -// -// Not a file format, but this allows a directory tree to be installed -// using the ditto(1) command line tool. This is useful for installing -// Darwin roots built with DarwinBuild. -//// -struct DittoArchive : public Archive { - DittoArchive(const char* path); - virtual int extract(const char* destdir); -}; - - -//// -// DittoXArchive -// -// Handles any file that `ditto -x` can handle. Intended to be the parent -// of suffix-specific archive objects. -//// -struct DittoXArchive : public Archive { - DittoXArchive(const char* path); - virtual int extract(const char* destdir); -}; - - -//// -// CpioArchive -// -// Corresponds to the cpio(1) file format. -// This installs archives using the ditto(1) command line tool with -// the -x option. -//// -struct CpioArchive : public DittoXArchive { - CpioArchive(const char* path); -}; - -//// -// CpioGZArchive -// -// Corresponds to the cpio(1) file format, compressed with gzip(1). -// This installs archives using the ditto(1) command line tool with -// the -x option. -//// -struct CpioGZArchive : public DittoXArchive { - CpioGZArchive(const char* path); -}; - -//// -// CpioBZ2Archive -// -// Corresponds to the cpio(1) file format, compressed with bzip2(1). -// This installs archives using the ditto(1) command line tool with -// the -x option. -//// -struct CpioBZ2Archive : public DittoXArchive { - CpioBZ2Archive(const char* path); -}; - - -//// -// PaxArchive -// -// Corresponds to the pax(1) file format. -// This installs archives using the ditto(1) command line tool with -// the -x option. -//// -struct PaxArchive : public DittoXArchive { - PaxArchive(const char* path); -}; - - -//// -// PaxGZArchive -// -// Corresponds to the pax(1) file format, compressed with gzip(1). -// This installs archives using the ditto(1) command line tool with -// the -x option. -//// -struct PaxGZArchive : public DittoXArchive { - PaxGZArchive(const char* path); -}; - - -//// -// PaxBZ2Archive -// -// Corresponds to the pax(1) file format, compressed with bzip2(1). -// This installs archives using the ditto(1) command line tool with -// the -x option. -//// -struct PaxBZ2Archive : public DittoXArchive { - PaxBZ2Archive(const char* path); -}; - - -//// -// TarArchive -// -// Corresponds to the tar(1) file format. This handles uncompressed tar -// archives by using the tar(1) command line tool. -//// -struct TarArchive : public Archive { - TarArchive(const char* path); - virtual int extract(const char* destdir); -}; - - -//// -// TarGZArchive -// -// Corresponds to the tar(1) file format, compressed with gzip(1). -// This installs archives using the tar(1) command line tool with -// the -z option. -//// -struct TarGZArchive : public Archive { - TarGZArchive(const char* path); - virtual int extract(const char* destdir); -}; - - -//// -// TarBZ2Archive -// -// Corresponds to the tar(1) file format, compressed with bzip2(1). -// This installs archives using the tar(1) command line tool with -// the -j option. -//// -struct TarBZ2Archive : public Archive { - TarBZ2Archive(const char* path); - virtual int extract(const char* destdir); -}; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 -//// -// XarArchive -// -// Corresponds to the xar(1) file format. This handles uncompressed cpio -// archives by using the xar(1) command line tool. -//// -struct XarArchive : public Archive { - XarArchive(const char* path); - virtual int extract(const char* destdir); -}; -#endif - -//// -// ZipArchive -// -// Corresponds to a zip archive. We use the -k option to ditto(1) -// to handle it. -//// -struct ZipArchive : public Archive { - ZipArchive(const char* path); - virtual int extract(const char* destdir); -}; - -#endif - diff --git a/darwinup/Column.cpp b/darwinup/Column.cpp deleted file mode 100644 index 0decdbc..0000000 --- a/darwinup/Column.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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 -#include -#include - -#include "Column.h" - -Column::Column(const char* name, uint32_t type) { - m_name = strdup(name); - m_create_sql = NULL; - m_alter_sql = NULL; - m_type = type; - m_is_index = false; - m_is_pk = false; - m_is_unique = false; - m_version = 0; -} - -Column::Column(const char* name, uint32_t type, - bool is_index, bool is_pk, bool is_unique) { - m_name = strdup(name); - m_create_sql = NULL; - m_alter_sql = NULL; - m_type = type; - m_is_index = is_index; - m_is_pk = is_pk; - m_is_unique = is_unique; - m_version = 0; -} - -Column::~Column() { - free(m_name); - free(m_create_sql); - free(m_alter_sql); -} - -const char* Column::name() { - return m_name; -} - -uint32_t Column::type() { - return m_type; -} - -const bool Column::is_index() { - return m_is_index; -} - -const bool Column::is_pk() { - return m_is_pk; -} - -const bool Column::is_unique() { - return m_is_unique; -} - -uint32_t Column::version() { - return m_version; -} - -const char* Column::typestr() { - switch(m_type) { - case SQLITE_INTEGER: - return "INTEGER"; - break; - case SQLITE_TEXT: - return "TEXT"; - break; - case SQLITE_BLOB: - return "BLOB"; - break; - default: - fprintf(stderr, "Error: unknown column type: %d \n", m_type); - return "UNKNOWN"; - } -} - -uint32_t Column::size() { - // integers are stored inband in the record - if (m_type == SQLITE_INTEGER) return sizeof(uint64_t); - // everything else is stored out of band - return sizeof(void*); -} - -int Column::offset() { - return m_offset; -} - -const char* Column::create() { - if (!m_create_sql) { - asprintf(&m_create_sql, "%s %s%s%s", m_name, this->typestr(), - (this->is_pk() ? " PRIMARY KEY AUTOINCREMENT" : ""), - (this->is_unique() ? " UNIQUE" : "")); - } - return (const char*)m_create_sql; -} - -const char* Column::alter(const char* table_name) { - if (!m_alter_sql) { - asprintf(&m_alter_sql, "ALTER TABLE %s ADD COLUMN %s;", - table_name, this->create()); - } - return (const char*)m_alter_sql; -} - diff --git a/darwinup/Column.h b/darwinup/Column.h deleted file mode 100644 index 9b669bd..0000000 --- a/darwinup/Column.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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@ - */ - -#ifndef _COLUMN_H -#define _COLUMN_H - -#include -#include - -#include "Utils.h" - -/** - * Column objects represent a column in a database table. They store - * type information and chunks of sql for their Table to build - * queries with. - */ -struct Column { - Column(const char* name, uint32_t type); - Column(const char* name, uint32_t type, - bool is_index, bool is_pk, bool is_unique); - virtual ~Column(); - - const char* name(); - uint32_t type(); - const bool is_index(); - const bool is_pk(); - const bool is_unique(); - - uint32_t version(); - - // return size of this column when packed into a result record - uint32_t size(); - -protected: - // return a string representation of this columns type suitable - // for sql queries - const char* typestr(); - - // return the offset of this column in the Table's result record - int offset(); - - // generate the sql needed to create this column - const char* create(); - // generate alter table sql for this column for table named table_name - const char* alter(const char* table_name); - - char* m_name; - uint32_t m_version; // schema version this was added - char* m_create_sql; // sql fragment for use in CREATE TABLE - char* m_alter_sql; // entire ALTER TABLE ADD COLUMN sql - uint32_t m_type; // SQLITE_* type definition - bool m_is_index; - bool m_is_pk; - bool m_is_unique; - int m_offset; - - friend struct Table; -}; - -#endif diff --git a/darwinup/DB.cpp b/darwinup/DB.cpp deleted file mode 100644 index 5f466f2..0000000 --- a/darwinup/DB.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/* - * 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 "DB.h" - - -DarwinupDatabase::DarwinupDatabase(const char* path) : Database(path) { - this->connect(); - this->last_archive = NULL; -} - -DarwinupDatabase::~DarwinupDatabase() { - // parent automatically deallocates schema objects - - if (this->last_archive) delete this->last_archive; -} - -int DarwinupDatabase::init_schema() { - - - SCHEMA_VERSION(0); - - this->m_archives_table = new Table("archives"); - ADD_TABLE(this->m_archives_table); - ADD_PK(m_archives_table, "serial"); - ADD_INDEX(m_archives_table, "uuid", TYPE_BLOB, true); - ADD_TEXT(m_archives_table, "name"); - ADD_INTEGER(m_archives_table, "date_added"); - ADD_INTEGER(m_archives_table, "active"); - ADD_INTEGER(m_archives_table, "info"); - - - this->m_files_table = new Table("files"); - ADD_TABLE(this->m_files_table); - ADD_PK(m_files_table, "serial"); - ADD_INDEX(m_files_table, "archive", TYPE_INTEGER, false); - ADD_INTEGER(m_files_table, "info"); - ADD_INTEGER(m_files_table, "mode"); - ADD_INTEGER(m_files_table, "uid"); - ADD_INTEGER(m_files_table, "gid"); - ADD_INTEGER(m_files_table, "size"); - ADD_BLOB(m_files_table, "digest"); - ADD_INDEX(m_files_table, "path", TYPE_TEXT, false); - - // custom index to protect from duplicate files - assert(this->m_files_table->set_custom_create("CREATE UNIQUE INDEX files_archive_path " - "ON files (archive, path);") == 0); - - - SCHEMA_VERSION(1); - - ADD_TEXT(m_archives_table, "osbuild"); - - return 0; -} - -int DarwinupDatabase::activate_archive(uint64_t serial) { - uint64_t active = 1; - return this->set_archive_active(serial, &active); -} - -int DarwinupDatabase::deactivate_archive(uint64_t serial) { - uint64_t active = 0; - return this->set_archive_active(serial, &active); -} - -int DarwinupDatabase::set_archive_active(uint64_t serial, uint64_t* active) { - this->clear_last_archive(); - return this->update_value("activate_archive", - this->m_archives_table, - this->m_archives_table->column(4), // active - (void**)active, - 1, // number of where conditions - this->m_archives_table->column(0), // serial - '=', serial); -} - -int DarwinupDatabase::update_archive(uint64_t serial, uuid_t uuid, const char* name, - time_t date_added, uint32_t active, uint64_t info, - const char* build) { - this->clear_last_archive(); - return this->update(this->m_archives_table, serial, - (uint8_t*)uuid, - (uint32_t)sizeof(uuid_t), - name, - (uint64_t)date_added, - (uint64_t)active, - (uint64_t)info, - build); -} - -uint64_t DarwinupDatabase::insert_archive(uuid_t uuid, uint64_t info, const char* name, - time_t date_added, const char* build) { - - int res = this->insert(this->m_archives_table, - (uint8_t*)uuid, - (uint32_t)sizeof(uuid_t), - name, - (uint64_t)date_added, - (uint64_t)0, - (uint64_t)info, - build); - if (res != SQLITE_OK) { - fprintf(stderr, "Error: unable to insert archive %s: %s \n", - name, this->error()); - return 0; - } - - return this->last_insert_id(); -} - -File* DarwinupDatabase::make_file(uint8_t* data) { - // XXX do this with a for loop and column->type() - uint64_t serial; - memcpy(&serial, &data[this->file_offset(0)], sizeof(uint64_t)); - uint64_t archive_serial; - memcpy(&archive_serial, &data[this->file_offset(1)], sizeof(uint64_t)); - uint64_t info; - memcpy(&info, &data[this->file_offset(2)], sizeof(uint64_t)); - uint64_t mode; - memcpy(&mode, &data[this->file_offset(3)], sizeof(uint64_t)); - uint64_t uid; - memcpy(&uid, &data[this->file_offset(4)], sizeof(uint64_t)); - uint64_t gid; - memcpy(&gid, &data[this->file_offset(5)], sizeof(uint64_t)); - uint64_t size; - memcpy(&size, &data[this->file_offset(6)], sizeof(uint64_t)); - - SHA1Digest* digest = NULL; - uint8_t* dp; - memcpy(&dp, (uint8_t**)&data[this->file_offset(7)], sizeof(uint8_t*)); - if (dp) { - digest = new SHA1Digest(); - digest->m_size = CC_SHA1_DIGEST_LENGTH; - memcpy(digest->m_data, dp, CC_SHA1_DIGEST_LENGTH); - } - - char* path; - memcpy(&path, &data[this->file_offset(8)], sizeof(char*)); - - // get archive, which may be stored in last_archive - int res = DB_OK; - bool cached = false; - Archive* archive = this->get_last_archive(archive_serial); - if (archive) { - cached = true; - } else { - uint8_t* archive_data; - res = this->get_archive(&archive_data, archive_serial); - this->set_last_archive(archive_data); - archive = this->last_archive; - } - if (!archive) { - fprintf(stderr, "Error: DB::make_file could not find the archive for file: %s: %d \n", path, res); - return NULL; - } - - File* result = FileFactory(serial, archive, (uint32_t)info, (const char*)path, mode, (uid_t)uid, (gid_t)gid, size, digest); - this->m_files_table->free_result(data); - - return result; -} - - - -int DarwinupDatabase::get_next_file(uint8_t** data, File* file, file_starseded_t star) { - int res = SQLITE_OK; - - char comp = '<'; - const char* name = "file_preceded"; - int order = ORDER_BY_DESC; - if (star == FILE_SUPERSEDED) { - comp = '>'; - name = "file_superseded"; - order = ORDER_BY_ASC; - } - res = this->get_row_ordered(name, - data, - this->m_files_table, - this->m_files_table->column(1), // order by archive - order, - 2, - this->m_files_table->column(1), // archive - comp, file->archive()->serial(), - this->m_files_table->column(8), // path - '=', file->path()); - - if (res == SQLITE_ROW) return (DB_FOUND | DB_OK); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::get_file_serial_from_archive(Archive* archive, const char* path, uint64_t** serial) { - int res = this->get_value("file_serial__archive_path", - (void**)serial, - this->m_files_table, - this->m_files_table->column(0), // serial - 2, // number of where conditions - this->m_files_table->column(1), // archive - '=', (uint64_t)archive->serial(), - this->m_files_table->column(8), // path - '=', path); - - if (res == SQLITE_ROW) return (DB_FOUND | DB_OK); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::update_file(uint64_t serial, Archive* archive, uint64_t info, mode_t mode, - uid_t uid, gid_t gid, Digest* digest, const char* path) { - - int res = SQLITE_OK; - - // update the information - res = this->update(this->m_files_table, serial, - (uint64_t)archive->serial(), - (uint64_t)info, - (uint64_t)mode, - (uint64_t)uid, - (uint64_t)gid, - (uint64_t)0, - (uint8_t*)(digest ? digest->data() : NULL), - (uint32_t)(digest ? digest->size() : 0), - path); - - if (res != SQLITE_OK) { - fprintf(stderr, "Error: unable to update file with serial %llu and path %s: %s \n", - serial, path, this->error()); - } - - return res; -} - -uint64_t DarwinupDatabase::insert_file(uint64_t info, mode_t mode, uid_t uid, gid_t gid, - Digest* digest, Archive* archive, const char* path) { - - int res = this->insert(this->m_files_table, - (uint64_t)archive->serial(), - (uint64_t)info, - (uint64_t)mode, - (uint64_t)uid, - (uint64_t)gid, - (uint64_t)0, - (uint8_t*)(digest ? digest->data() : NULL), - (uint32_t)(digest ? digest->size() : 0), - path); - if (res != SQLITE_OK) { - fprintf(stderr, "Error: unable to insert file at %s: %s \n", - path, this->error()); - return 0; - } - - return this->last_insert_id(); -} - -uint64_t DarwinupDatabase::count_files(Archive* archive, const char* path) { - int res = SQLITE_OK; - uint64_t* c; - res = this->count("count_files", - (void**)&c, - this->m_files_table, - 2, // number of where conditions - this->m_files_table->column(1), // archive - '=', (uint64_t)archive->serial(), - this->m_files_table->column(8), // path - '=', path); - if (res != SQLITE_ROW) { - fprintf(stderr, "Error: unable to count files: %d \n", res); - return 0; - } - return *c; -} - -uint64_t DarwinupDatabase::count_archives(bool include_rollbacks) { - int res = SQLITE_OK; - uint64_t* c; - if (include_rollbacks) { - res = this->count("count_archives", - (void**)&c, - this->m_archives_table, 0); - } else { - res = this->count("count_archives_norollback", - (void**)&c, - this->m_archives_table, - 1, - this->m_archives_table->column(2), // name - '!', ""); - } - if (res != SQLITE_ROW) { - fprintf(stderr, "Error: unable to count archives: %d \n", res); - return 0; - } - return *c; -} - -int DarwinupDatabase::delete_archive(Archive* archive) { - int res = this->del(this->m_archives_table, archive->serial()); - if (res != SQLITE_OK) return DB_ERROR; - return DB_OK; -} - -int DarwinupDatabase::delete_archive(uint64_t serial) { - int res = this->del(this->m_archives_table, serial); - if (res != SQLITE_OK) return DB_ERROR; - return DB_OK; -} - -int DarwinupDatabase::delete_empty_archives() { - int res = this->sql("delete_empty_archives", - "DELETE FROM archives " - "WHERE serial IN " - " (SELECT serial FROM archives " - " WHERE serial NOT IN " - " (SELECT DISTINCT archive FROM files));"); - if (res != SQLITE_OK) return DB_ERROR; - return DB_OK; -} - -int DarwinupDatabase::free_archive(uint8_t* data) { - return this->m_archives_table->free_result(data); -} - -int DarwinupDatabase::delete_file(File* file) { - int res = this->del(this->m_files_table, file->serial()); - if (res != SQLITE_OK) return DB_ERROR; - return DB_OK; -} - -int DarwinupDatabase::delete_file(uint64_t serial) { - int res = this->del(this->m_files_table, serial); - if (res != SQLITE_OK) return DB_ERROR; - return DB_OK; -} - -int DarwinupDatabase::delete_files(Archive* archive) { - int res = this->del("delete_files__archive", - this->m_files_table, - 1, // number of where conditions - this->m_files_table->column(1), // archive - '=', (uint64_t)archive->serial()); - if (res != SQLITE_OK) return DB_ERROR; - return DB_OK; -} - -int DarwinupDatabase::free_file(uint8_t* data) { - return this->m_files_table->free_result(data); -} - -int DarwinupDatabase::get_inactive_archive_serials(uint64_t** serials, uint32_t* count) { - int res = this->get_column("inactive_archive_serials", - (void**)serials, count, - this->m_archives_table, - this->m_archives_table->column(0), // serial - 1, - this->m_archives_table->column(4), // active - '=', (uint64_t)0); - if (res == SQLITE_DONE && *count) return (DB_OK | DB_FOUND); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::get_files(uint8_t*** data, uint32_t* count, Archive* archive, bool reverse) { - int order = ORDER_BY_ASC; - const char* name = "files_archive"; - if (reverse) { - order = ORDER_BY_DESC; - name = "files_archive_reverse"; - } - int res = this->get_all_ordered(name, - data, count, - this->m_files_table, - this->m_files_table->column(8), // order by path - order, - 1, - this->m_files_table->column(1), - '=', archive->serial()); - - if ((res == SQLITE_DONE) && *count) return (DB_OK | DB_FOUND); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::get_file_serials(uint64_t** serials, uint32_t* count) { - int res = this->get_column("file_serials", (void**)serials, count, - this->m_files_table, - this->m_files_table->column(0), - 0); - if (res == SQLITE_DONE && *count) return (DB_OK | DB_FOUND); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - - -Archive* DarwinupDatabase::make_archive(uint8_t* data) { - // XXX do this with a for loop and column->type() - uint64_t serial; - memcpy(&serial, &data[this->archive_offset(0)], sizeof(uint64_t)); - uuid_t* uuid; - memcpy(&uuid, &data[this->archive_offset(1)], sizeof(uuid_t*)); - char* name; - memcpy(&name, &data[this->archive_offset(2)], sizeof(char*)); - time_t date_added; - memcpy(&date_added, &data[this->archive_offset(3)], sizeof(time_t)); - uint64_t info; - memcpy(&info, &data[this->archive_offset(5)], sizeof(uint64_t)); - char* build; - memcpy(&build, &data[this->archive_offset(6)], sizeof(char*)); - - Archive* archive = new Archive(serial, *uuid, name, NULL, info, date_added, build); - this->m_archives_table->free_result(data); - - return archive; -} - -int DarwinupDatabase::get_archives(uint8_t*** data, uint32_t* count, bool include_rollbacks) { - int res = this->get_all_ordered("get_archives", - data, count, - this->m_archives_table, - this->m_archives_table->column(0), // order by serial - ORDER_BY_DESC, - 1, - this->m_archives_table->column(2), // name - '!', (include_rollbacks ? "" : "")); - - if ((res == SQLITE_DONE) && *count) return (DB_OK | DB_FOUND); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::get_archive(uint8_t** data, uuid_t uuid) { - int res = this->get_row("archive__uuid", - data, - this->m_archives_table, - 1, - this->m_archives_table->column(1), // uuid - '=', uuid, sizeof(uuid_t)); - if (res == SQLITE_ROW) return (DB_FOUND | DB_OK); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::get_archive(uint8_t** data, uint64_t serial) { - int res = this->get_row("archive__serial", - data, - this->m_archives_table, - 1, - this->m_archives_table->column(0), // serial - '=', serial); - if (res == SQLITE_ROW) { - return (DB_FOUND | DB_OK); - } - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::get_archive(uint8_t** data, const char* name) { - int res = this->get_row("archive__name", - data, - this->m_archives_table, - 1, - this->m_archives_table->column(2), // name - '=', name); - if (res == SQLITE_ROW) return (DB_FOUND | DB_OK); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::get_archive(uint8_t** data, archive_keyword_t keyword) { - int res = SQLITE_OK; - int order = ORDER_BY_DESC; - const char* name = "archive_newest"; - - if (keyword == DEPOT_ARCHIVE_OLDEST) { - order = ORDER_BY_ASC; - name = "archive_oldest"; - } - - res = this->get_row_ordered(name, - data, - this->m_archives_table, - this->m_archives_table->column(3), // order by date_added - order, - 1, - this->m_archives_table->column(2), // name - '!', ""); - - if (res == SQLITE_ROW) return (DB_FOUND | DB_OK); - if (res == SQLITE_DONE) return DB_OK; - return DB_ERROR; -} - -int DarwinupDatabase::archive_offset(int column) { - return this->m_archives_table->offset(column); -} - -int DarwinupDatabase::file_offset(int column) { - return this->m_files_table->offset(column); -} - -Archive* DarwinupDatabase::get_last_archive(uint64_t serial) { - if (this->last_archive && this->last_archive->serial() == serial) { - return this->last_archive; - } - return NULL; -} - -int DarwinupDatabase::clear_last_archive() { - delete this->last_archive; - this->last_archive = NULL; - return 0; -} - -int DarwinupDatabase::set_last_archive(uint8_t* data) { - this->last_archive = this->make_archive(data); - if (this->last_archive) return 0; - return 1; -} diff --git a/darwinup/DB.h b/darwinup/DB.h deleted file mode 100644 index 16fae9d..0000000 --- a/darwinup/DB.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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@ - */ - -#ifndef _DB_H -#define _DB_H - -#include -#include -#include -#include - -#include "Database.h" -#include "Table.h" -#include "Archive.h" -#include "Digest.h" -#include "File.h" - - -/** - * - * Darwinup database abstraction. This class is responsible - * for generating the Table and Column objects that make - * up the darwinup database schema, but the parent handles - * deallocation. - * - */ -struct DarwinupDatabase : Database { - DarwinupDatabase(const char* path); - virtual ~DarwinupDatabase(); - int init_schema(); - - uint64_t count_files(Archive* archive, const char* path); - uint64_t count_archives(bool include_rollbacks); - - // Archives - Archive* make_archive(uint8_t* data); - int get_archives(uint8_t*** data, uint32_t* count, bool include_rollbacks); - int get_archive(uint8_t** data, uuid_t uuid); - int get_archive(uint8_t** data, uint64_t serial); - int get_archive(uint8_t** data, const char* name); - int get_archive(uint8_t** data, archive_keyword_t keyword); - int get_inactive_archive_serials(uint64_t** serials, uint32_t* count); - int archive_offset(int column); - int activate_archive(uint64_t serial); - int deactivate_archive(uint64_t serial); - int update_archive(uint64_t serial, uuid_t uuid, const char* name, - time_t date_added, uint32_t active, uint64_t info, - const char* build); - uint64_t insert_archive(uuid_t uuid, uint64_t info, const char* name, - time_t date, const char* build); - int delete_empty_archives(); - int delete_archive(Archive* archive); - int delete_archive(uint64_t serial); - int free_archive(uint8_t* data); - - // Files - File* make_file(uint8_t* data); - int get_next_file(uint8_t** data, File* file, file_starseded_t star); - int get_file_serials(uint64_t** serials, uint32_t* count); - int get_file_serial_from_archive(Archive* archive, const char* path, - uint64_t** serial); - int get_files(uint8_t*** data, uint32_t* count, Archive* archive, bool reverse); - int file_offset(int column); - int update_file(uint64_t serial, Archive* archive, uint64_t info, mode_t mode, - uid_t uid, gid_t gid, Digest* digest, const char* path); - uint64_t insert_file(uint64_t info, mode_t mode, uid_t uid, gid_t gid, - Digest* digest, Archive* archive, const char* path); - int delete_file(uint64_t serial); - int delete_file(File* file); - int delete_files(Archive* archive); - int free_file(uint8_t* data); - - // memoization - Archive* get_last_archive(uint64_t serial); - int clear_last_archive(); - int set_last_archive(uint8_t* data); - - -protected: - - int set_archive_active(uint64_t serial, uint64_t* active); - - Table* m_archives_table; - Table* m_files_table; - - // memoize some get_archive calls - Archive* last_archive; - -}; - -#endif - diff --git a/darwinup/Database.cpp b/darwinup/Database.cpp deleted file mode 100644 index c787d3d..0000000 --- a/darwinup/Database.cpp +++ /dev/null @@ -1,958 +0,0 @@ -/* - * 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 "Database.h" - -/** - * sqlite3_trace callback for debugging - */ -void dbtrace(void* context, const char* sql) { - fprintf(stderr, "[SQL] %s\n", sql); -} - -Database::Database() { - m_schema_version = 0; - m_table_max = 2; - m_table_count = 0; - m_tables = (Table**)malloc(sizeof(Table*) * m_table_max); - this->init_cache(); - m_db = NULL; - m_path = NULL; - m_error_size = ERROR_BUF_SIZE; - m_error = (char*)malloc(m_error_size); -} - -Database::Database(const char* path) { - m_schema_version = 0; - m_table_max = 2; - m_table_count = 0; - m_tables = (Table**)malloc(sizeof(Table*) * m_table_max); - this->init_cache(); - m_db = NULL; - m_path = strdup(path); - if (!m_path) { - fprintf(stderr, "Error: ran out of memory when constructing " - "database object.\n"); - } - m_error_size = ERROR_BUF_SIZE; - m_error = (char*)malloc(m_error_size); -} - -Database::~Database() { - for (uint32_t i = 0; i < m_table_count; i++) { - delete m_tables[i]; - } - this->destroy_cache(); - - sqlite3_finalize(m_begin_transaction); - sqlite3_finalize(m_rollback_transaction); - sqlite3_finalize(m_commit_transaction); - - free(m_tables); - free(m_path); - free(m_error); -} - -uint32_t Database::schema_version() { - return this->m_schema_version; -} - -void Database::schema_version(uint32_t v) { - this->m_schema_version = v; -} - -int Database::init_schema() { - // do nothing... children should implement this - return DB_OK; -} - -int Database::post_table_creation() { - // clients can implement this - return DB_OK; -} - -const char* Database::path() { - return m_path; -} - -const char* Database::error() { - return m_error; -} - -int Database::connect() { - int res = DB_OK; - - if (!m_path) { - fprintf(stderr, "Error: need to specify a path to Database.\n"); - return -1; - } - - res = this->pre_connect(); - if (res) { - fprintf(stderr, "Error: pre-connection failed.\n"); - return res; - } - - // test our access level - int exists = is_regular_file(m_path); - bool readonly = false; - if (!exists && access(dirname(m_path), W_OK | X_OK)) { - // does not exist and we cannot write to the directory - fprintf(stderr, - "Error: Unable to create new darwinup database. " - "Try running as root."); - return DB_ERROR; - } - if (exists && access(m_path, W_OK)) { - // db exists already but we cannot write to it - readonly = true; - } - - res = sqlite3_open(m_path, &m_db); - if (res) { - sqlite3_close(m_db); - m_db = NULL; - fprintf(stderr, "Error: unable to connect to database at: %s \n", - m_path); - return res; - } - - res = this->post_connect(); - if (res) { - fprintf(stderr, "Error: post-connection failed.\n"); - return res; - } - - if (!exists) { - // create schema since it is empty - assert(this->create_tables() == 0); - assert(this->set_schema_version(this->m_schema_version) == 0); - } else { - // test schema versions - uint32_t version = 0; - if (this->has_information_table()) { - version = this->get_schema_version(); - } - - if (version < this->m_schema_version) { - if (readonly) { - fprintf(stderr, - "Error: the darwinup database needs to be upgraded " - "but darwinup cannot write to database. " - "Try running as root.\n"); - sqlite3_close(m_db); - m_db = NULL; - return DB_ERROR; - } - IF_DEBUG("Upgrading schema from %u to %u \n", version, this->m_schema_version); - assert(this->upgrade_schema(version) == 0); - assert(this->set_schema_version(this->m_schema_version) == 0); - } - if (version > this->m_schema_version) { - fprintf(stderr, "Error: this client is too old!\n"); - sqlite3_close(m_db); - m_db = NULL; - return DB_ERROR; - } - } - - return res; -} - -int Database::pre_connect() { - int res = DB_OK; - res = this->init_internal_schema(); - res = this->init_schema(); - return res; -} - -int Database::post_connect() { - int res = DB_OK; - - // prepare transaction statements - if (res == DB_OK) - res = sqlite3_prepare_v2(m_db, "BEGIN TRANSACTION", 18, - &m_begin_transaction, NULL); - if (res == DB_OK) - res = sqlite3_prepare_v2(m_db, "ROLLBACK TRANSACTION", 21, - &m_rollback_transaction, NULL); - if (res == DB_OK) - res = sqlite3_prepare_v2(m_db, "COMMIT TRANSACTION", 19, - &m_commit_transaction, NULL); - - // debug settings - extern uint32_t verbosity; - if (verbosity & VERBOSE_SQL) { - sqlite3_trace(m_db, dbtrace, NULL); - } - - return res; -} - -int Database::connect(const char* path) { - this->m_path = strdup(path); - if (!m_path) { - fprintf(stderr, "Error: ran out of memory when trying to connect to " - "database.\n"); - return 1; - } - return this->connect(); -} - -bool Database::is_connected() { - return m_db != NULL; -} - -int Database::begin_transaction() { - return this->execute(m_begin_transaction); -} - -int Database::rollback_transaction() { - return this->execute(m_rollback_transaction); -} - -int Database::commit_transaction() { - return this->execute(m_commit_transaction); -} - -int Database::bind_all_columns(sqlite3_stmt* stmt, Table* table, va_list args) { - int res = DB_OK; - int param = 1; - for (uint32_t i=0; icolumn_count(); i++) { - Column* col = table->column(i); - if (col->is_pk()) continue; - uint8_t* bdata = NULL; - uint32_t bsize = 0; - switch(col->type()) { - case TYPE_INTEGER: - res = sqlite3_bind_int64(stmt, param++, va_arg(args, uint64_t)); - break; - case TYPE_TEXT: - res = sqlite3_bind_text(stmt, param++, va_arg(args, char*), - -1, SQLITE_STATIC); - break; - case TYPE_BLOB: - bdata = va_arg(args, uint8_t*); - bsize = va_arg(args, uint32_t); - res = sqlite3_bind_blob(stmt, param++, - bdata, - bsize, - SQLITE_STATIC); - break; - } - if (res != SQLITE_OK) { - fprintf(stderr, "Error: failed to bind parameter #%d with column #%d" - "of type %d table %s \n", - param, i, col->type(), table->name()); - return res; - } - } - return res; -} - -int Database::bind_va_columns(sqlite3_stmt* stmt, uint32_t count, va_list args) { - return this->bind_columns(stmt, count, 1, args); -} - -int Database::bind_columns(sqlite3_stmt* stmt, uint32_t count, int param, - va_list args) { - int res = DB_OK; - for (uint32_t i=0; itype()) { - case TYPE_INTEGER: - res = sqlite3_bind_int64(stmt, param++, va_arg(args, uint64_t)); - break; - case TYPE_TEXT: - tval = va_arg(args, char*); - res = sqlite3_bind_text(stmt, param++, tval, -1, SQLITE_STATIC); - break; - case TYPE_BLOB: - bdata = va_arg(args, uint8_t*); - bsize = va_arg(args, uint32_t); - res = sqlite3_bind_blob(stmt, param++, - bdata, - bsize, - SQLITE_STATIC); - break; - } - if (res != SQLITE_OK) { - fprintf(stderr, "Error: failed to bind parameter #%d with column #%d " - "of type %d res %d: %s \n", - param-1, i, col->type(), res, - sqlite3_errmsg(m_db)); - return res; - } - } - return res; -} - -#define __get_stmt(expr) \ - sqlite3_stmt* stmt; \ - sqlite3_stmt** pps; \ - char* key = strdup(name); \ - cache_get_and_retain(m_statement_cache, key, (void**)&pps); \ - if (!pps) { \ - va_list args; \ - va_start(args, count); \ - pps = expr; \ - va_end(args); \ - cache_set_and_retain(m_statement_cache, key, pps, 0); \ - } \ - stmt = *pps; \ - free(key); - -int Database::count(const char* name, void** output, Table* table, - uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->count(m_db, count, args)); - int res = SQLITE_OK; - res = this->bind_va_columns(stmt, count, args); - *output = malloc(sizeof(uint64_t)); - assert(*output); - res = this->step_once(stmt, *(uint8_t**)output, NULL); - sqlite3_reset(stmt); - cache_release_value(m_statement_cache, pps); - va_end(args); - return res; -} - -int Database::get_value(const char* name, void** output, Table* table, - Column* value_column, uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->get_column(m_db, value_column, count, args)); - int res = SQLITE_OK; - this->bind_va_columns(stmt, count, args); - uint32_t size = value_column->size(); - *output = malloc(size); - assert(*output); - res = this->step_once(stmt, (uint8_t*)*output, NULL); - sqlite3_reset(stmt); - cache_release_value(m_statement_cache, pps); - va_end(args); - return res; -} - -int Database::get_column(const char* name, void** output, uint32_t* result_count, - Table* table, Column* column, uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->get_column(m_db, column, count, args)); - int res = SQLITE_OK; - this->bind_va_columns(stmt, count, args); - uint32_t size = INITIAL_ROWS * column->size(); - *output = malloc(size); - res = this->step_all(stmt, output, size, result_count); - sqlite3_reset(stmt); - cache_release_value(m_statement_cache, pps); - va_end(args); - return res; -} - -int Database::get_row(const char* name, uint8_t** output, Table* table, - uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->get_row(m_db, count, args)); - int res = SQLITE_OK; - this->bind_va_columns(stmt, count, args); - *output = table->alloc_result(); - res = this->step_once(stmt, *output, NULL); - sqlite3_reset(stmt); - cache_release_value(m_statement_cache, pps); - va_end(args); - return res; -} - -int Database::get_row_ordered(const char* name, uint8_t** output, Table* table, - Column* order_by, int order, uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->get_row_ordered(m_db, order_by, order, count, args)); - int res = SQLITE_OK; - this->bind_va_columns(stmt, count, args); - *output = table->alloc_result(); - res = this->step_once(stmt, *output, NULL); - sqlite3_reset(stmt); - cache_release_value(m_statement_cache, pps); - va_end(args); - return res; -} - -int Database::get_all_ordered(const char* name, uint8_t*** output, - uint32_t* result_count, Table* table, - Column* order_by, int order, uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->get_row_ordered(m_db, order_by, order, count, args)); - int res = SQLITE_OK; - this->bind_va_columns(stmt, count, args); - uint8_t* current = NULL; - *result_count = 0; - uint32_t output_max = INITIAL_ROWS; - *output = (uint8_t**)calloc(output_max, sizeof(uint8_t*)); - - res = SQLITE_ROW; - while (res == SQLITE_ROW) { - if ((*result_count) >= output_max) { - output_max *= REALLOC_FACTOR; - *output = (uint8_t**)realloc((*output), output_max * sizeof(uint8_t*)); - if (!(*output)) { - fprintf(stderr, "Error: ran out of memory trying to realloc output" - "in get_all_ordered.\n"); - return DB_ERROR; - } - } - current = table->alloc_result(); - res = this->step_once(stmt, current, NULL); - if (res == SQLITE_ROW) { - (*output)[(*result_count)] = current; - (*result_count)++; - } else { - table->free_result(current); - } - } - - sqlite3_reset(stmt); - cache_release_value(m_statement_cache, pps); - va_end(args); - return res; -} - -int Database::update_value(const char* name, Table* table, Column* value_column, - void** value, uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->update_value(m_db, value_column, count, args)); - int param = 1; - int res = SQLITE_OK; - switch(value_column->type()) { - case TYPE_INTEGER: - res = sqlite3_bind_int64(stmt, param++, (uint64_t)*value); - break; - case TYPE_TEXT: - res = sqlite3_bind_text(stmt, param++, (char*)*value, -1, SQLITE_STATIC); - break; - // XXX: support blob columns here - case TYPE_BLOB: - fprintf(stderr, "Error: Database::update_value() not implemented for " - "BLOB columns.\n"); - assert(false); - } - if (res != SQLITE_OK) { - fprintf(stderr, "Error: update_value failed to bind value with value_column " - "type %d in table %s. \n", - value_column->type(), table->name()); - return res; - } - this->bind_columns(stmt, count, param, args); - res = sqlite3_step(stmt); - sqlite3_reset(stmt); - cache_release_value(m_statement_cache, pps); - va_end(args); - return (res == SQLITE_DONE ? SQLITE_OK : res); -} - -int Database::del(const char* name, Table* table, uint32_t count, ...) { - va_list args; - va_start(args, count); - __get_stmt(table->del(m_db, count, args)); - int res = SQLITE_OK; - this->bind_va_columns(stmt, count, args); - if (res == SQLITE_OK) res = this->execute(stmt); - va_end(args); - return res; - -} - -/** - * Given a table and an arg list in the same order as Table::add_column() calls, - * binds and executes a sql update. The Table is responsible for preparing the - * statement in Table::update() - * - * All integer args must be cast to uint64_t - * All blob columns must provide 2 args in the list. The first arg is a uint8_t* - * of data and then the uint32_t value for size of the data. - * - */ -int Database::update(Table* table, uint64_t pkvalue, ...) { - va_list args; - va_start(args, pkvalue); - - int res = SQLITE_OK; - - // get the prepared statement - sqlite3_stmt* stmt = table->update(m_db); - if (!stmt) { - fprintf(stderr, "Error: %s table gave a NULL statement when trying to " - "update.\n", table->name()); - return 1; - } - - this->bind_all_columns(stmt, table, args); - - // bind the primary key in the WHERE clause - // bind_all_columns already bound the first n'th params, where n in the - // table's column count, so we provide that count as the parameter value - if (res==SQLITE_OK) res = sqlite3_bind_int64(stmt, table->column_count(), - pkvalue); - if (res==SQLITE_OK) res = this->execute(stmt); - va_end(args); - return res; -} - -int Database::insert(Table* table, ...) { - va_list args; - va_start(args, table); - - int res = SQLITE_OK; - // get the prepared statement - sqlite3_stmt* stmt = table->insert(m_db); - if (!stmt) { - fprintf(stderr, "Error: %s table gave a NULL statement when trying to " - "insert.\n", table->name()); - return 1; - } - this->bind_all_columns(stmt, table, args); - if (res == SQLITE_OK) res = this->execute(stmt); - va_end(args); - return res; -} - -#undef __get_stmt - -int Database::del(Table* table, uint64_t serial) { - int res = SQLITE_OK; - sqlite3_stmt* stmt = table->del(m_db); - if (!stmt) { - fprintf(stderr, "Error: %s table gave a NULL statement when trying to " - "delete.\n", table->name()); - return res; - } - if (res == SQLITE_OK) res = sqlite3_bind_int64(stmt, 1, serial); - if (res == SQLITE_OK) res = this->execute(stmt); - return res; -} - -uint64_t Database::last_insert_id() { - return (uint64_t)sqlite3_last_insert_rowid(m_db); -} - - - -int Database::sql_once(const char* fmt, ...) { - int res = 0; - va_list args; - va_start(args, fmt); - char* error = NULL; - if (this->m_db) { - char *query = sqlite3_vmprintf(fmt, args); - res = sqlite3_exec(this->m_db, query, NULL, NULL, &error); - sqlite3_free(query); - } else { - fprintf(stderr, "Error: database not open.\n"); - res = SQLITE_ERROR; - } - va_end(args); - if (error) { - strlcpy(m_error, error, m_error_size); - fprintf(stderr, "Error: sql_once(): %s \n", m_error); - fprintf(stderr, "Error: fmt: %s \n", fmt); - sqlite3_free(error); - } - return res; -} - -int Database::sql(const char* name, const char* fmt, ...) { - sqlite3_stmt* stmt; - char* key = strdup(name); - cache_get_and_retain(m_statement_cache, key, (void**)&stmt); - if (!stmt) { - va_list args; - va_start(args, fmt); - char* query = sqlite3_vmprintf(fmt, args); - int res = sqlite3_prepare_v2(m_db, query, (int)strlen(query), &stmt, NULL); - va_end(args); - if (res != SQLITE_OK) { - fprintf(stderr, "Error: unable to prepare statement for query: %s\n" - "Error: %s\n", - query, sqlite3_errmsg(m_db)); - free(key); - return res; - } - cache_set_and_retain(m_statement_cache, key, stmt, 0); \ - free(key); - } - return this->execute(stmt); -} - -int Database::execute(sqlite3_stmt* stmt) { - int res = SQLITE_OK; - res = sqlite3_step(stmt); - if (res == SQLITE_DONE) { - res = SQLITE_OK; - } else { - strlcpy(m_error, sqlite3_errmsg(m_db), m_error_size); - fprintf(stderr, "Error: execute() error: %s \n", m_error); - } - res = sqlite3_reset(stmt); - return res; -} - -int Database::add_table(Table* t) { - if (m_table_count >= m_table_max) { - m_tables = (Table**)realloc(m_tables, - m_table_max*sizeof(Table*)*REALLOC_FACTOR); - if (!m_tables) { - fprintf(stderr, "Error: unable to reallocate memory to add a " - "table\n"); - return 1; - } - m_table_max *= REALLOC_FACTOR; - } - m_tables[m_table_count++] = t; - t->m_version = this->m_schema_version; - - return 0; -} - -/** - * get a row count of the first table to detect if the schema - * needs to be initialized - */ -bool Database::is_empty() { - if (!m_tables[0]) { - fprintf(stderr, "Warning: Database has not had a schema initialized.\n"); - return false; - } - int res = SQLITE_OK; - char* query; - asprintf(&query, "SELECT count(*) FROM %s;", m_tables[0]->name()); - res = sqlite3_exec(this->m_db, query, NULL, NULL, NULL); - free(query); - return res != SQLITE_OK; -} - -int Database::create_table(Table* table) { - int res = this->sql_once(table->create()); - if (res != DB_OK) { - fprintf(stderr, "Error: sql error trying to create" - " table: %s: %s\n", - table->name(), m_error); - } - return res; -} - -int Database::create_tables() { - int res = SQLITE_OK; - for (uint32_t i=0; isql_once(m_tables[i]->create()); - if (res!=SQLITE_OK) { - fprintf(stderr, "Error: sql error trying to create table: %s: %s\n", - m_tables[i]->name(), m_error); - return res; - } - } - if (res == DB_OK) res = this->initial_data(); - if (res == DB_OK) res = this->post_table_creation(); - return res; -} - -int Database::upgrade_schema(uint32_t version) { - int res = DB_OK; - this->begin_transaction(); - - res = this->upgrade_internal_schema(version); - if (res != DB_OK) { - fprintf(stderr, "Error: unable to upgrade internal schema.\n"); - this->rollback_transaction(); - return res; - } - - for (uint32_t ti = 0; res == DB_OK && ti < m_table_count; ti++) { - if (m_tables[ti]->version() > version) { - // entire table is new - res = this->create_table(m_tables[ti]); - } else { - // table is same version, so check for new columns - for (uint32_t ci = 0; res == DB_OK && ci < m_tables[ti]->column_count(); ci++) { - if (m_tables[ti]->column(ci)->version() < version) { - // this should never happen - fprintf(stderr, "Error: internal error with schema versioning." - " Column %s is older than its table %s. \n", - m_tables[ti]->column(ci)->name(), m_tables[ti]->name()); - } - if (m_tables[ti]->column(ci)->version() > version) { - // column is new - res = this->sql_once(m_tables[ti]->alter_add_column(ci)); - if (res != DB_OK) { - fprintf(stderr, "Error: sql error trying to upgrade (alter)" - " table: %s column: %s : %s\n", - m_tables[ti]->name(), m_tables[ti]->column(ci)->name(), - m_error); - } - } - } - } - } - - if (res == DB_OK) { - this->commit_transaction(); - } else { - this->rollback_transaction(); - } - - return res; -} - -int Database::upgrade_internal_schema(uint32_t version) { - int res = DB_OK; - - if (version == 0) { - res = this->sql_once(this->m_information_table->create()); - } - - return res; -} - -int Database::init_internal_schema() { - this->m_information_table = new Table("database_information"); - ADD_TABLE(this->m_information_table); - ADD_PK(m_information_table, "id"); - ADD_INDEX(m_information_table, "variable", TYPE_TEXT, true); - ADD_TEXT(m_information_table, "value"); - return DB_OK; -} - -int Database::initial_data() { - // load our initial config data - return this->insert(m_information_table, "schema_version", "0"); -} - -int Database::get_information_value(const char* variable, char*** value) { - return this->get_value("get_information_value", - (void**)value, - this->m_information_table, - this->m_information_table->column(2), // value - 1, - this->m_information_table->column(1), // variable - '=', variable); -} - -int Database::update_information_value(const char* variable, const char* value) { - int res = SQLITE_OK; - uint64_t* c; - res = this->count("count_info_var", - (void**)&c, - this->m_information_table, - 1, - this->m_information_table->column(1), // variable - '=', variable); - - if (*c > 0) { - res = this->update_value("update_information_value", - this->m_information_table, - this->m_information_table->column(2), // value - (void**)&value, - 1, - this->m_information_table->column(1), // variable - '=', variable); - } else { - res = this->insert(m_information_table, variable, value); - } - - return res; -} - -bool Database::has_information_table() { - int res = SQLITE_OK; - res = sqlite3_exec(this->m_db, - "SELECT count(*) FROM database_information;", - NULL, NULL, NULL); - return res == SQLITE_OK; -} - -uint32_t Database::get_schema_version() { - int res = SQLITE_OK; - char** vertxt = NULL; - res = this->get_information_value("schema_version", &vertxt); - if (res == SQLITE_ROW) { - uint32_t version = (uint32_t)strtoul(*vertxt, NULL, 10); - free(*vertxt); - return version; - } else { - // lack of information table/value means we are - // upgrading an old database - return 0; - } -} - -int Database::set_schema_version(uint32_t version) { - IF_DEBUG("set_schema_version %u \n", version); - int res = DB_OK; - char* vertxt; - asprintf(&vertxt, "%u", version); - if (!vertxt) return DB_ERROR; - res = this->update_information_value("schema_version", vertxt); - free(vertxt); - return res; -} - -size_t Database::store_column(sqlite3_stmt* stmt, int column, uint8_t* output) { - size_t used; - int type = sqlite3_column_type(stmt, column); - const void* blob; - int blobsize; - switch(type) { - case SQLITE_INTEGER: - *(uint64_t*)output = (uint64_t)sqlite3_column_int64(stmt, column); - used = sizeof(uint64_t); - break; - case SQLITE_TEXT: - *(const char**)output = strdup((const char*)sqlite3_column_text(stmt, - column)); - used = sizeof(char*); - break; - case SQLITE_BLOB: - blob = sqlite3_column_blob(stmt, column); - blobsize = sqlite3_column_bytes(stmt, column); - *(void**)output = malloc(blobsize); - if (*(void**)output && blobsize) { - memcpy(*(void**)output, blob, blobsize); - } else { - fprintf(stderr, "Error: unable to get blob from database stmt.\n"); - } - used = sizeof(void*); - break; - case SQLITE_NULL: - // result row has a NULL value which is okay - *(const char**)output = NULL; - used = sizeof(char*); - break; - default: - fprintf(stderr, "Error: unhandled column type in " - "Database::store_column(): %d \n", - type); - return 0; - } - - return used; -} - -/** - * will not realloc memory for output since caller should know how - * much to alloc in the first place. Sets used to be how many bytes - * were written to output - */ -int Database::step_once(sqlite3_stmt* stmt, uint8_t* output, uint32_t* used) { - int res = SQLITE_OK; - res = sqlite3_step(stmt); - uint8_t* current = output; - if (used) *used = 0; - if (res == SQLITE_ROW) { - int count = sqlite3_column_count(stmt); - for (int i = 0; i < count; i++) { - current += this->store_column(stmt, i, current); - } - if (used) { - *used = (uint32_t)(current - output); - } - } - - return res; -} - -int Database::step_all(sqlite3_stmt* stmt, void** output, uint32_t size, - uint32_t* count) { - uint32_t used = 0; - uint32_t total_used = used; - uint32_t rowsize = size / INITIAL_ROWS; - uint8_t* current = *(uint8_t**)output; - *count = 0; - int res = SQLITE_ROW; - while (res == SQLITE_ROW) { - current = *(uint8_t**)output + total_used; - res = this->step_once(stmt, current, &used); - if (res == SQLITE_ROW) (*count)++; - total_used += used; - if (total_used >= (size - rowsize)) { - size *= REALLOC_FACTOR; - *output = realloc(*output, size); - if (!*output) { - fprintf(stderr, "Error: ran out of memory in Database::step_all \n"); - return SQLITE_ERROR; - } - } - } - sqlite3_reset(stmt); - return res; -} - - -/** - * - * libcache - * - */ -void Database::init_cache() { - cache_attributes_t attrs; - attrs.version = CACHE_ATTRIBUTES_VERSION_2; - attrs.key_hash_cb = cache_key_hash_cb_cstring; - attrs.key_is_equal_cb = cache_key_is_equal_cb_cstring; - attrs.key_retain_cb = cache_key_retain; - attrs.key_release_cb = cache_release_cb_free; - attrs.value_release_cb = cache_statement_release; - attrs.value_retain_cb = NULL; - attrs.value_make_purgeable_cb = NULL; - attrs.value_make_nonpurgeable_cb = NULL; - attrs.user_data = NULL; - cache_create("org.macosforge.darwinbuild.darwinup.statements", - &attrs, &m_statement_cache); -} - -void Database::destroy_cache() { - cache_destroy(m_statement_cache); -} - -void cache_key_retain(void* key_in, void** key_out, void* user_data) { - *key_out = strdup((char*)key_in); -} - -void cache_statement_release(void* value, void* user_data) { - sqlite3_finalize(*(sqlite3_stmt**)value); -} diff --git a/darwinup/Database.h b/darwinup/Database.h deleted file mode 100644 index 0dc0e83..0000000 --- a/darwinup/Database.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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@ - */ - -#ifndef _DATABASE_H -#define _DATABASE_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Table.h" -#include "Digest.h" -#include "Archive.h" - -// flag for generating queries with ORDER BY clauses -#define ORDER_BY_DESC 0 -#define ORDER_BY_ASC 1 - -// initial number of rows we allocate for when querying -#define INITIAL_ROWS 8 - -// how much we grow by when we need more space -#define REALLOC_FACTOR 4 -#define ERROR_BUF_SIZE 1024 - -// return code bits -#define DB_OK 0x0000 -#define DB_ERROR 0x0001 -#define DB_FOUND 0x0010 - -// test return code to see if actual results were found -#define FOUND(x) ((x & DB_FOUND) && !(x & DB_ERROR)) - -// Schema creation macros -#define SCHEMA_VERSION(v) this->schema_version(v); -#define ADD_TABLE(t) assert(this->add_table(t)==0); -#define ADD_COLUMN(table, name, type, index, pk, unique) \ - assert(table->add_column(new Column(name, type, index, pk, unique), this->schema_version())==0); -#define ADD_INDEX(table, name, type, unique) \ - assert(table->add_column(new Column(name, type, true, false, unique), this->schema_version())==0); -#define ADD_PK(table, name) \ - assert(table->add_column(new Column(name, TYPE_INTEGER, \ - false, true, false), this->schema_version())==0); -#define ADD_TEXT(table, name) \ - assert(table->add_column(new Column(name, TYPE_TEXT), this->schema_version())==0); -#define ADD_INTEGER(table, name) \ - assert(table->add_column(new Column(name, TYPE_INTEGER), this->schema_version())==0); -#define ADD_BLOB(table, name) \ - assert(table->add_column(new Column(name, TYPE_BLOB), this->schema_version())==0); - -// retry an operation a few times if we hit a lock -#define __retry_if_locked(operation) \ - do { \ - extern uint32_t verbosity; \ - fprintf(stderr, "retry: verbosity %u \n", verbosity); \ - res = operation; \ - fprintf(stderr, "retry: initial res %d \n", res); \ - if (res == 5 || res == 6) { \ - fprintf(stderr, "retry: locked \n"); \ - int _num_tries = 3; \ - while (_num_tries--) { \ - fprintf(stderr, "retry: tries left %d \n", _num_tries); \ - if (verbosity) fprintf(stdout, "Database is locked, " \ - "trying again in 1 second...\n"); \ - sleep(1); \ - res = operation; \ - fprintf(stderr, "retry: res %d \n", res); \ - } \ - if (verbosity) fprintf(stdout, "Database is still locked, giving up.\n"); \ - } \ - } while (0); - - -/** - * - * Generic sqlite abstraction - * - */ -struct Database { - Database(); - Database(const char* path); - virtual ~Database(); - - // public setter/getter of class attr - uint32_t schema_version(); - void schema_version(uint32_t v); - - /** - * init_schema is called during db connection. - * Projects implementing a Database derived class - * should use Table::add_column() or the ADD_* - * macros in their init_schema() to define their schema - */ - virtual int init_schema(); - - // called after tables are created so clients can load - // initial sets of data - virtual int post_table_creation(); - - const char* path(); - const char* error(); - int connect(); - int connect(const char* path); - bool is_connected(); - - int begin_transaction(); - int rollback_transaction(); - int commit_transaction(); - - /** - * statement caching and execution - * - * - name is a string key that labels the query for caching purposes - * - output is where we will store the value requested - * - count is the number of sets of parameters - * - va_list should have sets of 3 (integer and text) or 4 (blob) - * parameters for WHERE clause like Column*, char, value(s) - * - Column* is the column to match against - * - char is how to compare, one of '=', '!', '>', or '<' - * - value(s) is the value to match - * - text columns require a char* arg - * - integer columns require a uint64_t arg - * - blob columns require 2 args in the list: - * - first is a uint8_t* of data - * - second is a uint32_t value for size of the data - * - */ - int count(const char* name, void** output, Table* table, uint32_t count, ...); - int get_value(const char* name, void** output, Table* table, Column* value_column, - uint32_t count, ...); - int get_column(const char* name, void** output, uint32_t* result_count, - Table* table, Column* column, uint32_t count, ...); - int get_row(const char* name, uint8_t** output, Table* table, uint32_t count, ...); - int get_row_ordered(const char* name, uint8_t** output, Table* table, Column* order_by, - int order, uint32_t count, ...); - int get_all_ordered(const char* name, uint8_t*** output, uint32_t* result_count, - Table* table, Column* order_by, int order, uint32_t count, ...); - int update_value(const char* name, Table* table, Column* value_column, void** value, - uint32_t count, ...); - int del(const char* name, Table* table, uint32_t count, ...); - - /** - * update/insert whole rows - * - * Given a table and a va_list in the same order as Table::add_column() - * calls, minus any primary key columns, bind and executes a sql query - * for insert or update. - * - * The Table is responsible for preparing the statement - * - * text columns require char* args - * integer columns require uint64_t args - * blob columns require 2 args in the list: - * - first is a uint8_t* of data - * - second is a uint32_t value for size of the data - * - */ - int update(Table* table, uint64_t pkvalue, ...); - int insert(Table* table, ...); - - // delete row with primary key equal to serial - int del(Table* table, uint64_t serial); - - uint64_t last_insert_id(); - - -protected: - - // pre- and post- connection work - int pre_connect(); - int post_connect(); - - int upgrade_schema(uint32_t version); - int upgrade_internal_schema(uint32_t version); - int init_internal_schema(); - int initial_data(); - - int get_information_value(const char* variable, char*** value); - int update_information_value(const char* variable, const char* value); - - // get and set version info in actual database - bool has_information_table(); - uint32_t get_schema_version(); - int set_schema_version(uint32_t version); - - // execute query with printf-style format, does not cache statement - int sql_once(const char* fmt, ...); - // cache statement with name, execute query with printf-style format - int sql(const char* name, const char* fmt, ...); - int execute(sqlite3_stmt* stmt); - - int add_table(Table*); - - // test if database has had its tables created - bool is_empty(); - // create tables for the client - int create_table(Table* table); - int create_tables(); - // create tables for ourselves - int create_internal_tables(); - - // bind all table columns from va_list - int bind_all_columns(sqlite3_stmt* stmt, Table* table, va_list args); - // bind each set of parameters from va_list - int bind_va_columns(sqlite3_stmt* stmt, uint32_t count, va_list args); - // bind parameters from va_list, starting with the param'th parameter in stmt - int bind_columns(sqlite3_stmt* stmt, uint32_t count, int param, - va_list args); - - /** - * step and store functions - */ - size_t store_column(sqlite3_stmt* stmt, int column, uint8_t* output); - int step_once(sqlite3_stmt* stmt, uint8_t* output, uint32_t* used); - int step_all(sqlite3_stmt* stmt, void** output, uint32_t size, uint32_t* count); - - // libcache - void init_cache(); - void destroy_cache(); - - char* m_path; - sqlite3* m_db; - - uint32_t m_schema_version; - Table* m_information_table; - sqlite3_stmt* m_get_information_value; - - Table** m_tables; - uint32_t m_table_count; - uint32_t m_table_max; - - cache_t* m_statement_cache; - - sqlite3_stmt* m_begin_transaction; - sqlite3_stmt* m_rollback_transaction; - sqlite3_stmt* m_commit_transaction; - - char* m_error; - size_t m_error_size; - - static const int TYPE_INTEGER = SQLITE_INTEGER; - static const int TYPE_TEXT = SQLITE3_TEXT; - static const int TYPE_BLOB = SQLITE_BLOB; - -}; - -// libcache callbacks -void cache_key_retain(void* key_in, void** key_out, void* user_data); -void cache_statement_retain(void* value, void* user_data); -void cache_statement_release(void* value, void* user_data); - -#endif diff --git a/darwinup/Depot.cpp b/darwinup/Depot.cpp deleted file mode 100644 index 7dad40e..0000000 --- a/darwinup/Depot.cpp +++ /dev/null @@ -1,1552 +0,0 @@ -/* - * Copyright (c) 2005-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 "Archive.h" -#include "Depot.h" -#include "File.h" -#include "SerialSet.h" -#include "Utils.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -Depot::Depot() { - m_prefix = NULL; - m_depot_path = NULL; - m_database_path = NULL; - m_archives_path = NULL; - m_downloads_path = NULL; - m_build = NULL; - m_db = NULL; - m_lock_fd = -1; - m_is_locked = 0; - m_depot_mode = 0750; - m_is_dirty = false; - m_modified_extensions = false; - m_modified_xpc_services = false; -} - -Depot::Depot(const char* prefix) { - m_lock_fd = -1; - m_is_locked = 0; - m_depot_mode = 0750; - m_build = NULL; - m_is_dirty = false; - m_modified_extensions = false; - m_modified_xpc_services = false; - - asprintf(&m_prefix, "%s", prefix); - join_path(&m_depot_path, m_prefix, "/.DarwinDepot"); - join_path(&m_database_path, m_depot_path, "/Database-V100"); - join_path(&m_archives_path, m_depot_path, "/Archives"); - join_path(&m_downloads_path, m_depot_path, "/Downloads"); -} - -Depot::~Depot() { - - // XXX: this is expensive, but is it necessary? - //this->check_consistency(); - - if (m_lock_fd != -1) this->unlock(); - delete m_db; - if (m_prefix) free(m_prefix); - if (m_depot_path) free(m_depot_path); - if (m_database_path) free(m_database_path); - if (m_archives_path) free(m_archives_path); - if (m_downloads_path) free(m_downloads_path); -} - -const char* Depot::archives_path() { return m_archives_path; } -const char* Depot::downloads_path() { return m_downloads_path; } -const char* Depot::prefix() { return m_prefix; } -bool Depot::is_dirty() { return m_is_dirty; } -bool Depot::has_modified_extensions() { return m_modified_extensions; } -bool Depot::has_modified_xpc_services(){ return m_modified_xpc_services; } - -int Depot::connect() { - m_db = new DarwinupDatabase(m_database_path); - if (!m_db || !m_db->is_connected()) { - fprintf(stderr, "Error: unable to connect to database.\n"); - return DB_ERROR; - } - return DB_OK; -} - -int Depot::create_storage() { - uid_t uid = getuid(); - gid_t gid = 0; - struct group *gs = getgrnam("admin"); - if (gs) { - gid = gs->gr_gid; - } - - int res = mkdir(m_depot_path, m_depot_mode); - if (res && errno != EEXIST) { - perror(m_depot_path); - return res; - } - - res = chmod(m_depot_path, m_depot_mode); - res = chown(m_depot_path, uid, gid); - if (res && errno != EEXIST) { - perror(m_depot_path); - return res; - } - res = mkdir(m_archives_path, m_depot_mode); - res = chmod(m_archives_path, m_depot_mode); - res = chown(m_archives_path, uid, gid); - if (res && errno != EEXIST) { - perror(m_archives_path); - return res; - } - - res = mkdir(m_downloads_path, m_depot_mode); - res = chmod(m_downloads_path, m_depot_mode); - res = chown(m_downloads_path, uid, gid); - if (res && errno != EEXIST) { - perror(m_downloads_path); - return res; - } - return DEPOT_OK; -} - -// Initialize the depot -int Depot::initialize(bool writable) { - int res = 0; - - // initialization requires all these paths to be set - if (!(m_prefix && m_depot_path && m_database_path && - m_archives_path && m_downloads_path)) { - return DEPOT_ERROR; - } - - if (writable) { - uid_t uid = getuid(); - if (uid) { - fprintf(stdout, "You must be root to perform that operation.\n"); - exit(3); - } - - res = this->create_storage(); - if (res) return res; -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - build_number_for_path(&m_build, m_prefix); -#else - m_build = (char*)calloc(1, 2); - snprintf(m_build, 2, " "); -#endif - } - - struct stat sb; - res = stat(m_database_path, &sb); - if (!writable && res == -1 && (errno == ENOENT || errno == ENOTDIR)) { - // depot does not exist - return DEPOT_NOT_EXIST; - } - if (!writable && res == -1 && errno == EACCES) { - // permission denied - return DEPOT_PERM_DENIED; - } - - // take an exclusive lock - res = this->lock(LOCK_EX); - if (res) return res; - m_is_locked = 1; - - res = this->connect(); - - return res; -} - -int Depot::is_initialized() { - return (m_db != NULL); -} - -// Unserialize an archive from the database. -// Find the archive by UUID. -Archive* Depot::archive(uuid_t uuid) { - int res = 0; - Archive* archive = NULL; - uint8_t* data; - - res = this->m_db->get_archive(&data, uuid); - if (FOUND(res)) archive = this->m_db->make_archive(data); - return archive; -} - -// Unserialize an archive from the database. -// Find the archive by serial. -Archive* Depot::archive(uint64_t serial) { - int res = 0; - Archive* archive = NULL; - uint8_t* data; - - res = this->m_db->get_archive(&data, serial); - if (FOUND(res)) archive = this->m_db->make_archive(data); - - return archive; -} - -// Unserialize an archive from the database. -// Find the last archive installed with this name -Archive* Depot::archive(archive_name_t name) { - int res = 0; - Archive* archive = NULL; - uint8_t* data; - - res = this->m_db->get_archive(&data, name); - if (FOUND(res)) archive = this->m_db->make_archive(data); - return archive; -} - -Archive* Depot::archive(archive_keyword_t keyword) { - int res = 0; - Archive* archive = NULL; - uint8_t* data; - - res = this->m_db->get_archive(&data, keyword); - if (FOUND(res)) archive = this->m_db->make_archive(data); - return archive; -} - -// Return Archive from database matching arg, which is one of: -// -// uuid (ex: 22969F32-9C4F-4370-82C8-DD3609736D8D) -// serial (ex: 12) -// name (ex root.tar.gz) -// keyword (either "newest" for the most recent root installed -// or "oldest" for the oldest installed root) -// -Archive* Depot::get_archive(const char* arg) { - - // test for arg being a uuid - uuid_t uuid; - if (uuid_parse(arg, uuid) == 0) { - return Depot::archive(uuid); - } - - // test for arg being a serial number - uint64_t serial; - char* endptr = NULL; - serial = strtoull(arg, &endptr, 0); - if (serial && (*arg != '\0') && (*endptr == '\0')) { - return Depot::archive(serial); - } - - // test for keywords - if (strncasecmp("oldest", arg, 6) == 0) { - return Depot::archive(DEPOT_ARCHIVE_OLDEST); - } - if (strncasecmp("newest", arg, 6) == 0) { - return Depot::archive(DEPOT_ARCHIVE_NEWEST); - } - - // if nothing else, must be an archive name - return Depot::archive((archive_name_t)arg); -} - -Archive** Depot::get_all_archives(uint32_t* count) { - extern uint32_t verbosity; - int res = DB_OK; - uint8_t** archlist; - res = this->m_db->get_archives(&archlist, count, verbosity & VERBOSE_DEBUG); - - Archive** list = (Archive**)malloc(sizeof(Archive*) * (*count)); - if (!list) { - fprintf(stderr, "Error: ran out of memory in Depot::get_all_archives\n"); - return NULL; - } - if (FOUND(res)) { - for (uint32_t i=0; i < *count; i++) { - Archive* archive = this->m_db->make_archive(archlist[i]); - if (archive) { - list[i] = archive; - } else { - fprintf(stderr, "%s:%d: DB::make_archive returned NULL\n", - __FILE__, __LINE__); - res = -1; - break; - } - } - } - - return list; -} - -Archive** Depot::get_superseded_archives(uint32_t* count) { - int res = DB_OK; - uint8_t** archlist; - res = this->m_db->get_archives(&archlist, count, false); // rollbacks cannot be superseded - - Archive** list = (Archive**)malloc(sizeof(Archive*) * (*count)); - if (!list) { - fprintf(stderr, "Error: ran out of memory in Depot::get_superseded_archives\n"); - return NULL; - } - - uint32_t i = 0; - uint32_t cur = i; - if (FOUND(res)) { - while (i < *count) { - Archive* archive = this->m_db->make_archive(archlist[i++]); - if (archive && this->is_superseded(archive)) { - list[cur++] = archive; - } else if (!archive) { - fprintf(stderr, "%s:%d: DB::make_archive returned NULL\n", - __FILE__, __LINE__); - res = -1; - break; - } - } - } - // adjust count based on our is_superseded filtering - *count = cur; - return list; -} - -uint64_t Depot::count_archives() { - extern uint32_t verbosity; - uint64_t c = this->m_db->count_archives((bool)(verbosity & VERBOSE_DEBUG)); - return c; -} - -struct InstallContext { - InstallContext(Depot* d, Archive* a) { - depot = d; - archive = a; - files_modified = 0; - files_added = 0; - files_removed = 0; - files_to_remove = new SerialSet(); - reverse_files = false; - } - - ~InstallContext() { - delete files_to_remove; - } - - Depot* depot; - Archive* archive; - uint64_t files_modified; - uint64_t files_added; - uint64_t files_removed; - SerialSet* files_to_remove; // for uninstall - bool reverse_files; // for uninstall -}; - -int Depot::iterate_archives(ArchiveIteratorFunc func, void* context) { - int res = 0; - uint32_t count = 0; - Archive** list = this->get_all_archives(&count); - for (uint32_t i = 0; i < count; i++) { - if (list[i]) { - res = func(list[i], context); - delete list[i]; - } - } - return res; -} - -int Depot::iterate_files(Archive* archive, FileIteratorFunc func, void* context) { - int res = DB_OK; - uint8_t** filelist; - uint32_t count; - bool reverse = false; - if (context) reverse = ((InstallContext*)context)->reverse_files; - res = this->m_db->get_files(&filelist, &count, archive, reverse); - if (FOUND(res)) { - for (uint32_t i=0; i < count; i++) { - File* file = this->m_db->make_file(filelist[i]); - if (file) { - res = func(file, context); - delete file; - } else { - fprintf(stderr, "%s:%d: DB::make_file returned NULL\n", __FILE__, __LINE__); - res = -1; - break; - } - } - } - - return res; -} - -int Depot::analyze_stage(const char* path, Archive* archive, Archive* rollback, - int* rollback_files) { - extern uint32_t force; - extern uint32_t dryrun; - int res = 0; - assert(archive != NULL); - assert(rollback != NULL); - assert(rollback_files != NULL); - - *rollback_files = 0; - - const char* path_argv[] = { path, NULL }; - - IF_DEBUG("[analyze] analyzing path: %s\n", path); - - FTS* fts = fts_open((char**)path_argv, FTS_PHYSICAL | FTS_COMFOLLOW | FTS_XDEV, fts_compare); - FTSENT* ent = fts_read(fts); // throw away the entry for path itself - while (res != -1 && (ent = fts_read(fts)) != NULL) { - File* file = FileFactory(archive, ent); - if (file) { - char state = '?'; - - IF_DEBUG("[analyze] %s\n", file->path()); - - if (strcasestr(file->path(), ".DarwinDepot")) { - fprintf(stderr, "Error: Root contains a .DarwinDepot, " - "aborting to avoid damaging darwinup metadata.\n"); - return DEPOT_ERROR; - } - - // Perform a three-way-diff between the file to be installed (file), - // the file we last installed in this location (preceding), - // and the file that actually exists in this location (actual). - - char* actpath; - join_path(&actpath, this->prefix(), file->path()); - File* actual = FileFactory(actpath); - File* preceding = this->file_preceded_by(file); - - if (actual == NULL) { - // No actual file exists already, so we create a placeholder. - actual = new NoEntry(file->path()); - IF_DEBUG("[analyze] actual == NULL\n"); - } - - if (preceding == NULL) { - // Nothing is known about this file. - // We'll insert this file into the rollback archive as a - // base system file. Back up its data (if not a directory). - actual->info_set(FILE_INFO_BASE_SYSTEM); - IF_DEBUG("[analyze] base system\n"); - if (!S_ISDIR(actual->mode()) && !INFO_TEST(actual->info(), FILE_INFO_NO_ENTRY)) { - IF_DEBUG("[analyze] needs base system backup, and installation\n"); - actual->info_set(FILE_INFO_ROLLBACK_DATA); - file->info_set(FILE_INFO_INSTALL_DATA); - } - // if actual is a dir and file is not, recurse to save its children - if (S_ISDIR(actual->mode()) && !S_ISDIR(file->mode())) { - IF_DEBUG("[analyze] directory being replaced by file, save children\n"); - const char* sub_argv[] = { actual->path(), NULL }; - FTS* subfts = fts_open((char**)sub_argv, - FTS_PHYSICAL | FTS_COMFOLLOW | FTS_XDEV, - fts_compare); - FTSENT* subent = fts_read(subfts); // throw away actual - while ((subent = fts_read(subfts)) != NULL) { - IF_DEBUG("saving child: %s\n", subent->fts_path); - // skip post-order visits - if (subent->fts_info == FTS_DP) { - continue; - } - File* subact = FileFactory(subent->fts_path); - subact->info_set(FILE_INFO_BASE_SYSTEM); - if (subent->fts_info != FTS_D) { - IF_DEBUG("saving file data\n"); - subact->info_set(FILE_INFO_ROLLBACK_DATA); - } - if (!dryrun) { - res = this->insert(rollback, subact); - } - *rollback_files += 1; - } - } - preceding = actual; - } - - uint32_t actual_flags = File::compare(file, actual); - uint32_t preceding_flags = File::compare(actual, preceding); - - // If file == actual && actual == preceding then nothing needs to be done. - if (actual_flags == FILE_INFO_IDENTICAL && preceding_flags == FILE_INFO_IDENTICAL) { - state = ' '; - IF_DEBUG("[analyze] no changes\n"); - } - - // If file != actual, but actual == preceding, then install file - // but we don't need to save actual, since it's already saved by preceding. - // i.e. no user changes since last installation - // If file != actual, and actual != preceding, then install file - // after saving actual in the rollback archive. - // i.e. user changes since last installation - if (actual_flags != FILE_INFO_IDENTICAL) { - this->m_is_dirty = true; - if (INFO_TEST(actual->info(), FILE_INFO_NO_ENTRY)) { - state = 'A'; - } else { - if (INFO_TEST(actual_flags, FILE_INFO_TYPE_DIFFERS) && !force) { - // the existing file on disk is a different type than what - // we are trying to install, so require the force option, - // otherwise print an error and bail - mode_t file_type = file->mode() & S_IFMT; - mode_t actual_type = actual->mode() & S_IFMT; - fprintf(stderr, FILE_OBJ_CHANGE_ERROR, actual->path(), - FILE_TYPE_STRING(file_type), - FILE_TYPE_STRING(actual_type)); - return DEPOT_OBJ_CHANGE; - } - state = 'U'; - } - - - - if (INFO_TEST(actual_flags, FILE_INFO_TYPE_DIFFERS) || - INFO_TEST(actual_flags, FILE_INFO_DATA_DIFFERS)) { - IF_DEBUG("[analyze] needs installation\n"); - file->info_set(FILE_INFO_INSTALL_DATA); - - if ((INFO_TEST(preceding_flags, FILE_INFO_TYPE_DIFFERS) || - INFO_TEST(preceding_flags, FILE_INFO_DATA_DIFFERS)) && - !INFO_TEST(actual->info(), FILE_INFO_NO_ENTRY)) { - IF_DEBUG("[analyze] needs user data backup\n"); - actual->info_set(FILE_INFO_ROLLBACK_DATA); - } - } - - if (!this->m_modified_extensions && - (strncmp(file->path(), "/System/Library/Extensions", 26) == 0)) { - IF_DEBUG("[analyze] kernel extension detected\n"); - this->m_modified_extensions = true; - } - - if (!this->m_modified_xpc_services) { - if ((strstr(file->path(), ".xpc/") != NULL) && has_suffix(file->path(), "Info.plist")) { - IF_DEBUG("[analyze] xpc service detected\n"); - this->m_modified_xpc_services = true; - } - - if ((strncmp(file->path(), "/System/Library/Sandbox/Profiles", 32) == 0) || - (has_suffix(file->path(), "framework.sb"))) { - IF_DEBUG("[analyze] profile modification detected\n"); - this->m_modified_xpc_services = true; - } - } - } - - // if file == actual, but actual != preceding, then an external - // process changed actual to be the same as what we are installing - // now (OS upgrade?). We do not need to save actual, but make - // a special state so the user knows what happened and does not - // get a ?. - if (actual_flags == FILE_INFO_IDENTICAL && preceding_flags != FILE_INFO_IDENTICAL) { - IF_DEBUG("[analyze] external changes but file same as actual\n"); - state = 'E'; - } - - if ((state != ' ' && preceding_flags != FILE_INFO_IDENTICAL) || - INFO_TEST(actual->info(), FILE_INFO_BASE_SYSTEM | FILE_INFO_ROLLBACK_DATA)) { - *rollback_files += 1; - if (!this->has_file(rollback, actual)) { - IF_DEBUG("[analyze] insert rollback\n"); - if (!dryrun) res = this->insert(rollback, actual); - } - assert(res == 0); - - if (!INFO_TEST(actual->info(), FILE_INFO_NO_ENTRY)) { - // need to save parent directories as well - FTSENT *pent = ent->fts_parent; - - // while we have a valid path that is below the prefix - while (pent && pent->fts_level > 0) { - File* parent = FileFactory(rollback, pent); - - // if parent dir does not exist, we are - // generating a rollback of base system - // which does not have matching directories, - // so we can just move on. - if (!parent) { - IF_DEBUG("[analyze] parent path not found, skipping parents\n"); - break; - } - - if (!this->has_file(rollback, parent)) { - IF_DEBUG("[analyze] adding parent to rollback: %s \n", - parent->path()); - if (!dryrun) res = this->insert(rollback, parent); - } - assert(res == 0); - pent = pent->fts_parent; - } - } - } - - fprintf(stdout, "%c %s\n", state, file->path()); - if (!dryrun) res = this->insert(archive, file); - assert(res == 0); - if (preceding && preceding != actual) delete preceding; - if (actual) delete actual; - free(actpath); - delete file; - } - } - if (fts) fts_close(fts); - return res; -} - -int Depot::backup_file(File* file, void* ctx) { - InstallContext* context = (InstallContext*)ctx; - int res = 0; - - IF_DEBUG("[backup] backup_file: %s , %s \n", file->path(), context->archive->m_name); - - if (INFO_TEST(file->info(), FILE_INFO_ROLLBACK_DATA)) { - char *path; // the file's path - char *dstpath; // the path inside the archives - char *relpath; // the file's path minus the destination prefix - char *uuidpath; // archives path plus the uuid - char uuidstr[37]; - - // If we're going to need to squirrel away data, create - // the directory hierarchy now. - char backup_path[PATH_MAX]; - char* backup_dirpath; - - // we need the path minus our destination prefix for moving to the archive - IF_DEBUG("[backup] file->path() = %s \n", file->path()); - strlcpy(backup_path, file->path(), sizeof(backup_path)); - IF_DEBUG("[backup] backup_path = %s \n", backup_path); - - const char* dir = dirname(backup_path); - assert(dir != NULL); - IF_DEBUG("[backup] dir = %s \n", dir); - - uuid_unparse_upper(context->archive->uuid(), uuidstr); - asprintf(&uuidpath, "%s/%s", context->depot->m_archives_path, uuidstr); - assert(uuidpath != NULL); - IF_DEBUG("[backup] uuidpath = %s \n", uuidpath); - join_path(&backup_dirpath, uuidpath, dir); - assert(backup_dirpath != NULL); - - IF_DEBUG("mkdir_p: %s\n", backup_dirpath); - res = mkdir_p(backup_dirpath); - if (res != 0 && errno != EEXIST) { - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, backup_dirpath, strerror(errno), errno); - } else { - res = 0; - } - - // we need the path minus our destination path for moving to the archive - size_t prefixlen = strlen(context->depot->m_prefix); - if (strncmp(context->archive->m_name, "", strlen("")) == 0) { - join_path(&path, context->depot->m_prefix, file->path()); - } else { - asprintf(&path, "%s", file->path()); - } - relpath = path; - if (strncmp(path, context->depot->m_prefix, prefixlen) == 0) { - relpath += prefixlen - 1; - } - - join_path(&dstpath, uuidpath, relpath); - assert(dstpath != NULL); - - IF_DEBUG("[backup] path = %s \n", path); - IF_DEBUG("[backup] relpath = %s \n", relpath); - IF_DEBUG("[backup] dstpath = %s \n", dstpath); - - - ++context->files_modified; - - // XXX: res = file->backup() - IF_DEBUG("[backup] copyfile(%s, %s)\n", path, dstpath); - res = copyfile(path, dstpath, NULL, COPYFILE_ALL|COPYFILE_NOFOLLOW); - - if (res != 0) fprintf(stderr, "%s:%d: backup failed: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), errno); - - // XXX: we cant propagate error from callback, but its safe to die here - assert(res == 0); - - free(path); - free(dstpath); - free(uuidpath); - free(backup_dirpath); - } - return res; -} - - -int Depot::install_file(File* file, void* ctx) { - InstallContext* context = (InstallContext*)ctx; - int res = 0; - - // Strip the quarantine xattr off all files to avoid them being rendered useless. - if (file->unquarantine(context->depot->m_archives_path) != 0) { - fprintf(stderr, "Error: unable to unquarantine file in staging area.\n"); - return DEPOT_ERROR; - } - - if (INFO_TEST(file->info(), FILE_INFO_INSTALL_DATA)) { - ++context->files_modified; - - res = file->install(context->depot->m_archives_path, - context->depot->m_prefix, - context->reverse_files); - } else { - res = file->install_info(context->depot->m_prefix); - } - if (res != 0) fprintf(stderr, "%s:%d: install failed: %s: %s (%d)\n", - __FILE__, __LINE__, file->path(), strerror(errno), errno); - return res; -} - - -int Depot::install(const char* path) { - int res = 0; - char uuid[37]; - Archive* archive = ArchiveFactory(path, this->downloads_path()); - if (archive) { - res = this->install(archive); - if (res == 0) { - fprintf(stdout, "Installed archive: %llu %s \n", - archive->serial(), archive->name()); - uuid_unparse_upper(archive->uuid(), uuid); - fprintf(stdout, "%s\n", uuid); - } else { - fprintf(stderr, "Error: Install failed.\n"); - if (res != DEPOT_OBJ_CHANGE && res != DEPOT_PREINSTALL_ERR) { - // object change errors come from analyze stage, - // and pre-install errors happen early, - // so there is no installation to roll back - fprintf(stderr, "Rolling back installation.\n"); - res = this->uninstall(archive); - if (res) { - fprintf(stderr, "Error: Unable to rollback installation. " - "Your system is in an inconsistent state! File a bug!\n"); - } else { - fprintf(stdout, "Rollback successful.\n"); - } - } - res = DEPOT_ERROR; - } - } else { - fprintf(stdout, "Error: unable to load \"%s\". Either the path is missing, invalid or" - " the file is in an unknown format.\n", path); - return DEPOT_ERROR; - } - - return res; -} - - -int Depot::install(Archive* archive) { - extern uint32_t dryrun; - int res = 0; - Archive* rollback = new RollbackArchive(); - - if (this->m_build) { - rollback->m_build = strdup(this->m_build); - archive->m_build = strdup(this->m_build); - } - - assert(rollback != NULL); - assert(archive != NULL); - - if (res != 0) return res; - - // - // The fun starts here - // - if (!dryrun && res == 0) res = this->begin_transaction(); - - // - // Insert the rollback archive before the new archive to install, thus keeping - // the chronology of the serial numbers correct. We may later choose to delete - // the rollback archive if we determine that it was not necessary. - // - if (!dryrun && res == 0) res = this->insert(rollback); - if (!dryrun && res == 0) res = this->insert(archive); - - // - // Create the stage directory and rollback backing store directories - // - char* archive_path = archive->create_directory(m_archives_path); - assert(archive_path != NULL); - char* rollback_path = rollback->create_directory(m_archives_path); - assert(rollback_path != NULL); - - // Extract the archive into its backing store directory - if (res == 0) res = archive->extract(archive_path); - - // Analyze the files in the archive backing store directory - // Inserts new file records into the database for both the new archive being - // installed and the rollback archive. - int rollback_files = 0; - if (res == 0) res = this->analyze_stage(archive_path, archive, rollback, &rollback_files); - - // we can stop now if analyze failed or this is a dry run - if (res || dryrun) { - remove_directory(archive_path); - remove_directory(rollback_path); - free(rollback_path); - free(archive_path); - if (!dryrun && res) { - this->rollback_transaction(); - return DEPOT_PREINSTALL_ERR; - } - return res; - } - - // If no files were added to the rollback archive, delete the rollback archive. - if (res == 0 && rollback_files == 0) { - res = this->remove(rollback); - } - - // Commit the archive and its list of files to the database. - // Note that the archive's "active" flag is still not set. - if (res == 0) { - res = this->commit_transaction(); - } else { - this->rollback_transaction(); - } - - // Save a copy of the backing store directory now, we will soon - // be moving the files into place. - if (res == 0) res = archive->compact_directory(m_archives_path); - - // - // Move files from the root file system to the rollback archive's backing store, - // then move files from the archive backing directory to the root filesystem - // - InstallContext rollback_context(this, rollback); - if (res == 0) res = this->iterate_files(rollback, &Depot::backup_file, &rollback_context); - - // compact the rollback archive (if we actually added any files) - if (rollback_context.files_modified > 0) { - if (res == 0) res = rollback->compact_directory(m_archives_path); - } - - InstallContext install_context(this, archive); - if (res == 0) res = this->iterate_files(archive, &Depot::install_file, &install_context); - - // Installation is complete. Activate the archive in the database. - if (res == 0) res = this->begin_transaction(); - if (res == 0) { - res = this->m_db->activate_archive(rollback->serial()); - if (res) this->rollback_transaction(); - } - if (res == 0) { - res = this->m_db->activate_archive(archive->serial()); - if (res) this->rollback_transaction(); - } - if (res == 0) res = this->commit_transaction(); - - // Remove the stage and rollback directories (save disk space) - remove_directory(archive_path); - remove_directory(rollback_path); - free(rollback_path); - free(archive_path); - - return res; -} - -// deletes expanded backing store directories in m_archives_path -int Depot::prune_directories() { - int res = 0; - - const char* path_argv[] = { m_archives_path, NULL }; - - FTS* fts = fts_open((char**)path_argv, FTS_PHYSICAL | FTS_COMFOLLOW | FTS_XDEV, fts_compare); - FTSENT* ent = fts_read(fts); // get the entry for m_archives_path itself - ent = fts_children(fts, 0); - while (res != -1 && ent != NULL) { - if (ent->fts_info == FTS_D) { - char path[PATH_MAX]; - snprintf(path, PATH_MAX, "%s/%s", m_archives_path, ent->fts_name); - res = remove_directory(path); - } - ent = ent->fts_link; - } - if (fts) fts_close(fts); - return res; -} - -// delete the unexpanded tarball from archives storage -int Depot::prune_archive(Archive* archive) { - int res = 0; - - // clean up database - res = this->m_db->delete_empty_archives(); - if (res) { - fprintf(stderr, "Error: unable to prune archives from database.\n"); - return res; - } - - // clean up disk - res = archive->prune_compacted_archive(m_archives_path); - return res; -} - -int Depot::uninstall_file(File* file, void* ctx) { - extern uint32_t dryrun; - InstallContext* context = (InstallContext*)ctx; - int res = 0; - char state = ' '; - - IF_DEBUG("[uninstall] %s\n", file->path()); - - // We never uninstall a file that was part of the base system - if (INFO_TEST(file->info(), FILE_INFO_BASE_SYSTEM)) { - IF_DEBUG("[uninstall] base system; skipping\n"); - return DEPOT_OK; - } - - char* actpath; - join_path(&actpath, context->depot->m_prefix, file->path()); - IF_DEBUG("[uninstall] actual path is %s\n", actpath); - File* actual = FileFactory(actpath); - uint32_t flags = File::compare(file, actual); - - if (actual == NULL) { - IF_DEBUG("[uninstall] actual file missing, " - "possibly due to parent being removed already\n"); - state = '!'; - } else if (flags != FILE_INFO_IDENTICAL) { - IF_DEBUG("[uninstall] changes since install; skipping\n"); - } else { - File* superseded = context->depot->file_superseded_by(file); - if (superseded == NULL) { - // no one's using this file anymore - File* preceding = context->depot->file_preceded_by(file); - assert(preceding != NULL); - if (INFO_TEST(preceding->info(), FILE_INFO_NO_ENTRY)) { - context->depot->m_is_dirty = true; - state = 'R'; - IF_DEBUG("[uninstall] removing file\n"); - if (!dryrun && actual && res == 0) res = actual->remove(); - } else { - // copy the preceding file back out to the system - // if it's different from what's already there - uint32_t flags = File::compare(file, preceding); - if (INFO_TEST(flags, FILE_INFO_DATA_DIFFERS)) { - context->depot->m_is_dirty = true; - state = 'U'; - IF_DEBUG("[uninstall] restoring\n"); - if (!dryrun && res == 0) { - if (INFO_TEST(flags, FILE_INFO_TYPE_DIFFERS) && - S_ISDIR(preceding->mode())) { - // use rename instead of mkdir so children are restored - res = preceding->dirrename(context->depot->m_archives_path, - context->depot->m_prefix, - context->reverse_files); - - } else { - res = preceding->install(context->depot->m_archives_path, - context->depot->m_prefix, - context->reverse_files); - } - } - } else if (INFO_TEST(flags, FILE_INFO_MODE_DIFFERS) || - INFO_TEST(flags, FILE_INFO_GID_DIFFERS) || - INFO_TEST(flags, FILE_INFO_UID_DIFFERS)) { - context->depot->m_is_dirty = true; - state = 'M'; - if (!dryrun && res == 0) { - res = preceding->install_info(context->depot->m_prefix); - } - } else { - IF_DEBUG("[uninstall] no changes; leaving in place\n"); - } - if (!context->depot->m_modified_extensions && - (strncmp(file->path(), "/System/Library/Extensions", 26) == 0)) { - IF_DEBUG("[uninstall] kernel extension detected\n"); - context->depot->m_modified_extensions = true; - } - } - uint64_t info = preceding->info(); - if (INFO_TEST(info, FILE_INFO_NO_ENTRY | FILE_INFO_ROLLBACK_DATA) && - !INFO_TEST(info, FILE_INFO_BASE_SYSTEM)) { - if (!dryrun && res == 0) { - res = context->files_to_remove->add(preceding->serial()); - } - } - delete preceding; - } else { - IF_DEBUG("[uninstall] in use by newer installation; leaving in place\n"); - delete superseded; - } - } - - fprintf(stdout, "%c %s\n", state, file->path()); - - if (res != 0) fprintf(stderr, "%s:%d: uninstall failed: %s\n", - __FILE__, __LINE__, file->path()); - - free(actpath); - return res; -} - -int Depot::uninstall(Archive* archive) { - extern uint32_t verbosity; - extern uint32_t force; - extern uint32_t dryrun; - int res = 0; - - assert(archive != NULL); - uint64_t serial = archive->serial(); - - if (INFO_TEST(archive->info(), ARCHIVE_INFO_ROLLBACK)) { - // if in debug mode, get_all_archives returns rollbacks too, so just ignore - if (verbosity & VERBOSE_DEBUG) { - fprintf(stderr, "[uninstall] skipping uninstall since archive is a rollback.\n"); - return DEPOT_OK; - } - fprintf(stderr, "%s:%d: cannot uninstall a rollback archive.\n", __FILE__, __LINE__); - return DEPOT_ERROR; - } - - /** - * require -f to force uninstalling an archive installed on top of an older - * base system since the rollback archive we'll use will potentially damage - * the base system. - */ - if (!force && - this->m_build && - archive->build() && - (strcmp(this->m_build, archive->build()) != 0) && - !this->is_superseded(archive) - ) { - fprintf(stderr, - "-------------------------------------------------------------------------------\n" - "The %s root was installed on a different base OS build (%s). The current \n" - "OS build is %s. Uninstalling a root that was installed on a different OS \n" - "build has the potential to damage your OS install due to the fact that the \n" - "rollback data is from the wrong OS version.\n\n" - " You must use the force (-f) option to make this potentially unsafe operation \n" - "happen.\n" - "-------------------------------------------------------------------------------\n", - archive->name(), archive->build(), m_build); - return DEPOT_BUILD_MISMATCH; - } - - if (res != 0) return res; - - if (!dryrun) { - // XXX: this may be superfluous - // uninstall_file should be smart enough to do a mtime check... - if (res == 0) res = this->prune_directories(); - - // We do this here to get an exclusive lock on the database. - if (res == 0) res = this->begin_transaction(); - if (res == 0) res = m_db->deactivate_archive(serial); - if (res == 0) res = this->commit_transaction(); - } - - InstallContext context(this, archive); - context.reverse_files = true; // uninstall children before parents - if (res == 0) res = this->iterate_files(archive, &Depot::uninstall_file, &context); - - if (!dryrun) { - if (res == 0) res = this->begin_transaction(); - uint32_t i; - for (i = 0; i < context.files_to_remove->count; ++i) { - uint64_t serial = context.files_to_remove->values[i]; - if (res == 0) res = m_db->delete_file(serial); - } - if (res == 0) res = this->commit_transaction(); - - if (res == 0) res = this->begin_transaction(); - if (res == 0) res = this->remove(archive); - if (res == 0) res = this->commit_transaction(); - - // delete all of the expanded archive backing stores to save disk space - if (res == 0) res = this->prune_directories(); - - if (res == 0) res = this->prune_archive(archive); - } - - if (res == 0) fprintf(stdout, "Uninstalled archive: %llu %s \n", - archive->serial(), archive->name()); - - return res; -} - -int Depot::verify_file(File* file, void* context) { - File* actual = FileFactory(file->path()); - if (actual) { - uint32_t flags = File::compare(file, actual); - - if (flags != FILE_INFO_IDENTICAL) { - fprintf(stdout, "M "); - } else { - fprintf(stdout, " "); - } - } else { - fprintf(stdout, "R "); - } - file->print(stdout); - return DEPOT_OK; -} - -void Depot::archive_header() { - fprintf(stdout, "%-6s %-36s %-12s %-7s %s\n", - "Serial", "UUID", "Date", "Build", "Name"); - fprintf(stdout, "====== ==================================== " - "============ ======= =================\n"); -} - -int Depot::verify(Archive* archive) { - int res = 0; - this->archive_header(); - list_archive(archive, stdout); - hr(); - if (res == 0) res = this->iterate_files(archive, &Depot::verify_file, NULL); - hr(); - fprintf(stdout, "\n"); - return res; -} - -int Depot::list_archive(Archive* archive, void* context) { - uint64_t serial = archive->serial(); - - char uuid[37]; - uuid_unparse_upper(archive->uuid(), uuid); - - char date[100]; - struct tm local; - time_t seconds = archive->date_installed(); - localtime_r(&seconds, &local); - strftime(date, sizeof(date), "%b %e %H:%M", &local); - - fprintf((FILE*)context, "%-6llu %-36s %-12s %-7s %s\n", - serial, uuid, date, (archive->build()?archive->build():""), archive->name()); - - return DEPOT_OK; -} - -int Depot::list() { - return this->list(0, NULL); -} - -int Depot::list(int count, char** args) { - int res = 0; - - this->archive_header(); - - // handle the default case of "all" - if (count == 0) return this->iterate_archives(&Depot::list_archive, stdout); - - Archive** list; - Archive* archive; - uint32_t archcnt; - for (int i = 0; res == 0 && i < count; i++) { - list = NULL; - archive = NULL; - archcnt = 0; - // check for special keywords - if (strncasecmp(args[i], "all", 3) == 0 && strlen(args[i]) == 3) { - list = this->get_all_archives(&archcnt); - } else if (strncasecmp(args[i], "superseded", 10) == 0 && strlen(args[i]) == 10) { - list = this->get_superseded_archives(&archcnt); - } - if (archcnt) { - // loop over special keyword results - for (uint32_t j = 0; res == 0 && j < archcnt; j++) { - res = this->list_archive(list[j], stdout); - } - } else { - // arg is a single-archive specifier - archive = this->get_archive(args[i]); - if (archive) res = this->list_archive(archive, stdout); - } - } - - return res; -} - -int Depot::print_file(File* file, void* context) { - extern uint32_t verbosity; - if (verbosity & VERBOSE_DEBUG) fprintf((FILE*)context, "%04llx ", file->info()); - file->print((FILE*)context); - return DEPOT_OK; -} - -int Depot::files(Archive* archive) { - int res = 0; - this->archive_header(); - list_archive(archive, stdout); - hr(); - if (res == 0) res = this->iterate_files(archive, &Depot::print_file, stdout); - hr(); - fprintf(stdout, "\n"); - return res; -} - -int Depot::dump_archive(Archive* archive, void* context) { - Depot* depot = (Depot*)context; - int res = 0; - list_archive(archive, stdout); - hr(); - if (res == 0) res = depot->iterate_files(archive, &Depot::print_file, stdout); - hr(); - fprintf(stdout, "\n"); - return res; -} - -int Depot::dump() { - extern uint32_t verbosity; - verbosity = 0xFFFFFFFF; // dump is intrinsically a debug command - int res = 0; - this->archive_header(); - if (res == 0) res = this->iterate_archives(&Depot::dump_archive, this); - return res; -} - - -File* Depot::file_superseded_by(File* file) { - uint8_t* data; - int res = this->m_db->get_next_file(&data, file, FILE_SUPERSEDED); - if (FOUND(res)) return this->m_db->make_file(data); - return NULL; -} - -File* Depot::file_preceded_by(File* file) { - uint8_t* data; - int res = this->m_db->get_next_file(&data, file, FILE_PRECEDED); - if (FOUND(res)) return this->m_db->make_file(data); - return NULL; -} - -int Depot::check_consistency() { - int res = 0; - - SerialSet* inactive = new SerialSet(); - assert(inactive != NULL); - - // get inactive archives serials from the database - uint64_t* serials; - uint32_t count; - this->m_db->get_inactive_archive_serials(&serials, &count); - for (uint32_t i=0; i < count; i++) { - inactive->add(serials[i]); - } - free(serials); - - // print a list of inactive archives - if (res == 0 && inactive && inactive->count > 0) { - fprintf(stderr, "The following archive%s in an inconsistent state and must be uninstalled " - "before proceeding:\n\n", inactive->count > 1 ? "s are" : " is"); - uint32_t i; - this->archive_header(); - for (i = 0; i < inactive->count; ++i) { - Archive* archive = this->archive(inactive->values[i]); - if (archive) { - list_archive(archive, stdout); - delete archive; - } - } - fprintf(stderr, "\nWould you like to uninstall %s now? [y/n] ", - inactive->count > 1 ? "them" : "it"); - int c = getchar(); - fprintf(stderr, "\n"); - if (c == 'y' || c == 'Y') { - for (i = 0; i < inactive->count; ++i) { - Archive* archive = this->archive(inactive->values[i]); - if (archive) { - res = this->uninstall(archive); - delete archive; - } - if (res != 0) break; - } - } - } - - return res; -} - - -int Depot::begin_transaction() { - return this->m_db->begin_transaction(); -} - -int Depot::rollback_transaction() { - return this->m_db->rollback_transaction(); -} - -int Depot::commit_transaction() { - return this->m_db->commit_transaction(); -} - -int Depot::is_locked() { return m_is_locked; } - -bool Depot::is_superseded(Archive* archive) { - // return early if already known - if (archive->m_is_superseded != -1) { - return (archive->m_is_superseded == 1); - } - - // need to find out if superseded - int res = DB_OK; - uint8_t** filelist; - uint8_t* data; - uint32_t count; - res = this->m_db->get_files(&filelist, &count, archive, false); - if (FOUND(res)) { - for (uint32_t i=0; i < count; i++) { - File* file = this->m_db->make_file(filelist[i]); - - // check for being superseded by a root - res = this->m_db->get_next_file(&data, file, FILE_SUPERSEDED); - this->m_db->free_file(data); - if (FOUND(res)) continue; - - // check for being superseded by external changes - char* actpath; - join_path(&actpath, this->prefix(), file->path()); - File* actual = FileFactory(actpath); - free(actpath); - uint32_t flags = File::compare(file, actual); - - // not found in database and no changes on disk, - // so file is the current version of actual - if (flags == FILE_INFO_IDENTICAL) { - archive->m_is_superseded = 0; - return false; - } - - // something external changed contents of actual, - // so we consider this file superseded (by OS upgrade?) - } - } - archive->m_is_superseded = 1; - return true; -} - -int Depot::lock(int operation) { - int res = 0; - if (m_lock_fd == -1) { - m_lock_fd = open(m_depot_path, O_RDONLY); - if (m_lock_fd == -1) { - perror(m_depot_path); - res = m_lock_fd; - } - } - if (res) return res; - res = flock(m_lock_fd, operation); - if (res == -1) { - perror(m_depot_path); - } - return res; -} - -int Depot::unlock(void) { - int res = 0; - res = flock(m_lock_fd, LOCK_UN); - if (res == -1) { - perror(m_depot_path); - } - close(m_lock_fd); - m_lock_fd = -1; - return res; -} - -int Depot::insert(Archive* archive) { - // Don't insert an archive that is already in the database - assert(archive->serial() == 0); - archive->m_serial = m_db->insert_archive(archive->uuid(), - archive->info(), - archive->name(), - archive->date_installed(), - archive->build()); - return archive->m_serial == 0; -} - -int Depot::insert(Archive* archive, File* file) { - // check for the destination prefix in file's path, remove if found - char *path, *relpath; - size_t prefixlen = strlen(this->prefix()); - asprintf(&path, "%s", file->path()); - relpath = path; - if (strncmp(file->path(), this->prefix(), prefixlen) == 0) { - relpath += prefixlen - 1; - } - - file->m_serial = m_db->insert_file(file->info(), file->mode(), file->uid(), file->gid(), - file->digest(), archive, relpath); - if (!file->m_serial) { - fprintf(stderr, "Error: unable to insert file at path %s for archive %s \n", - relpath, archive->name()); - return DB_ERROR; - } - - free(path); - return DEPOT_OK; -} - -int Depot::has_file(Archive* archive, File* file) { - // check for the destination prefix in file's path, remove if found - char *path, *relpath; - size_t prefixlen = strlen(this->prefix()); - asprintf(&path, "%s", file->path()); - relpath = path; - if (strncmp(file->path(), this->prefix(), prefixlen) == 0) { - relpath += prefixlen - 1; - } - - uint64_t count = m_db->count_files(archive, relpath); - - free(path); - return count > 0; -} - - -int Depot::remove(Archive* archive) { - int res = 0; - res = m_db->delete_files(archive); - if (res) { - fprintf(stderr, "Error: unable to delete files for archive %llu \n", archive->serial()); - return res; - } - res = m_db->delete_archive(archive); - if (res) { - fprintf(stderr, "Error: unable to delete archive %llu \n", archive->serial()); - return res; - } - return res; -} - -int Depot::remove(File* file) { - return m_db->delete_file(file); -} - -// helper to dispatch the actual command for process_archive() -int Depot::dispatch_command(Archive* archive, const char* command) { - int res = 0; - - if (strncasecmp((char*)command, "files", 5) == 0) { - res = this->files(archive); - } else if (strncasecmp((char*)command, "uninstall", 9) == 0) { - res = this->uninstall(archive); - } else if (strncasecmp((char*)command, "verify", 6) == 0) { - res = this->verify(archive); - } else { - fprintf(stderr, "Error: unknown command given to dispatch_command.\n"); - } - if (res != 0) { - fprintf(stdout, "An error occurred.\n"); - } - return res; -} - -// perform a command on an archive specification -int Depot::process_archive(const char* command, const char* archspec) { - extern uint32_t verbosity; - int res = 0; - uint32_t count = 0; - Archive** list = NULL; - - if (strncasecmp(archspec, "all", 3) == 0 && strlen(archspec) == 3) { - list = this->get_all_archives(&count); - } else if (strncasecmp(archspec, "superseded", 10) == 0 && strlen(archspec) == 10) { - list = this->get_superseded_archives(&count); - } else { - // make a list of 1 Archive - list = (Archive**)malloc(sizeof(Archive*)); - list[0] = this->get_archive(archspec); - count = 1; - } - - for (size_t i = 0; i < count; i++) { - if (!list[i]) { - fprintf(stdout, "Archive not found: %s\n", archspec); - return DEPOT_ERROR; - } - if (verbosity & VERBOSE_DEBUG) { - char uuid[37]; - uuid_unparse_upper(list[i]->uuid(), uuid); - fprintf(stdout, "Found archive: %s\n", uuid); - } - res = this->dispatch_command(list[i], command); - delete list[i]; - } - free(list); - return res; -} - -int Depot::rename_archive(const char* archspec, const char* name) { - extern uint32_t verbosity; - int res = 0; - - if ((strncasecmp(archspec, "all", 3) == 0 && strlen(archspec) == 3) || - (strncasecmp(archspec, "superseded", 10) == 0 && strlen(archspec) == 10)) { - fprintf(stderr, "Error: keywords 'all' and 'superseded' cannot be used with the" - " rename command.\n"); - return DEPOT_USAGE_ERROR; - } - - Archive* archive = this->get_archive(archspec); - if (!archive) { - fprintf(stdout, "Archive not found: %s\n", archspec); - return DEPOT_NOT_EXIST; - } - - char uuid[37]; - uuid_unparse_upper(archive->uuid(), uuid); - if (verbosity & VERBOSE_DEBUG) { - fprintf(stdout, "Found archive: %s\n", uuid); - } - - if (!name || strlen(name) == 0) { - fprintf(stderr, "Error: invalid name: '%s'\n", name); - return DEPOT_ERROR; - } - - free(archive->m_name); - archive->m_name = strdup(name); - - res = m_db->update_archive(archive->serial(), - archive->uuid(), - archive->name(), - archive->date_installed(), - 1, - archive->info(), - archive->build()); - - if (res == 0) fprintf(stdout, "Renamed archive %s to '%s'.\n", - uuid, archive->name()); - - delete archive; - return res; -} diff --git a/darwinup/Depot.h b/darwinup/Depot.h deleted file mode 100644 index e6805be..0000000 --- a/darwinup/Depot.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2005-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@ - */ - -#ifndef _DEPOT_H -#define _DEPOT_H - -#include -#include -#include -#include "DB.h" -#include "Archive.h" - -#define DEPOT_OK 0 -#define DEPOT_ERROR -1 -#define DEPOT_NOT_EXIST -2 -#define DEPOT_PERM_DENIED -3 -#define DEPOT_OBJ_CHANGE -4 -#define DEPOT_BUILD_MISMATCH -5 -#define DEPOT_USAGE_ERROR -6 -#define DEPOT_PREINSTALL_ERR -7 - - -struct Archive; -struct File; -struct DarwinupDatabase; - -typedef int (*ArchiveIteratorFunc)(Archive* archive, void* context); -typedef int (*FileIteratorFunc)(File* file, void* context); - -struct Depot { - Depot(); - Depot(const char* prefix); - - virtual ~Depot(); - - // establish database connection - int connect(); - - // create directories we need for storage - int create_storage(); - - // use initialize() to connect to database - // and (optionally) create the storage directories - int initialize(bool writable); - int is_initialized(); - - const char* prefix(); - const char* database_path(); - const char* archives_path(); - const char* downloads_path(); - - virtual int begin_transaction(); - virtual int commit_transaction(); - virtual int rollback_transaction(); - - Archive* archive(uint64_t serial); - Archive* archive(uuid_t uuid); - Archive* archive(archive_name_t name); - Archive* archive(archive_keyword_t keyword); - Archive* get_archive(const char* arg); - - // returns a list of Archive*. Caller must free the list. - Archive** get_all_archives(uint32_t *count); - Archive** get_superseded_archives(uint32_t *count); - uint64_t count_archives(); - - int dump(); - static int dump_archive(Archive* archive, void* context); - - int list(); - int list(int count, char** args); - static int list_archive(Archive* archive, void* context); - - int install(const char* path); - int install(Archive* archive); - static int install_file(File* file, void* context); - static int backup_file(File* file, void* context); - - int uninstall(Archive* archive); - static int uninstall_file(File* file, void* context); - - int verify(Archive* archive); - static int verify_file(File* file, void* context); - - int files(Archive* archive); - static int print_file(File* file, void* context); - - int iterate_files(Archive* archive, FileIteratorFunc func, void* context); - int iterate_archives(ArchiveIteratorFunc func, void* context); - - // processes an archive according to command - // arg is an archive identifier, such as serial or uuid - int dispatch_command(Archive* archive, const char* command); - int process_archive(const char* command, const char* archspec); - - int rename_archive(const char* archspec, const char* name); - - // test if the depot is currently locked - int is_locked(); - - bool is_superseded(Archive* archive); - - void archive_header(); - - bool is_dirty(); - bool has_modified_extensions(); - bool has_modified_xpc_services(); - -protected: - - // Serialize access to the Depot via flock(2). - int lock(int operation); - int unlock(void); - - // Inserts an Archive into the database. - // This modifies the Archive's serial number. - // If the Archive already has a serial number, it cannot be inserted. - int insert(Archive* archive); - - // Inserts a File into the database, as part of the specified Archive. - // This modifies the File's serial number. - // This modifies the File's Archive pointer. - // If the File already has a serial number, it cannot be inserted. - int insert(Archive* archive, File* file); - - int has_file(Archive* archive, File* file); - - // Removes an Archive from the database. - int remove(Archive* archive); - - // Removes a File from the database. - int remove(File* file); - - int analyze_stage(const char* path, Archive* archive, Archive* rollback, int* rollback_files); - - // removes expand and unexpanded files from archives path - int prune_directories(); - int prune_archive(Archive* archive); - - File* file_superseded_by(File* file); - File* file_preceded_by(File* file); - - int check_consistency(); - - DarwinupDatabase* m_db; - - mode_t m_depot_mode; - char* m_prefix; - char* m_depot_path; - char* m_database_path; - char* m_archives_path; - char* m_downloads_path; - char* m_build; - int m_lock_fd; - int m_is_locked; - bool m_is_dirty; // track if we need to update dyld cache - bool m_modified_extensions; // track if we need to touch /S/L/E - bool m_modified_xpc_services; // track if we need to run xpchelper - -}; - -#endif diff --git a/darwinup/Digest.cpp b/darwinup/Digest.cpp deleted file mode 100644 index e55eb26..0000000 --- a/darwinup/Digest.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2005-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 "Digest.h" - -#include -#include -#include -#include -#include -#include -#include - -uint8_t* Digest::data() { return m_data; } -uint32_t Digest::size() { return m_size; } - -Digest::~Digest() { - -} - -char* Digest::string() { - static const char* hexabet = "0123456789abcdef"; - char* result = (char*)malloc(2*m_size+1); - uint32_t i, j; - - for (i = 0, j = 0; i < m_size; ++i) { - result[j++] = hexabet[(m_data[i] & 0xF0) >> 4]; - result[j++] = hexabet[(m_data[i] & 0x0F)]; - } - result[j] = 0; - - return result; -} - -int Digest::equal(Digest* a, Digest* b) { - if (a == b) return 1; - if (a == NULL) return 0; - if (b == NULL) return 0; - uint32_t a_size = a->size(); - if (a_size != b->size()) { - return 0; - } - return (memcmp(a->data(), b->data(), a_size) == 0); -} - -SHA1Digest::SHA1Digest() { - m_size = CC_SHA1_DIGEST_LENGTH; -} - -SHA1Digest::SHA1Digest(int 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); - digest(m_data, fd); -} - -SHA1Digest::SHA1Digest(uint8_t* data, uint32_t size) { - m_size = CC_SHA1_DIGEST_LENGTH; - digest(m_data, data, size); -} - -SHA1Digest::~SHA1Digest() { - -} - -void SHA1Digest::digest(unsigned char* md, int fd) { - CC_SHA1_CTX c; - CC_SHA1_Init(&c); - - ssize_t 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; } - CC_SHA1_Update(&c, block, (CC_LONG)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); -} - -SHA1DigestSymlink::SHA1DigestSymlink(const char* filename) { - char link[PATH_MAX]; - ssize_t res = readlink(filename, link, PATH_MAX); - if (res == -1) { - fprintf(stderr, "%s:%d: readlink: %s: %s (%d)\n", __FILE__, __LINE__, filename, strerror(errno), errno); - } else { - digest(m_data, (uint8_t*)link, (uint32_t)res); - } -} - -SHA1DigestSymlink::~SHA1DigestSymlink() { - -} - diff --git a/darwinup/Digest.h b/darwinup/Digest.h deleted file mode 100644 index f14912c..0000000 --- a/darwinup/Digest.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2005-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@ - */ - -#ifndef _DIGEST_H -#define _DIGEST_H - -#include -#include -#include - -#include "Utils.h" - -//// -// Digest -// -// Digest is the abstract root class for all message digest algorithms -// supported by darwinup. Subclasses must implement the constructors -// and digest() APIs. -// -// 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). -// -//// - -struct Digest { - - //// - // Accessor functions - //// - - // Returns the raw digest. - virtual uint8_t* data(); - - // Returns the size of the raw digest. - virtual uint32_t size(); - - // Returns the digest as an ASCII string, represented in hexidecimal. - virtual char* string(); - - virtual ~Digest(); - - //// - // Class functions - //// - - // Compares two digest objects for equality. - // Returns 1 if equal, 0 if not. - static int equal(Digest* a, Digest* b); - - - protected: - - virtual void digest(unsigned char* md, int fd) = 0; - virtual void digest(unsigned char* md, uint8_t* data, uint32_t size) = 0; - - unsigned char m_data[CC_SHA512_DIGEST_LENGTH]; // support up to 64 bytes - uint32_t m_size; - - friend struct Depot; - friend struct DarwinupDatabase; -}; - -//// -// SHA1Digest -//// -struct SHA1Digest : Digest { - // Creates an empty digest. - SHA1Digest(); - - // Computes the SHA-1 digest of data read from the stream. - SHA1Digest(int fd); - - // Computes the SHA-1 digest of data in the file. - SHA1Digest(const char* filename); - - // Computes the SHA-1 digest of the block of memory. - SHA1Digest(uint8_t* data, uint32_t size); - - ~SHA1Digest(); - - void digest(unsigned char* md, int fd); - void digest(unsigned char* md, uint8_t* data, uint32_t size); - -}; - -//// -// SHA1DigestSymlink -// Digests of the target of a symlink. -//// -struct SHA1DigestSymlink : SHA1Digest { - // Computes the SHA-1 digest of the target of the symlink. - // The target is obtained via readlink(2). - SHA1DigestSymlink(const char* filename); - ~SHA1DigestSymlink(); -}; - -#endif - diff --git a/darwinup/File.cpp b/darwinup/File.cpp deleted file mode 100644 index 5918abf..0000000 --- a/darwinup/File.cpp +++ /dev/null @@ -1,573 +0,0 @@ -/* - * Copyright (c) 2005-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 "Archive.h" -#include "File.h" -#include "Utils.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -File::File() { - m_serial = 0; - m_archive = NULL; - m_info = FILE_INFO_NONE; - m_path = NULL; - m_mode = 0; - m_uid = 0; - m_gid = 0; - m_size = 0; - m_digest = NULL; -} - -File::File(const char* path) { - m_serial = 0; - m_archive = NULL; - m_info = FILE_INFO_NONE; - m_mode = 0; - m_uid = 0; - m_gid = 0; - m_size = 0; - m_digest = NULL; - if (path) m_path = strdup(path); -} - -File::File(Archive* archive, FTSENT* ent) { - char path[PATH_MAX]; - path[0] = 0; - ftsent_filename(ent, path, PATH_MAX); - m_path = strdup(path); - m_archive = archive; - m_info = FILE_INFO_NONE; - m_mode = ent->fts_statp->st_mode; - m_uid = ent->fts_statp->st_uid; - m_gid = ent->fts_statp->st_gid; - m_size = ent->fts_statp->st_size; - - m_digest = NULL; -} - -File::File(uint64_t serial, Archive* archive, uint32_t info, const char* path, - mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest) { - m_serial = serial; - m_archive = archive; - m_info = info; - m_path = strdup(path); - m_mode = mode; - m_uid = uid; - m_gid = gid; - m_size = size; - m_digest = digest; -} - - -File::~File() { - if (m_path) free(m_path); - if (m_digest) delete m_digest; -} - -uint64_t File::serial() { return m_serial; } -Archive* File::archive() { return m_archive; } -uint64_t File::info() { return m_info; } -const char* File::path() { return m_path; } -mode_t File::mode() { return m_mode; } -uid_t File::uid() { return m_uid; } -gid_t File::gid() { return m_gid; } -off_t File::size() { return m_size; } -Digest* File::digest() { return m_digest; } - -void File::info_set(uint64_t flag) { m_info = INFO_SET(m_info, flag); } -void File::info_clr(uint64_t flag) { m_info = INFO_CLR(m_info, flag); } -void File::archive(Archive* archive) { m_archive = archive; } - -uint32_t File::compare(File* a, File* b) { - if (a == b) return FILE_INFO_IDENTICAL; // identity - // existent and nonexistent file are infinitely different - if (a == NULL) return 0xFFFFFFFF; - if (b == NULL) return 0xFFFFFFFF; - - uint32_t result = FILE_INFO_IDENTICAL; - if (a->m_uid != b->m_uid) result |= FILE_INFO_UID_DIFFERS; - if (a->m_gid != b->m_gid) result |= FILE_INFO_GID_DIFFERS; - if (a->m_mode != b->m_mode) result |= FILE_INFO_MODE_DIFFERS; - if ((a->m_mode & S_IFMT) != (b->m_mode & S_IFMT)) - result |= FILE_INFO_TYPE_DIFFERS; - if ((a->m_mode & ALLPERMS) != (b->m_mode & ALLPERMS)) - result |= FILE_INFO_PERM_DIFFERS; - //if (a->m_size != b->m_size) result |= FILE_INFO_SIZE_DIFFERS; - if (Digest::equal(a->m_digest, b->m_digest) == 0) - result |= FILE_INFO_DATA_DIFFERS; - return result; -} - - -void File::print(FILE* stream) { - char* dig = m_digest ? m_digest->string() : - strdup(" "); - - char mode_str[12]; - strmode(m_mode, mode_str); - - fprintf(stream, "%s % 4d % 4d %s %s\n", mode_str, m_uid, m_gid, dig, m_path); - free(dig); -} - -int File::install(const char* prefix, const char* dest, bool uninstall) { - extern uint32_t force; - int res = 0; - Archive* archive = this->archive(); - assert(archive != NULL); - char* dirpath = archive->directory_name(prefix); - IF_DEBUG("[install] dirpath is %s\n", dirpath); - - char srcpath[PATH_MAX]; - const char* path = this->path(); - char* dstpath; - join_path(&dstpath, dest, path); - - // object changes are expected for some uninstall operations, - // otherwise require force flag - bool allow_change = (uninstall || force); - - if (dirpath) { - ssize_t len = snprintf(srcpath, sizeof(srcpath), "%s/%s", dirpath, path); - if ((size_t)len > sizeof(srcpath)) { - fprintf(stderr, "ERROR: [install] path too long: %s/%s\n", - dirpath, path); - return -1; - } - IF_DEBUG("[install] rename(%s, %s)\n", srcpath, dstpath); - res = rename(srcpath, dstpath); - if (res == -1) { - if (errno == ENOENT) { - // the file wasn't found, try to do on-demand - // expansion of the archive that contains it. - if (is_directory(dirpath) == 0) { - IF_DEBUG("[install] File::install on-demand archive expansion\n"); - res = archive->expand_directory(prefix); - if (res == 0) res = this->install(prefix, dest, uninstall); - } else { - // archive was already expanded, so - // the file is truly missing (worry). - IF_DEBUG("[install] File::install missing file in archive \n"); - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, srcpath, strerror(errno), errno); - } - } else if (allow_change && errno == ENOTDIR) { - // a) some part of destination path does not exist - // b) from is a directory, but to is not - IF_DEBUG("[install] File::install ENOTDIR\n"); - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), errno); - } else if (allow_change && errno == EISDIR) { - // to is a directory, but from is not - IF_DEBUG("[install] replacing directory with a file\n"); - IF_DEBUG("[install] removefile(%s)\n", dstpath); - removefile_state_t rmstate; - rmstate = removefile_state_alloc(); - res = removefile(dstpath, rmstate, REMOVEFILE_RECURSIVE); - removefile_state_free(rmstate); - if (res == -1) fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), - errno); - IF_DEBUG("[install] rename(%s, %s)\n", srcpath, dstpath); - res = rename(srcpath, dstpath); - if (res == -1) fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), - errno); - } else if (allow_change && errno == ENOTEMPTY) { - // to is a directory and is not empty - IF_DEBUG("[install] File::install ENOTEMPTY\n"); - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), errno); - } else { - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), errno); - fprintf(stderr, "ERROR: fatal error during File::install. " \ - "Cannot continue.\n"); - } - } else { - IF_DEBUG("[install] rename(%s, %s)\n", srcpath, dstpath); - } - free(dirpath); - } else { - res = -1; - } - free(dstpath); - return res; -} - -int File::dirrename(const char* prefix, const char* dest, bool uninstall) { - // only used for directories - assert(0); -} - -int File::remove() { - // not implemented - fprintf(stderr, "%s:%d: call to abstract function File::remove\n", - __FILE__, __LINE__); - return -1; -} - -int File::unquarantine(const char *prefix) { - int res = 0; - Archive *archive = this->archive(); - const char *srcpath = archive->directory_name(prefix); - char path[PATH_MAX]; - snprintf(path, sizeof(path), "%s/%s", srcpath, this->path()); - - res = removexattr(path, "com.apple.quarantine", XATTR_NOFOLLOW); - IF_DEBUG("[unquarantine] removexattr %s\n", path); - if (res == -1 && errno == ENOATTR) { - // Safely ignore ENOATTR, we didn't have the quarantine - // xattr set on this file. - res = 0; - } else if (res != 0) { - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, m_path, strerror(errno), errno); - } - return res; -} - -int File::install_info(const char* dest) { - int res = 0; - char* path; - join_path(&path, dest, this->path()); - uid_t uid = this->uid(); - gid_t gid = this->gid(); - mode_t mode = this->mode() & ALLPERMS; - - IF_DEBUG("[install] chown(%s, %d, %d)\n", path, uid, gid); - if (res == 0) res = chown(path, uid, gid); - IF_DEBUG("[install] chmod(%s, %04o)\n", path, mode); - if (res == 0) res = chmod(path, mode); - - free(path); - return res; -} - -NoEntry::NoEntry(const char* path) : File(path) { - m_info = INFO_SET(m_info, FILE_INFO_NO_ENTRY); -} - -NoEntry::NoEntry(uint64_t serial, Archive* archive, uint32_t info, const char* path, - mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest) -: File(serial, archive, info, path, mode, uid, gid, size, digest) {} - -Regular::Regular(Archive* archive, FTSENT* ent) : File(archive, ent) { - m_digest = new SHA1Digest(ent->fts_accpath); -} - -Regular::Regular(uint64_t serial, Archive* archive, uint32_t info, const char* path, - mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest) -: File(serial, archive, info, path, mode, uid, gid, size, digest) { - if (digest == NULL || serial == 0) { - m_digest = new SHA1Digest(path); - } -} - -int Regular::remove() { - int res = 0; - const char* path = this->path(); - res = unlink(path); - IF_DEBUG("[remove] unlink %s\n", path); - if (res == -1 && errno == ENOENT) { - // We can safely ignore this because we were going to - // remove the file anyway - res = 0; - } else if (res != 0) { - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, m_path, strerror(errno), errno); - } - return res; -} - -Symlink::Symlink(Archive* archive, FTSENT* ent) : File(archive, ent) { - m_digest = new SHA1DigestSymlink(ent->fts_accpath); -} - -Symlink::Symlink(uint64_t serial, Archive* archive, uint32_t info, const char* path, - mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest) -: File(serial, archive, info, path, mode, uid, gid, size, digest) { - if (digest == NULL || serial == 0) { - m_digest = new SHA1DigestSymlink(path); - } -} - -int Symlink::remove() { - int res = 0; - const char* path = this->path(); - res = unlink(path); - IF_DEBUG("[remove] unlink %s", path); - if (res == -1 && errno == ENOENT) { - // We can safely ignore this because we were going to - // remove the file anyway - res = 0; - } else if (res == -1) { - fprintf(stderr, "%s:%d: %s (%d)\n", - __FILE__, __LINE__, strerror(errno), errno); - } - return res; -} - -int Symlink::install_info(const char* dest) { - int res = 0; - char* path; - join_path(&path, dest, this->path()); - //mode_t mode = this->mode() & ALLPERMS; - uid_t uid = this->uid(); - gid_t gid = this->gid(); - IF_DEBUG("[install] lchown(%d, %d)\n", uid, gid); - if (res == 0) res = lchown(path, uid, gid); - if (res == -1) fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, path, strerror(errno), errno); - //IF_DEBUG("[install] lchmod(%o)\n", mode); - //if (res == 0) res = lchmod(path, mode); - free(path); - return res; -} - -Directory::Directory(Archive* archive, FTSENT* ent) : File(archive, ent) {} - -Directory::Directory(uint64_t serial, Archive* archive, uint32_t info, - const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, - Digest* digest) -: File(serial, archive, info, path, mode, uid, gid, size, digest) {}; - -int Directory::install(const char* prefix, const char* dest, bool uninstall) { - return this->_install(prefix, dest, uninstall, false); -} - -int Directory::dirrename(const char* prefix, const char* dest, bool uninstall) { - return this->_install(prefix, dest, uninstall, true); -} - -int Directory::_install(const char* prefix, const char* dest, bool uninstall, bool use_rename) { - // We create a new directory instead of renaming the - // existing one, since that would move the entire - // sub-tree, and lead to a lot of ENOENT errors. - int res = 0; - extern uint32_t force; - char* dstpath; - join_path(&dstpath, dest, this->path()); - - // object changes are expected for some uninstall operations, - // otherwise require force flag - bool allow_change = (uninstall || force); - - mode_t mode = this->mode() & ALLPERMS; - uid_t uid = this->uid(); - gid_t gid = this->gid(); - - if (use_rename) { - // determine source path under archives directory for rename - char srcpath[PATH_MAX]; - const char* path = this->path(); - Archive* archive = this->archive(); - char* dirpath = archive->directory_name(prefix); - IF_DEBUG("[install] dirpath is %s\n", dirpath); - if (is_directory(dirpath) == 0) { - IF_DEBUG("[install] expanding archive for directory rename\n"); - res = archive->expand_directory(prefix); - } - if (res == 0 && dirpath) { - ssize_t len = snprintf(srcpath, sizeof(srcpath), "%s/%s", dirpath, path); - if ((size_t)len > sizeof(srcpath)) { - fprintf(stderr, "ERROR: [install] path too long: %s/%s\n", - dirpath, path); - return -1; - } - } - if (is_regular_file(dstpath)) unlink(dstpath); - if (res == 0) IF_DEBUG("[install] rename(%s, %s)\n", srcpath, dstpath); - if (res == 0) res = rename(srcpath, dstpath); - } else { - IF_DEBUG("[install] mkdir(%s, %04o)\n", dstpath, mode); - res = mkdir(dstpath, mode); - // mkdir is limited by umask, so ensure mode is set - if (res == 0) res = chmod(dstpath, mode); - } - - if (res && errno == EEXIST) { - if (is_directory(dstpath)) { - // this is expected in normal cases, so no need to force - IF_DEBUG("[install] directory already exists, setting mode \n"); - res = chmod(dstpath, mode); - if (res == -1) fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), - errno); - } else if (allow_change) { - // this could be bad, so require the force option - IF_DEBUG("[install] original node is a file, we need to replace " \ - "with a directory \n"); - IF_DEBUG("[install] unlink(%s)\n", dstpath); - res = unlink(dstpath); - IF_DEBUG("[install] mkdir(%s, %04o)\n", dstpath, mode); - res = mkdir(dstpath, mode); - if (res == -1) fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), - errno); - } - } else if (allow_change && res == -1 && errno == ENOTDIR) { - // some part of destination path is not a directory - IF_DEBUG("[install] Directory::install ENOTDIR \n"); - } else if (res == -1) { - fprintf(stderr, "ERROR: %s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), errno); - fprintf(stderr, "ERROR: unable to create %s \n", dstpath); - } - - if (res == 0) { - res = chown(dstpath, uid, gid); - if (res != 0) { - fprintf(stderr, "ERROR: %s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, dstpath, strerror(errno), errno); - fprintf(stderr, "ERROR: unable to change ownership of %s \n", dstpath); - } - } - - free(dstpath); - return res; -} - -int Directory::remove() { - int res = 0; - const char* path = this->path(); - res = rmdir(path); - IF_DEBUG("[remove] rmdir %s\n", path); - if (res == -1 && errno == ENOENT) { - // We can safely ignore this because we were going to - // remove the directory anyway - res = 0; - } else if (res == -1 && errno == ENOTEMPTY) { - res = remove_directory(path); - } else if (res == -1) { - fprintf(stderr, "%s:%d: %s (%d)\n", - __FILE__, __LINE__, strerror(errno), errno); - } - return res; -} - - -File* FileFactory(uint64_t serial, Archive* archive, uint32_t info, const char* path, - mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest) { - File* file = NULL; - switch (mode & S_IFMT) { - case S_IFDIR: - file = new Directory(serial, archive, info, path, mode, uid, gid, size, - digest); - break; - case S_IFREG: - file = new Regular(serial, archive, info, path, mode, uid, gid, size, - digest); - break; - case S_IFLNK: - file = new Symlink(serial, archive, info, path, mode, uid, gid, size, - digest); - break; - case 0: - if (INFO_TEST(info, FILE_INFO_NO_ENTRY)) { - file = new NoEntry(serial, archive, info, path, mode, uid, gid, size, - digest); - break; - } - default: - fprintf(stderr, "%s:%d: unexpected file type %o\n", - __FILE__, __LINE__, mode & S_IFMT); - break; - } - return file; -} - -File* FileFactory(Archive* archive, FTSENT* ent) { - File* file = NULL; - switch (ent->fts_info) { - case FTS_D: - file = new Directory(archive, ent); - break; - case FTS_F: - file = new Regular(archive, ent); - break; - case FTS_SL: - case FTS_SLNONE: - file = new Symlink(archive, ent); - break; - case FTS_DP: - break; - case FTS_DEFAULT: - case FTS_DNR: - fprintf(stderr, "%s:%d: could not read directory. Run as root.\n", - __FILE__, __LINE__); - break; - default: - fprintf(stderr, "%s:%d: unexpected fts_info type %d\n", - __FILE__, __LINE__, ent->fts_info); - break; - } - return file; -} - -File* FileFactory(const char* path) { - File* file = NULL; - struct stat sb; - int res = 0; - extern uint32_t force; - - res = lstat(path, &sb); - if (res == -1 && errno == ENOENT) { - // destination does not have a matching node - return NULL; - } else if (force && res == -1 && errno == ENOTDIR) { - // some part of destination path does not exist - // or is a file. This gets handled by Directory::install - // eventually - IF_DEBUG("[factory] parents do not exist or contain a file\n"); - return NULL; - } - if (res == -1) { - fprintf(stderr, "%s:%d: %s: %s (%d)\n", - __FILE__, __LINE__, path, strerror(errno), errno); - fprintf(stderr, "ERROR: unable to stat %s \n", path); - return NULL; - } - - file = FileFactory(0, NULL, FILE_INFO_NONE, path, sb.st_mode, sb.st_uid, - sb.st_gid, sb.st_size, NULL); - return file; -} diff --git a/darwinup/File.h b/darwinup/File.h deleted file mode 100644 index 6129579..0000000 --- a/darwinup/File.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2005-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@ - */ - -#ifndef _FILE_H -#define _FILE_H - -#include "Digest.h" - -#include -#include -#include - -#define FILE_OBJ_CHANGE_ERROR \ -"-----------------------------------------------------------------------------\n" \ -"Potentially unsafe mismatch between the root and destination: \n\n" \ -"%s\n\n" \ -"You seem to be trying to install a %s over a %s. \n" \ -"Darwinup will not install this root by default since it could cause damage \n" \ -"to your system. You can use the force (-f) option to allow darwinup to \n" \ -"attempt the install anyway. \n" \ -"-----------------------------------------------------------------------------\n" - -#define FILE_TYPE_STRING(type) \ -(type == S_IFIFO ? "named pipe" : \ -(type == S_IFCHR ? "character special" : \ -(type == S_IFDIR ? "directory" : \ -(type == S_IFBLK ? "block special" : \ -(type == S_IFREG ? "file" : \ -(type == S_IFLNK ? "symbolic link" : \ -(type == S_IFSOCK ? "socket" : \ -(type == S_IFWHT ? "whiteout" : \ -"unknown")))))))) - - -enum file_starseded_t { - FILE_SUPERSEDED, - FILE_PRECEDED -}; - -// -// FILE_INFO flags stored in the database -// -const uint32_t FILE_INFO_NONE = 0x0000; -const uint32_t FILE_INFO_BASE_SYSTEM = 0x0001; // file was part of base system, cannot uninstall -const uint32_t FILE_INFO_NO_ENTRY = 0x0002; // placeholder in the database for non-existent file -const uint32_t FILE_INFO_INSTALL_DATA = 0x0010; // actually install the file -const uint32_t FILE_INFO_ROLLBACK_DATA = 0x0020; // file exists in rollback archive - -// -// FILE_INFO flags returned by File::compare() -// -const uint32_t FILE_INFO_IDENTICAL = 0x00000000; - -const uint32_t FILE_INFO_GID_DIFFERS = 0x00100000; -const uint32_t FILE_INFO_UID_DIFFERS = 0x00200000; - -const uint32_t FILE_INFO_MODE_DIFFERS = 0x01000000; // mode differs overall -const uint32_t FILE_INFO_TYPE_DIFFERS = 0x02000000; // S_IFMT differs -const uint32_t FILE_INFO_PERM_DIFFERS = 0x04000000; // ALLPERMS differs - -const uint32_t FILE_INFO_SIZE_DIFFERS = 0x10000000; -const uint32_t FILE_INFO_DATA_DIFFERS = 0x20000000; - - -struct Archive; -struct File; - -//// -// File -// -// File is the root class for all filesystem objects. -// Conceptually it's an abstract class, although that -// hasn't been formalized. -// -// Concrete subclasses exist for specific file types: -// Regular, Symlink, Directory, and NoEntry, indicating -// that the given path does not exist. -// -// FileFactory functions exist to return the correct -// concrete subclass for a given filesystem object. -//// - -File* FileFactory(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest); -File* FileFactory(const char* path); -File* FileFactory(Archive* archive, FTSENT* ent); - - -struct File { - File(); - File(File*); - File(const char* path); - File(Archive* archive, FTSENT* ent); - File(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest); - virtual ~File(); - - //// - // Public Accessor functions - //// - - // Unique serial number for the file (used by database). - virtual uint64_t serial(); - - // FILE_INFO flags. - virtual uint64_t info(); - virtual void info_set(uint64_t); - virtual void info_clr(uint64_t); - - // Pointer to the Archive this file belongs to. - virtual Archive* archive(); - virtual void archive(Archive* archive); - - // Path of the file on disk (absolute path). - // Do not modify or free(3). - virtual const char* path(); - - // Mode of the file, including the file type. - virtual mode_t mode(); - - // Uid of the file. - virtual uid_t uid(); - - // Gid of the file. - virtual gid_t gid(); - - // Size of the file. - virtual off_t size(); - - // Digest of the file's data. - virtual Digest* digest(); - - //// - // Class functions - //// - - // Compare two files, setting the appropriate - // FILE_INFO bits in the return value. - static uint32_t compare(File* a, File* b); - - //// - // Member functions - //// - - // Installs the file from the archive into the prefix - // i.e., for regular files: - // rename(prefix + this->archive()->uuid() + this->path(), dest + this->path()); - virtual int install(const char* prefix, const char* dest, bool uninstall); - // only used for directories - virtual int dirrename(const char* prefix, const char* dest, bool uninstall); - - // Sets the mode, uid, and gid of the file in the dest path - // XXX: rename as repair()? - virtual int install_info(const char* dest); - - // Removes the file - virtual int remove(); - - // Removes any quarantine xattrs present - int unquarantine(const char *prefix); - - // Prints one line to the output stream indicating - // the file mode, ownership, digest and name. - virtual void print(FILE* stream); - - protected: - - uint64_t m_serial; - uint64_t m_info; - Archive* m_archive; - char* m_path; - mode_t m_mode; - uid_t m_uid; - gid_t m_gid; - off_t m_size; - Digest* m_digest; - - friend struct Depot; -}; - - -//// -// Placeholder for rollback archives in the database. -// Indicates that the given path had no entry at the time that -// the archive was created. -//// - -struct NoEntry : File { - NoEntry(const char* path); - NoEntry(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest); -}; - -//// -// A regular file. -// Digest is of the data fork of the file. -// NOTE: Extended attributes are not detected or preserved. -//// -struct Regular : File { - Regular(Archive* archive, FTSENT* ent); - Regular(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest); - virtual int remove(); -}; - -//// -// A symbolic link. -// Digest is of the target obtained via readlink(2). -//// -struct Symlink : File { - Symlink(Archive* archive, FTSENT* ent); - Symlink(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest); - virtual int install_info(const char* dest); - virtual int remove(); -}; - -//// -// A directory. -// Digest is null. -//// -struct Directory : File { - Directory(Archive* archive, FTSENT* ent); - Directory(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest); - virtual int install(const char* prefix, const char* dest, bool uninstall); - virtual int dirrename(const char* prefix, const char* dest, bool uninstall); - int _install(const char* prefix, const char* dest, bool uninstall, bool use_rename); - virtual int remove(); -}; - -#endif diff --git a/darwinup/NOTES b/darwinup/NOTES deleted file mode 100644 index 9e9e6d4..0000000 --- a/darwinup/NOTES +++ /dev/null @@ -1,114 +0,0 @@ -darwinup -12-Mar-2010 -Kevin Van Vechten -William Siegrist - -OVERVIEW -======== - -The Darwin Update utility provides a transaction-based mechanism to -install software on the base system that modifies or supersedes existing -system components. Darwin Update is not a "package manager," and does -not specify any package format. Updates can be installed from a directory, -a tar archive, or other formats. - -Darwin Update provides the following: - - * Installation of Darwin components (usually built with DarwinBuild) - * Verification of components previously installed with Darwin Update - * Un-installation of components installed with Darwin Update - -It is a design goal of Darwin Update that all components installed by -this utility can subsequently be uninstalled, leaving the system in its -original state. - - -THE DEPOT -========= - -The Darwin Update utility creates a directory at the root level of the -filesystem (/.DarwinDepot) where it stores its database of currently -installed components, and archived copies of the components they superseded. -This is known as the depot. - -The following files are present in the depot: - -/.DarwinDepot/Database-V100 -SQLite database containing information about all of the archives and files -that have been installed with darwinbuild. - -/.DarwinDepot/Archives/ -If an archive has any data to be installed, it will have a corresponding entry -in this directory. This is known as the backing-store of the archive. -The backing-store is either in a compressed (.tar.bz2) or expanded (directory) -state. The compressed state is always authoritative and the expanded state -is pruned when darwinup exits. The backing store for each archive is named -according to that archive's UUID in the database. - -/.DarwinDepot/Downloads/ -Temporary storage for any remote archives, such as when giving http or -rsync urls to darwinup. - -OPERATIONS -========== - -1. INSTALLATION - -When Darwin Update is used for installing a tar archive (for example), it -will first create two entries in the database. One for the archive to be -installed, and another for the "rollback" archive associated with this -archive. The rollback archive is where all of the base system files and -existing user data are preserved before the new archive is installed. - -A backing-store directory is created for both the new archive and the -rollback archive. Darwin Update extracts the tar archive into the newly -created backing store directory. This effectively pre-allocates space on -the root volume for the installation. - -Next, the location is compared against the software currently installed. -Records are inserted into the database for each file in the new archive. -Additionally, records are also inserted into the rollback archive -representing the initial state of the system. (Note, that if a new file -is identical to a file that Darwin Update has previously installed, no -rollback file will be added since the record of the previously installed -file is sufficient). - -Once all the records have been committed to the database, each file that -was added to the rollback archive is moved into the backing-store. At this -point the rollback archive backing store directory is compacted into a -.tar.bz2 archive. - -Finally, each new file is moved from the backing store to its location on -the root filesystem. - -Installation is complete. - -2. UNINSTALLATION - -When Darwin Update is used for uninstalling an archive, it will iterate -through all the files in that archive as recorded in the database. - -If another newer archive has installed a file in the same location, then -no action is taken because the archive to be uninstalled no longer has a -claim on that file. However, if there are no newer archives claiming this -file, it will be uninstalled. - -When a file is uninstalled, Darwin Update searches the database for the -previous version of the file, whether archived from the base system, or -installed in an earlier archive. If the file is identical to the previous -version, then no action is taken. However, if the previous version differs -it will need to be restored. - -During restoration, if the file did not previously exist at all, it will be -deleted. Otherwise, the rollback archive backing store is expanded, and the -file is moved from teh rollback archive backing store onto the root filesystem. -The previous file has been restored. - -At this point Darwin Update deletes the record of the previous file from the -database. - -Once all files affected by the uninstalled archive have been deleted or -restored, the archive and its list of files are deleted from the database. - -Uninstallation is complete. - diff --git a/darwinup/SerialSet.cpp b/darwinup/SerialSet.cpp deleted file mode 100644 index 68046da..0000000 --- a/darwinup/SerialSet.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2005-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 "SerialSet.h" - -#include -#include -#include - -SerialSet::SerialSet() { - capacity = 0; - count = 0; - values = (uint64_t*)malloc(0); -} - -SerialSet::~SerialSet() { - if (values) free(values); -} - -int SerialSet::add(uint64_t value) { - // If the serial already exists in the set, then there's nothing to be done - uint32_t i; - for (i = 0; i < this->count; ++i) { - if (this->values[i] == value) { - return 0; - } - } - - // Otherwise, append it to the end of the set - this->count++; - if (this->count > this->capacity) { - this->capacity += 10; - this->values = (uint64_t*)realloc(this->values, this->capacity * sizeof(uint64_t)); - assert(this->values != NULL); - } - this->values[this->count-1] = value; - - return 0; -} diff --git a/darwinup/Table.cpp b/darwinup/Table.cpp deleted file mode 100644 index 818f2fb..0000000 --- a/darwinup/Table.cpp +++ /dev/null @@ -1,561 +0,0 @@ -/* - * 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 -#include -#include - -#include "Table.h" -#include "Database.h" - - -Table::Table(const char* name) { - m_column_max = 2; - m_column_count = 0; - m_columns = (Column**)malloc(sizeof(Column*) * m_column_max); - m_columns_size = 0; - m_result_max = 1; - m_result_count = 0; - m_results = (uint8_t**)malloc(sizeof(uint8_t*) * m_result_max); - m_name = strdup(name); - m_create_sql = NULL; - m_custom_create_sql = NULL; - m_insert_sql = NULL; - m_update_sql = NULL; - m_delete_sql = NULL; - m_prepared_insert = NULL; - m_prepared_update = NULL; - m_prepared_delete = NULL; - m_version = 0; -} - -Table::~Table() { - for (uint32_t i = 0; i < m_column_count; i++) { - delete m_columns[i]; - } - free(m_columns); - - - for (uint32_t i=0; i < m_result_count; i++) { - if (m_results[i]) { - this->free_result(m_results[i]); - } - } - free(m_results); - - free(m_name); - - free(m_create_sql); - free(m_custom_create_sql); - free(m_insert_sql); - free(m_update_sql); - free(m_delete_sql); - - sqlite3_finalize(m_prepared_insert); - sqlite3_finalize(m_prepared_update); - sqlite3_finalize(m_prepared_delete); - -} - -const char* Table::name() { - return m_name; -} - -uint32_t Table::version() { - return m_version; -} - -int Table::set_custom_create(const char* sql) { - this->m_custom_create_sql = strdup(sql); - return this->m_custom_create_sql == 0; -} - -int Table::add_column(Column* c, uint32_t schema_version) { - // accumulate offsets for columns in m_columns_size - c->m_offset = this->m_columns_size; - this->m_columns_size += c->size(); - - // reallocate if needed - if (m_column_count >= m_column_max) { - m_columns = (Column**)realloc(m_columns, m_column_max * sizeof(Column*) * REALLOC_FACTOR); - if (!m_columns) { - fprintf(stderr, "Error: unable to reallocate memory to add a column\n"); - return 1; - } - m_column_max *= REALLOC_FACTOR; - } - m_columns[m_column_count++] = c; - c->m_version = schema_version; - return 0; -} - -Column* Table::column(uint32_t index) { - if (index < m_column_count) { - return this->m_columns[index]; - } else { - return NULL; - } -} - -int Table::offset(uint32_t index) { - return this->m_columns[index]->offset(); -} - -uint32_t Table::row_size() { - return m_columns_size; -} - -uint8_t* Table::alloc_result() { - if (m_result_count >= m_result_max) { - m_results = (uint8_t**)realloc(m_results, m_result_max * sizeof(uint8_t*) * REALLOC_FACTOR); - if (!m_results) { - fprintf(stderr, "Error: unable to reallocate memory to add a result row\n"); - return NULL; - } - m_result_max *= REALLOC_FACTOR; - } - m_result_count++; - m_results[m_result_count-1] = (uint8_t*)calloc(1, this->row_size()); - return m_results[m_result_count-1]; -} - -int Table::free_result(uint8_t* result) { - for (uint32_t i=0; i < m_result_count; i++) { - // look for matching result - if (result == m_results[i]) { - this->free_row((uint8_t*)m_results[i]); - free(m_results[i]); - m_results[i] = NULL; - // if we did not free the last result, - // move last result to the empty slot - if (i != (m_result_count - 1)) { - m_results[i] = m_results[m_result_count-1]; - m_results[m_result_count-1] = NULL; - } - m_result_count--; - } - } - return 0; -} - -sqlite3_stmt* Table::count(sqlite3* db) { - sqlite3_stmt* stmt = (sqlite3_stmt*)malloc(sizeof(sqlite3_stmt*)); - char* query; - int size = asprintf(&query, "SELECT count(*) FROM %s ;", m_name) + 1; - int res = sqlite3_prepare_v2(db, query, size, &stmt, NULL); \ - free(query); \ - if (res != SQLITE_OK) { \ - fprintf(stderr, "Error: unable to prepare statement: %s\n", \ - sqlite3_errmsg(db)); \ - return NULL; \ - } - return stmt; -} - -/** - * Prepare and cache the update statement. - * Assumes table only has 1 primary key - */ -sqlite3_stmt* Table::update(sqlite3* db) { - // we only need to prepare once, return if we already have it - if (m_prepared_update) { - return m_prepared_update; - } - uint32_t i = 0; - bool comma = false; // flag we set to start adding commas - - // calculate the length of the sql statement - size_t size = 28 + 5*m_column_count + strlen(m_name); - for (i=0; iname()); - } - - // generate the sql query - m_update_sql = (char*)malloc(size); - strlcpy(m_update_sql, "UPDATE ", size); - strlcat(m_update_sql, m_name, size); - strlcat(m_update_sql, " SET ", size); - for (i=0; iis_pk()) { - strlcat(m_update_sql, m_columns[i]->name(), size); - strlcat(m_update_sql, "=?", size); - comma = true; - } - } - - // WHERE statement using primary keys - strlcat(m_update_sql, " WHERE ", size); - for (i=0; iis_pk()) { - strlcat(m_update_sql, m_columns[i]->name(), size); - strlcat(m_update_sql, "=?", size); - break; - } - } - strlcat(m_update_sql, ";", size); - - // prepare - int res = sqlite3_prepare_v2(db, m_update_sql, (int)strlen(m_update_sql), &m_prepared_update, NULL); - if (res != SQLITE_OK) { - fprintf(stderr, "Error: unable to prepare update statement for table: %s \n", m_name); - return NULL; - } - return m_prepared_update; -} - - -sqlite3_stmt* Table::insert(sqlite3* db) { - // we only need to prepare once, return if we already have it - if (m_prepared_insert) { - return m_prepared_insert; - } - - uint32_t i = 0; - bool comma = false; // flag we set to start adding commas - - // calculate the length of the sql statement - size_t size = 28 + 5*m_column_count + strlen(m_name); - for (i=0; iname()); - } - - // generate the sql query - m_insert_sql = (char*)malloc(size); - strlcpy(m_insert_sql, "INSERT INTO ", size); - strlcat(m_insert_sql, m_name, size); - strlcat(m_insert_sql, " (", size); - for (i=0; iis_pk()) { - strlcat(m_insert_sql, m_columns[i]->name(), size); - comma = true; - } - } - comma = false; - strlcat(m_insert_sql, ") VALUES (", size); - for (i=0; iis_pk()) { - strlcat(m_insert_sql, "?", size); - comma = true; - } - } - strlcat(m_insert_sql, ");", size); - - IF_SQL("insert sql: %s \n", m_insert_sql); - - // prepare - int res = sqlite3_prepare_v2(db, m_insert_sql, (int)strlen(m_insert_sql), &m_prepared_insert, NULL); - if (res != SQLITE_OK) { - fprintf(stderr, "Error: unable to prepare insert statement for table: %s \n", m_name); - return NULL; - } - return m_prepared_insert; -} - -sqlite3_stmt* Table::del(sqlite3* db) { - // we only need to prepare once, return if we already have it - if (m_prepared_delete) return m_prepared_delete; - - uint32_t i = 0; - - // generate the sql query - size_t size = 22 + strlen(m_name); - for (i=0; iis_pk()) { - size += strlen(m_columns[i]->name()) + 2; - break; - } - } - m_delete_sql = (char*)malloc(size); - strlcpy(m_delete_sql, "DELETE FROM ", size); - strlcat(m_delete_sql, m_name, size); - - // WHERE statement using primary keys - strlcat(m_delete_sql, " WHERE ", size); - for (i=0; iis_pk()) { - strlcat(m_delete_sql, m_columns[i]->name(), size); - strlcat(m_delete_sql, "=?", size); - break; - } - } - strlcat(m_delete_sql, ";", size); - - // prepare - int res = sqlite3_prepare_v2(db, m_delete_sql, (int)strlen(m_delete_sql), &m_prepared_delete, NULL); - if (res != SQLITE_OK) { - fprintf(stderr, "Error: unable to prepare delete statement for table: %s \n", m_name); - return NULL; - } - return m_prepared_delete; - -} - -#define __alloc_stmt_query \ - size_t size = 256; \ - size_t used = 0; \ - char* query = (char*)malloc(size); \ - sqlite3_stmt** pps = (sqlite3_stmt**)malloc(sizeof(sqlite3_stmt*)); - -#define __check_and_cat(text) \ - used = strlcat(query, text, size); \ - if (used >= size-1) { \ - size *= 4; \ - query = (char*)realloc(query, size); \ - if (!query) { \ - fprintf(stderr, "Error: ran out of memory!\n"); \ - return NULL; \ - } \ - used = strlcat(query, text, size); \ - } - -#define __prepare_stmt \ - int res = sqlite3_prepare_v2(db, query, (int)size, pps, NULL); \ - free(query); \ - if (res != SQLITE_OK) { \ - fprintf(stderr, "Error: unable to prepare statement: %s\n", \ - sqlite3_errmsg(db)); \ - return NULL; \ - } - -sqlite3_stmt** Table::count(sqlite3* db, uint32_t count, va_list args) { - __alloc_stmt_query; - strlcpy(query, "SELECT count(*) FROM ", size); - __check_and_cat(m_name); - __check_and_cat(" WHERE 1"); - this->where_va_columns(count, query, size, &used, args); - strlcat(query, ";", size); - __prepare_stmt; - - return pps; -} - -sqlite3_stmt** Table::get_column(sqlite3* db, Column* value_column, uint32_t count, va_list args) { - __alloc_stmt_query; - strlcpy(query, "SELECT ", size); - __check_and_cat(value_column->name()); - __check_and_cat(" FROM "); - __check_and_cat(m_name); - __check_and_cat(" WHERE 1"); - this->where_va_columns(count, query, size, &used, args); - strlcat(query, ";", size); - __prepare_stmt; - - return pps; -} - -sqlite3_stmt** Table::get_row(sqlite3* db, uint32_t count, va_list args) { - __alloc_stmt_query; - strlcpy(query, "SELECT * FROM ", size); - __check_and_cat(m_name); - __check_and_cat(" WHERE 1"); - this->where_va_columns(count, query, size, &used, args); - strlcat(query, ";", size); - __prepare_stmt; - - return pps; -} - -sqlite3_stmt** Table::get_row_ordered(sqlite3* db, Column* order_by, int order, - uint32_t count, va_list args) { - __alloc_stmt_query; - strlcpy(query, "SELECT * FROM ", size); - __check_and_cat(m_name); - __check_and_cat(" WHERE 1"); - this->where_va_columns(count, query, size, &used, args); - __check_and_cat(" ORDER BY "); - __check_and_cat(order_by->name()); - __check_and_cat((order == ORDER_BY_DESC ? " DESC" : " ASC")); - strlcat(query, ";", size); - __prepare_stmt; - - return pps; -} - -sqlite3_stmt** Table::update_value(sqlite3* db, Column* value_column, uint32_t count, va_list args) { - __alloc_stmt_query; - strlcpy(query, "UPDATE ", size); - __check_and_cat(m_name); - __check_and_cat(" SET "); - __check_and_cat(value_column->name()); - __check_and_cat("=? WHERE 1"); - this->where_va_columns(count, query, size, &used, args); - strlcat(query, ";", size); - __prepare_stmt; - - return pps; -} - -sqlite3_stmt** Table::del(sqlite3* db, uint32_t count, va_list args) { - __alloc_stmt_query; - strlcpy(query, "DELETE FROM ", size); - __check_and_cat(m_name); - __check_and_cat(" WHERE 1"); - this->where_va_columns(count, query, size, &used, args); - strlcat(query, ";", size); - __prepare_stmt; - - return pps; -} - -const char* Table::create() { - size_t size = 0; - if (!m_create_sql) { - uint32_t i = 0; - - // size of "create table ( );" plus table name, plus 1 for each column to separate - size = strlen(m_name) + 22 + m_column_count; - for (i=0; icreate()); - // size for create index query - size += 26 + 2*strlen(m_columns[i]->name()) + 2*strlen(m_name); - // custom sql - if (m_custom_create_sql) size += strlen(m_custom_create_sql); - } - - // create creation sql - m_create_sql = (char*)malloc(size); - strlcpy(m_create_sql, "CREATE TABLE ", size); - strlcat(m_create_sql, m_name, size); - strlcat(m_create_sql, " (", size); - // get creation sql for each column - for (i=0; icreate(), size); - } - strlcat(m_create_sql, "); ", size); - - for (i=0; iis_index()) { - char* buf; - asprintf(&buf, "CREATE INDEX %s_%s ON %s (%s);", - m_name, m_columns[i]->name(), m_name, m_columns[i]->name()); - strlcat(m_create_sql, buf, size); - free(buf); - } - } - if (m_custom_create_sql) strlcat(m_create_sql, m_custom_create_sql, size); - } - - return (const char*)m_create_sql; -} - -const char* Table::alter_add_column(uint32_t index) { - if (m_columns[index]) return m_columns[index]->alter(m_name); - return NULL; -} - -int Table::where_va_columns(uint32_t count, char* query, size_t size, - size_t* used, va_list args) { - char tmpstr[256]; - char tmp_op = '='; - char op = '='; - char not_op = ' '; - int len; - for (uint32_t i=0; i < count; i++) { - Column* col = va_arg(args, Column*); - tmp_op = va_arg(args, int); - if (tmp_op == '!') { - not_op = tmp_op; - } else { - op = tmp_op; - } - if (col->type() == SQLITE_TEXT) va_arg(args, char*); - if (col->type() == SQLITE_INTEGER) va_arg(args, uint64_t); - if (col->type() == SQLITE_BLOB) { - va_arg(args, char*); - va_arg(args, uint32_t); - } - len = snprintf(tmpstr, 256, " AND %s%c%c?", col->name(), not_op, op); - if (len >= 255) { - fprintf(stderr, "Error: column name is too big (limit: 248): %s\n", - col->name()); - return NULL; - } - *used = strlcat(query, tmpstr, size); - if (*used >= size-1) { - size *= 4; - query = (char*)realloc(query, size); - if (!query) { - fprintf(stderr, "Error: ran out of memory!\n"); - return -1; - } - *used = strlcat(query, tmpstr, size); - } - } - - return 0; -} - -const Column** Table::columns() { - return (const Column**)m_columns; -} - -uint32_t Table::column_count() { - return this->m_column_count; -} - -int Table::free_row(uint8_t* row) { - uint8_t* current = row; - void* ptr; - for (uint32_t i=0; i < m_column_count; i++) { - switch (m_columns[i]->type()) { - case SQLITE_INTEGER: - current += sizeof(uint64_t); - // nothing to free - break; - default: - memcpy(&ptr, current, sizeof(void*)); - free(ptr); - current += sizeof(void*); - } - } - return 0; -} - -void Table::dump_results(FILE* f) { - fprintf(f, "====================================================================\n"); - for (uint32_t i=0; i < m_result_count; i++) { - fprintf(f, "%p %u:\n", m_results[i], i); - __data_hex(f, m_results[i], 48); - } - fprintf(f, "====================================================================\n"); -} diff --git a/darwinup/Table.h b/darwinup/Table.h deleted file mode 100644 index ca18ff4..0000000 --- a/darwinup/Table.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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@ - */ - -#ifndef _TABLE_H -#define _TABLE_H - -#include -#include - -#include "Column.h" - - -struct Table { - Table(const char* name); - virtual ~Table(); - - const char* name(); - uint32_t version(); - - // Add custom SQL to table initialization - int set_custom_create(const char* sql); - - // Column handling - int add_column(Column*, uint32_t schema_version); - Column* column(uint32_t index); - // get the result record offset for column at index - int offset(uint32_t index); - // get total size of result record - uint32_t row_size(); - - // Result record handling - uint8_t* alloc_result(); - int free_result(uint8_t* result); - - /** - * sql statement generators (cached on Table) - */ - sqlite3_stmt* count(sqlite3* db); - sqlite3_stmt* update(sqlite3* db); - sqlite3_stmt* insert(sqlite3* db); - sqlite3_stmt* del(sqlite3* db); - - /** - * sql statement generators (cached by Database & libcache) - * - * - order is either ORDER_BY_ASC or ORDER_BY_DESC - * - count parameters should be the number of items in the va_list - * - args should have sets of 3 (integer and text) or 4 (blob) - * parameters for WHERE clause like Column*, char, value - * - Column* is the column to match against - * - char is how to compare, one of '=', '!', '>', or '<' - * - value is the value to match (1 for integer and text, 2 for blobs) - * which is ignored by these API since they leave placeholders - * instead - * - */ - sqlite3_stmt** count(sqlite3* db, uint32_t count, va_list args); - sqlite3_stmt** get_column(sqlite3* db, Column* value_column, - uint32_t count, va_list args); - sqlite3_stmt** get_row(sqlite3* db, uint32_t count, va_list args); - sqlite3_stmt** get_row_ordered(sqlite3* db, Column* order_by, int order, - uint32_t count, va_list args); - sqlite3_stmt** update_value(sqlite3* db, Column* value_column, - uint32_t count, va_list args); - sqlite3_stmt** del(sqlite3* db, uint32_t count, va_list args); - -protected: - - const char* create(); - const char* alter_add_column(uint32_t index); - - int where_va_columns(uint32_t count, char* query, size_t size, - size_t* used, va_list args); - const Column** columns(); - uint32_t column_count(); - - // free the out-of-band columns (text, blob) from a result record - int free_row(uint8_t* row); - void dump_results(FILE* f); - - char* m_name; - uint32_t m_version; // schema version this was added - - char* m_create_sql; - char* m_custom_create_sql; - char* m_insert_sql; - char* m_update_sql; - char* m_delete_sql; - - Column** m_columns; - uint32_t m_column_count; - uint32_t m_column_max; - int m_columns_size; - - sqlite3_stmt* m_prepared_insert; - sqlite3_stmt* m_prepared_update; - sqlite3_stmt* m_prepared_delete; - - uint8_t** m_results; - uint32_t m_result_count; - uint32_t m_result_max; - - friend struct Database; -}; - -#endif diff --git a/darwinup/Utils.cpp b/darwinup/Utils.cpp deleted file mode 100644 index 20ef838..0000000 --- a/darwinup/Utils.cpp +++ /dev/null @@ -1,525 +0,0 @@ -/* - * Copyright (c) 2005-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 "Utils.h" - -extern char** environ; - -int fts_compare(const FTSENT **a, const FTSENT **b) { - return strcmp((*a)->fts_name, (*b)->fts_name); -} - -size_t ftsent_filename(FTSENT* ent, char* filename, size_t bufsiz) { - if (ent == NULL) return 0; - if (ent->fts_level > 1) { - bufsiz = ftsent_filename(ent->fts_parent, filename, bufsiz); - } - strlcat(filename, "/", bufsiz); - bufsiz -= 1; - if (ent->fts_name) { - strlcat(filename, ent->fts_name, bufsiz); - bufsiz -= strlen(ent->fts_name); - } - return bufsiz; -} - -int mkdir_p(const char* path) { - int res; - - for (;;) { - // Use 0777, let the umask decide. - res = mkdir(path, 0777); - - if (res != 0 && errno == ENOENT) { - char tmp[PATH_MAX]; - strlcpy(tmp, path, PATH_MAX); - char* slash = strrchr(tmp, '/'); - if (slash) { *slash = 0; } - res = mkdir_p(tmp); - if (res != 0) { - break; - } - } else { - break; - } - } - return res; -} - -int remove_directory(const char* directory) { - int res = 0; - const char* path_argv[] = { directory, NULL }; - FTS* fts = fts_open((char**)path_argv, FTS_PHYSICAL | FTS_COMFOLLOW | FTS_XDEV, fts_compare); - FTSENT* ent = fts_read(fts); // throw away the entry for the DSTROOT itself - while (res == 0 && (ent = fts_read(fts)) != NULL) { - switch (ent->fts_info) { - case FTS_D: - break; - case FTS_F: - case FTS_SL: - case FTS_SLNONE: - case FTS_DEFAULT: - res = unlink(ent->fts_accpath); - break; - case FTS_DP: - res = rmdir(ent->fts_accpath); - break; - default: - fprintf(stderr, "%s:%d: unexpected fts_info type %d\n", __FILE__, __LINE__, ent->fts_info); - break; - } - } - fts_close(fts); - return res; -} - -int is_directory(const char* path) { - return is_directory(path, false); -} - -int is_directory(const char* path, bool followlinks) { - struct stat sb; - int res = 0; - if (followlinks) { - res = stat(path, &sb); - } else { - res = lstat(path, &sb); - } - return (res == 0 && S_ISDIR(sb.st_mode)); -} - -int is_regular_file(const char* path) { - struct stat sb; - int res = stat(path, &sb); - return (res == 0 && S_ISREG(sb.st_mode)); -} - -int is_url_path(const char* path) { - if (strncmp("http://", path, 7) == 0) { - return 1; - } - if (strncmp("https://", path, 8) == 0) { - return 1; - } - return 0; -} - -int is_userhost_path(const char* path) { - // look for user@host:path - const char *at = strchr(path, '@'); - const char *colon = strchr(path, ':'); - return at && colon && at < colon; -} - -int has_suffix(const char* str, const char* sfx) { - const char *tmp = str + (strlen(str) - strlen(sfx)); - if (tmp > str) { - return (strcmp(tmp, sfx) == 0); - } - return false; -} - -int exec_with_args(const char** args) { - return exec_with_args_fa(args, NULL); -} - -int exec_with_args_pipe(const char** args, int fd) { - int res = 0; - posix_spawn_file_actions_t fa; - - res = posix_spawn_file_actions_init(&fa); - if (res) { - fprintf(stderr, "Error: unable to initialize file actions: %d \n", res); - return res; - } - - res = posix_spawn_file_actions_adddup2(&fa, fd, 1); // pipe stdout - if (res) { - fprintf(stderr, "Error: (%d) unable to add dup2 for %d \n", res, fd); - return res; - } - - res = posix_spawn_file_actions_addclose(&fa, 2); // close stderr - if (res) { - fprintf(stderr, "Error: (%d) unable to add close for stderr.\n", res); - return res; - } - - res = posix_spawn_file_actions_addclose(&fa, 0); // close stdin - if (res) { - fprintf(stderr, "Error: (%d) unable to add close for stdin.\n", res); - return res; - } - - res = exec_with_args_fa(args, &fa); - posix_spawn_file_actions_destroy(&fa); - - return res; -} - -int exec_with_args_fa(const char** args, posix_spawn_file_actions_t* fa) { - int res = 0; - pid_t pid; - int status; - - IF_DEBUG("Spawn: %s \n", args[0]); - - res = posix_spawn(&pid, args[0], fa, NULL, (char**)args, environ); - if (res != 0) fprintf(stderr, "Error: Failed to spawn %s: %s (%d)\n", args[0], strerror(res), res); - - IF_DEBUG("Running: %s on pid %d \n", args[0], (int)pid); - - do { - res = waitpid(pid, &status, 0); - } while (res == -1 && errno == EINTR); - if (res != -1) { - if (WIFEXITED(status)) { - res = WEXITSTATUS(status); - } else { - res = -1; - } - } - - IF_DEBUG("Done: %s \n", args[0]); - - return res; -} - -#define compact_slashes(buf, count) do { memmove(buf - count + 1, buf, strlen(buf) + 1); buf -= count; } while (0) - -/** - * join_path joins two paths and removes any extra slashes, - * even internal ones in p1 or p2. It allocates memory - * for the string and the caller is responsible for freeing. - */ -int join_path(char **out, const char *p1, const char *p2) { - asprintf(out, "%s/%s", p1, p2); - if (!out) { - fprintf(stderr, "Error: join_path is out of memory!\n"); - return -1; - } - - int slashes = 0; - char *cur = *out; - while (*cur != '\0') { - if (*cur == '/') { - slashes++; - } else { - // we found the next non-slash - if (slashes > 1) { - compact_slashes(cur, slashes); - } - slashes = 0; - } - cur++; - } - // see if we had extra slashes at the very end of p2 - if (slashes > 1) { - compact_slashes(cur, slashes); - } - return 0; -} - -char* fetch_url(const char* srcpath, const char* dstpath) { - extern uint32_t verbosity; - char* localfile; - int res = join_path(&localfile, dstpath, basename((char*)srcpath)); - if (res || !localfile) return NULL; - - const char* args[] = { - "/usr/bin/curl", - (verbosity ? "-v" : "-s"), - "-L", srcpath, - "-o", localfile, - NULL - }; - if (res == 0) res = exec_with_args(args); - if (res == 0) return localfile; - return NULL; -} - -char* fetch_userhost(const char* srcpath, const char* dstpath) { - extern uint32_t verbosity; - int res = 0; - - // clean up srcpath by adding trailing slash - char* cleansrc; - res = join_path(&cleansrc, srcpath, "/"); - if (res != 0) return NULL; - - // make sure dstpath ends in basename of cleansrc for consistent rsync behavior - char* cleandst; - char* srccopy = strdup(cleansrc); // basename might modify input, so make a copy - res = join_path(&cleandst, dstpath, basename(srccopy)); - if (res != 0) return NULL; - - IF_DEBUG("rsync -a --delete %s %s %s \n", - (verbosity ? "-v" : "-q"), cleansrc, cleandst); - - const char* args[] = { - "/usr/bin/rsync", - (verbosity ? "-v" : "-q"), - "-a", "--delete", - cleansrc, - cleandst, - NULL - }; - - if (res == 0) res = exec_with_args(args); - free(srccopy); - free(cleansrc); - if (res == 0) return cleandst; - return NULL; -} - -int find_base_system_path(char** output, const char* path) { - // find the first /System as we walk up path - char system[PATH_MAX]; - char parent[PATH_MAX]; - strlcpy(parent, path, PATH_MAX); - int res = -1; - struct stat sb; - while (res) { - // walk up path - snprintf(system, PATH_MAX, "%s%sSystem", - parent, (parent[1] == '\0' ? "" : "/")); - res = stat(system, &sb); - if (parent[1] == '\0') { - // we hit the top of the filesystem - break; - } - if (res) snprintf(parent, PATH_MAX, "%s", dirname(parent)); - } - if (res) { - fprintf(stderr, "Error: (%d) unable to find base system path.\n", res); - return res; - } - - asprintf(output, "%s", parent); - return 0; -} - -int update_dyld_shared_cache(const char* path) { - extern uint32_t verbosity; - int res; - char* base; - res = find_base_system_path(&base, path); - if (res) return res; - - if (verbosity) { - fprintf(stdout, "Updating dyld shared cache for %s ... ", base); - fflush(stdout); - } - - // exec the tool from our target system - char* toolpath; - join_path(&toolpath, base, "/usr/bin/update_dyld_shared_cache"); - - struct stat sb; - res = stat(toolpath, &sb); - if (res) { - return 1; - } - - const char* args[] = { - toolpath, - "-root", base, - NULL - }; - res = exec_with_args(args); - - if (verbosity) fprintf(stdout, "Done updating dyld shared cache\n"); - - free(toolpath); - free(base); - return res; -} - -int update_xpc_services_cache(const char* path) { - extern uint32_t verbosity; - int res; - char* base; - res = find_base_system_path(&base, path); - if (res) return res; - - char* toolpath; - join_path(&toolpath, base, "/usr/libexec/xpchelper"); - - struct stat sb; - res = stat(toolpath, &sb); - if (res || ((sb.st_mode & S_IXUSR) == 0)) { - // no xpchelper - char* cachedir; - join_path(&cachedir, base, "/System/Library/Caches/com.apple.xpcd"); - - res = mkdir_p(cachedir); - if (!res || errno == EEXIST) { - char* cachepath; - join_path(&cachepath, cachedir, "xpcd_cache.dylib"); - - res = open(cachepath, O_APPEND | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - if (res >= 0) { - close(res); - res = 0; - } else { - fprintf(stderr, "Error: (%d) failed to touch cache file.\n", errno); - res = errno; - } - free(cachepath); - } else { - res = errno; - fprintf(stderr, "Error: (%d) failed to mkdir_p cache directory.\n", res); - } - if (verbosity) fprintf(stdout, "Touched xpc cache file.\n"); - free(cachedir); - } else { - // xpchelper expects the --root value to *not* end in a slash. - if (has_suffix(base, "/")) { - char *ptr = strrchr(base, '/'); - if (ptr) { - *ptr = '\0'; - } - } - - if (verbosity) { - fprintf(stdout, "Updating xpc services cache for %s ...", base); - fflush(stdout); - } - - const char* args[] = { - toolpath, - "--rebuild-cache", - "--root", base, - NULL - }; - res = exec_with_args(args); - - if (verbosity) fprintf(stdout, "Done updating xpc cache\n"); - } - - free(toolpath); - free(base); - return res; -} - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 -int build_number_for_path(char** build, const char* path) { - ssize_t res = 0; - char system[PATH_MAX]; - char* base; - - *build = (char*)calloc(1, 16); - - // find the version plist for our target path - find_base_system_path(&base, path); - if (!base) return 1; - snprintf(system, PATH_MAX, "%s/System/Library/CoreServices/SystemVersion.plist", base); - free(base); - - struct stat sb; - res = stat(system, &sb); - if (res) { - snprintf(*build, 16, " "); - return 1; - } - - // read version plist to get build number - const char* args[] = { - "/usr/libexec/PlistBuddy", - "-c", "Print ProductBuildVersion", - system, - NULL - }; - int pfd[2]; - res = pipe(pfd); - if (res) { - fprintf(stderr, "Error: (%ld) failed to create pipe.\n", res); - return (int)res; - } - exec_with_args_pipe(args, pfd[1]); - - // read from the pipe - close(pfd[1]); - res = 1; - while (res > 0 && res < 15) { - res = read(pfd[0], *build, 15); - // strip newline - if (res > 1 && (*build)[res-1] == '\n') (*build)[res-1] = '\0'; - } - close(pfd[0]); - - if (res == 0) return (int)res; // success - - if (res == -1) { - fprintf(stderr, "Error: failed to read build from plist.\n"); - return (int)res; - } - - return -1; -} - -int tell_finder_to_restart() { - int res = 0; - - const char *args[] = { - "/usr/bin/osascript", "-e", - "tell app \"Finder\" to restart", - NULL, - }; - - res = exec_with_args(args); - - return res; -} -#endif - -void __data_hex(FILE* f, uint8_t* data, uint32_t size) { - if (!size) return; - for (uint32_t i=0; i < size; i++) { - if (!(i%8)) { - if (i<10) fprintf(f, " "); - fprintf(f, "%d", i); - } else { - fprintf(f, " "); - } - } - fprintf(f, "\n"); - for (uint32_t i=0; i < size; i++) { - fprintf(f, "%02x", data[i]); - } - fprintf(f, "\n"); -} - -void hr() { - fprintf(stdout, "==============================================" - "=======================================\n"); -} diff --git a/darwinup/Utils.h b/darwinup/Utils.h deleted file mode 100644 index c5bd7a2..0000000 --- a/darwinup/Utils.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2005-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@ - */ - -#ifndef _UTILS_H -#define _UTILS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -const uint32_t VERBOSE = 0x1; -const uint32_t VERBOSE_DEBUG = 0x2; -const uint32_t VERBOSE_SQL = 0x4; - -#define IF_DEBUG(...) do { extern uint32_t verbosity; if (verbosity & VERBOSE_DEBUG) fprintf(stderr, "DEBUG: " __VA_ARGS__); } while (0) -#define IF_SQL(...) do { extern uint32_t verbosity; if (verbosity & VERBOSE_SQL) fprintf(stderr, "DEBUG: " __VA_ARGS__); } while (0) - -int fts_compare(const FTSENT **a, const FTSENT **b); -size_t ftsent_filename(FTSENT* ent, char* filename, size_t bufsiz); -int mkdir_p(const char* path); -int remove_directory(const char* path); -int is_directory(const char* path); -int is_directory(const char* path, bool followlinks); -int is_regular_file(const char* path); -int is_url_path(const char* path); -int is_userhost_path(const char* path); -int has_suffix(const char* str, const char* sfx); - -int exec_with_args(const char** args); -int exec_with_args_pipe(const char** args, int fd); -int exec_with_args_fa(const char** args, posix_spawn_file_actions_t* fa); - -int join_path(char** out, const char* p1, const char* p2); -int compact_slashes(char* orig, int slashes); - -char* fetch_url(const char* srcpath, const char* dstpath); -char* fetch_userhost(const char* srcpath, const char* dstpath); - -int find_base_system_path(char** output, const char* path); -int update_dyld_shared_cache(const char* path); -int update_xpc_services_cache(const char* path); - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 -int build_number_for_path(char** build, const char* path); -int tell_finder_to_restart(); -#endif - -void __data_hex(FILE* f, uint8_t* data, uint32_t size); - -// print a horizontal line to stdout -void hr(); - -inline bool INFO_TEST(uint64_t word, uint64_t flag) { return ((word & flag) != 0); } -inline uint64_t INFO_SET(uint64_t word, uint64_t flag) { return (word | flag); } -inline uint64_t INFO_CLR(uint64_t word, uint64_t flag) { return (word & (~flag)); } - -#endif diff --git a/darwinup/darwinup.1 b/darwinup/darwinup.1 deleted file mode 100644 index b5e9820..0000000 --- a/darwinup/darwinup.1 +++ /dev/null @@ -1,251 +0,0 @@ -.ig -Copyright (c) 2010 Apple 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@ -.. -.Dd 16 Apr, 2010 -.Dt darwinup 1 -.Os Darwin -.Sh NAME -.Nm darwinup -.Nd Install, uninstall, and manage roots -.Sh SYNOPSIS -.Nm -.Op Fl dfnv -.Op Fl p Ar path -.Ar subcommand -.Op Ar arguments ... -.Sh DESCRIPTION -.Nm -allows you to manage roots, or -archives, of files that replace parts of your system. This is useful -for installing a new version of a library or tool on your system while -allowing you to uninstall the files and revert back to the originals -safely and easily. -.Sh OPTIONS -.Bl -tag -width -indent -.It \-d -Do not run helpful automation. See HELPFUL AUTOMATION below. -.It \-f -Force. Some operations will fail gracefully due to potentially unsafe -situations, such as a root that installs a file where a directory is. -In order to have darwinup continue through such a situation, you can -pass the -f option. -.It \-n -Dry run. Darwinup will go through an operation, including analyzing -the root(s) and printing the state/change symbol, but no files will -be modified on your system and no records will be added to the depot. -This option implies -d. -.It \-p Op Ar path -Prefix path. Normally, darwinup will operate on the boot partition. You -can use the -p option to have darwinup work on another partition. You -can provide any arbitrary path, it does not need to be a mount point. -.It \-r -Restart. Gracefully restart after all operations are complete by telling -Finder to restart. -.It \-v -Verbose. This option causes darwinup to print extra information. You can -pass 2 or 3 v's for even more information, but that is usually only needed -for development and debugging of darwinup itself. -.El -.Sh SUBCOMMANDS -Note that the -.Ar path -and -.Ar archive -options listed below support globbing and multiple items. See the EXAMPLES -section below for more details. -.Bl -tag -width -indent -.It files Ar archives -List the files and directories in the -.Ar archive . -.It install Ar path -Install the root at -.Ar path . -.It list Op Ar archive -List archives that are installed. You may optionally provide an -archive specification to limit which archives get listed. -.It rename Ar archive Ar name -Rename an archive. -.It uninstall Ar archives -Uninstall the specified archive. -.It upgrade Ar path -Find the last archive that was installed with the same name (basename of -path), and replace it with the root at -.Ar path . -.It verify Ar archive -List all of the information about -.Ar archive . -This includes status letters -detailing how the archive differs from whats on disk -.El -.Sh STATE/CHANGE SYMBOLS -.Bl -tag -width -indent -.It ? -Unknown state. Probably a bug. -.It ! -Missing file during uninstall. Darwinup expected a file or directory to -exist, but it did not. This could be a bug in darwinup, but most likely -another tool or software update removed a file that darwinup had been -tracking. It can also be caused by an installation failing due to an -object changing type (see FORCING OPERATIONS below), and the subsequent -rollback finding the root only partially installed. Since these all -happen during uninstall, they are typically safe to ignore, since darwinup -was going to delete the object anyway. -.It A -Added. No previous file or directory existed so the file or directory was -added to your system. -.It E -External change. The file you are installing is different than the -last file you installed, but it is identical to what was actually found -on disk. This probably means something manually installed a root or software -update without darwinup knowing about it. This is usually harmless. -.It M -Mode change. Only changes to permission or ownership were needed to -uninstall the file or directory. -.It R -Removed. No previous file or directory existed, so the uninstall process -removed the file. -.It U -Updated. During installation, the file or directory replaces an existing -object at the same path. During uninstallation, the previous version of -the file was restored. -.El -.Sh SUPPORTED PATHS -.Bl -tag -width -indent -.It /path/to/file-or-directory -You can install archive files or directories by specifying a relative or -absolute path. If the path is a directory, all files below it will be -installed as a single root. If the path points to a file, it must be one of -the suported archive file types as described in the usage statement. -.It user@host:/path/to/file-or-directory -You can install files or directories from another host via rsync/ssh. -The files/directories will be downloaded to your machine and then installed -like any other root. -.It http[s]://host/path/to/file -You can install files from an archive hosted on an HTTP/HTTPS server. The -archive file will be downloaded using curl to your machine and then -installed like any other archive file. You can not point darwinup at a -directory hosted via HTTP or HTTPS, only archive files such as tarballs. -.El -.Sh ARCHIVE SPECIFICATIONS -When running a subcommand which takes an -.Ar archive -argument, you can use one or more of the following items to specify which -archive to operate on. You can mix and match any of them as needed. -You can use the list subcommand with these specifications to see what will -match. -.Bl -tag -width -indent -.It Ar serial -You can specify an archive with its serial number, which can be found using -the list subcommand. -.It Ar uuid -You can specify an archive with its UUID, which can be found using the -list subcommand. -.It Ar name -You can specify an archive with its name, which can be found using the -list subcommand. -.It newest -The newest keyword will match the one archive which was most recently -installed. This should always be the first archive listed. -.It oldest -The oldest keyword will match the one archive which was installed the -longest time ago. This should always be the last archive listed. -.It superseded -The superseded keyword will match zero or more archives. An archive is -superseded if every file it contains is contained in an archive that was -(and still is) installed after it. A file in an archive can also be superseded -by external changes, such as operating system updates. When uninstalling a -superseded archive, you should never see any status symbols, since being -superseded means there is a newer file on disk. -.It all -The all keyword will match all archives. If you specify extra verbosity -with -vv, then rollback archives will also be matched by the all keyword. This -means that -.Nm darwinup -vv uninstall all -will attempt to uninstall rollback archives, which will print a message -about not being able to uninstall rollback archives. This is normal and -not a problem. -.El -.Sh FORCING OPERATIONS -There are 2 cases where darwinup will require you to pass the force (-f) -option before proceeding with an operation. -.Bl -tag -width -indent -.It Object Type Change -If you install an archive which contains a file with the same path as a -directory on your system, or vice versa, darwinup will give you a error -about not doing that unless you really want to force it. If you do force -the operation, darwinup will delete the existing object and replace it with -the object from the root. This can happen when a directory full of files -gets packaged up in some opaque file, like xibs/nibs. If you expect this -"type change", then it is probably safe to force the operation. -.It Uninstall a root from an older base system -Darwinup remembers the version (build) of the operating system when a root -is installed. The reason for this is darwinup saves the old (replaced) -files during the installation procedure. Those backups may have come from -the older operating system, and thus are not necessarily compatible with -the current build of the operating system. So if you try to uninstall an -archive that had been installed on a different version of the operating -system, darwinup will stop and provide a message asking you to force the -operation if you really want to. If the files you are uninstalling are all -superseded, then you should not get this error as the backup copies will -not be used anyway. -.El -.Sh HELPFUL AUTOMATION -Darwinup tries to detect common situations and run external tools that you -would otherwise have to remember to run yourself. The "dry run" (-n) and -"disable automation" (-d) options prevent any of the following from -happening. -.Bl -tag -width -indent -.It Dyld Cache -If a root modifies any file, then darwinup will run -update_dyld_shared_cache unless the -d option is specified. -.It Kernel Extensions -If a root modifies a file under /System/Library/Extensions, then darwinup -will update the mtime of /System/Library/Extensions to ensure that the -kext cache is updated during the next boot. -.El -.Sh EXAMPLES -.Bl -tag -width -indent -.It Install files from a tarball -$ darwinup install library-1.2.3.tar.gz -.It Install several directories from /tmp/ -$ darwinup install /tmp/*/*~dst/ -.It Uninstall everything -$ darwinup uninstall all -.It See what archives have been superseded and then uninstall them -$ darwinup list superseded -$ darwinup uninstall superseded -.It Uninstall several archives by serial, the oldest one, and one named myroot -$ darwinup uninstall 9 16 myroot oldest -.It Install a root from src.macosforge.org -$ darwinup install http://src.macosforge.org/Roots/10D573/zlib.root.tar.gz -.El -.Sh SEE ALSO -.Xr rsync 1 , -.Xr curl 1 , -.Xr tar 1 , -.Xr gzip 1 , -.Xr ditto 1 , -.Xr update_dyld_shared_cache 1 \ No newline at end of file diff --git a/darwinup/main.cpp b/darwinup/main.cpp deleted file mode 100644 index e2a18d8..0000000 --- a/darwinup/main.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 2005-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 -#include -#include -#include -#include -#include -#include -#include - -#include "Archive.h" -#include "Depot.h" -#include "Utils.h" -#include "DB.h" - - -void usage(char* progname) { - fprintf(stderr, "usage: %s [-v] [-p DIR] [command] [args] \n", progname); - fprintf(stderr, "version: 36 \n"); - fprintf(stderr, " \n"); - fprintf(stderr, "options: \n"); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - fprintf(stderr, " -d disable helpful automation \n"); -#endif - fprintf(stderr, " -f force operation to succeed at all costs \n"); - fprintf(stderr, " -n dry run \n"); - fprintf(stderr, " -p DIR operate on roots under DIR (default: /) \n"); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - fprintf(stderr, " -r gracefully restart when finished \n"); -#endif - fprintf(stderr, " -v verbose (use -vv for extra verbosity) \n"); - fprintf(stderr, " \n"); - fprintf(stderr, "commands: \n"); - fprintf(stderr, " files \n"); - fprintf(stderr, " install \n"); - fprintf(stderr, " list [archive] \n"); - fprintf(stderr, " rename \n"); - fprintf(stderr, " uninstall \n"); - fprintf(stderr, " upgrade \n"); - fprintf(stderr, " verify \n"); - fprintf(stderr, " \n"); - fprintf(stderr, " is one of: \n"); - fprintf(stderr, " /path/to/local/dir-or-file \n"); - fprintf(stderr, " user@host:/path/to/remote/dir-or-file \n"); - fprintf(stderr, " http[s]://host/path/to/remote/file \n"); - fprintf(stderr, " \n"); - fprintf(stderr, "Files must be in one of the supported archive formats: \n"); - fprintf(stderr, " cpio, cpio.gz, cpio.bz2 \n"); - fprintf(stderr, " pax, pax.gz, pax.bz2 \n"); - fprintf(stderr, " tar, tar.gz, tar.bz2 \n"); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - fprintf(stderr, " xar, zip \n"); -#else - fprintf(stderr, " zip \n"); -#endif - fprintf(stderr, " \n"); - fprintf(stderr, "archive is one of: \n"); - fprintf(stderr, " the Serial number \n"); - fprintf(stderr, " the UUID \n"); - fprintf(stderr, " the last root installed with that name \n"); - fprintf(stderr, " newest the newest (last) root installed \n"); - fprintf(stderr, " oldest the oldest root installed \n"); - fprintf(stderr, " superseded all roots that have been fully replaced \n"); - fprintf(stderr, " by newer roots \n"); - fprintf(stderr, " all all installed roots \n"); - fprintf(stderr, " \n"); - exit(1); -} - -// our globals -uint32_t verbosity; -uint32_t force; -uint32_t dryrun; - - -int main(int argc, char* argv[]) { - char* progname = strdup(basename(argv[0])); - char* path = NULL; - bool disable_automation = false; -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - bool restart = false; -#endif - - int ch; -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - while ((ch = getopt(argc, argv, "dfnp:rvh")) != -1) { -#else - while ((ch = getopt(argc, argv, "dfnp:vh")) != -1) { -#endif - switch (ch) { - case 'd': - disable_automation = true; - break; - case 'f': - force = 1; - break; - case 'n': - dryrun = 1; - disable_automation = true; - break; - case 'p': - if (optarg[0] != '/') { - fprintf(stderr, "Error: -p option must be an absolute path\n"); - exit(4); - } - if (strlen(optarg) > (PATH_MAX - 1)) { - fprintf(stderr, "Error: -p option value is too long \n"); - exit(4); - } - join_path(&path, optarg, "/"); - break; -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - case 'r': - restart = true; - break; -#endif - case 'v': - verbosity <<= 1; - verbosity |= VERBOSE; - break; - case '?': - case 'h': - default: - usage(progname); - } - } - argc -= optind; - argv += optind; - if (argc == 0) usage(progname); - - int res = 0; - - if (dryrun) IF_DEBUG("option: dry run\n"); - if (force) IF_DEBUG("option: forcing operations\n"); - if (disable_automation) IF_DEBUG("option: helpful automation disabled\n"); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - if (restart) IF_DEBUG("option: restart when finished\n"); -#endif - - if (!path) { - asprintf(&path, "/"); - } else { - IF_DEBUG("option: path is %s\n", path); - } - - Depot* depot = new Depot(path); - - // list handles args optional and in special ways - if (strcmp(argv[0], "list") == 0) { - res = depot->initialize(false); - if (res == DEPOT_NOT_EXIST) { - // we are not asking to write, - // but no depot exists yet either, - // so print an empty list - depot->archive_header(); - exit(0); - } - if (res == DEPOT_PERM_DENIED) { - // permission denied when trying to read - // the depot - fprintf(stderr, "Permission denied when trying to read the database.\n"); - exit(6); - } - if (res == 0) depot->list(argc-1, (char**)(argv+1)); - } else if (argc == 1) { - // other commands which take no arguments - if (strcmp(argv[0], "dump") == 0) { - if (depot->initialize(false)) exit(11); - depot->dump(); - } else { - fprintf(stderr, "Error: unknown command: '%s' \n", argv[0]); - usage(progname); - } - } else { - // loop over arguments - for (int i = 1; i < argc && res == 0; i++) { - if (strcmp(argv[0], "install") == 0) { - if (i==1 && depot->initialize(true)) exit(13); - // gaurd against installing paths ontop of themselves - if (strncmp(path, argv[i], strlen(argv[i])) == 0 - && (strlen(path) == strlen(argv[i]) - || strlen(path) - 1 == strlen(argv[i]))) { - if (strncmp(path, "/", 1) == 0 && strlen(path) == 1) { - fprintf(stderr, "Error: You provided '/' as a path to a root. " - "If you meant to specify a destination of '/', then you " - "just need to remove the '/' argument as the destination " - "defaults to '/'. Use the -p option to specify another " - "destination.\n"); - } else { - fprintf(stderr, "Error: You cannot install the root at '%s' onto" - " itself.\n", path); - } - res = DEPOT_ERROR; - } - if (res == 0) res = depot->install(argv[i]); - } else if (strcmp(argv[0], "upgrade") == 0) { - if (i==1 && depot->initialize(true)) exit(14); - // find most recent matching archive by name - Archive* old = depot->get_archive(basename(argv[i])); - if (!old) { - fprintf(stderr, "Error: unable to find a matching root to upgrade.\n"); - res = 5; - } - // install new archive - if (res == 0) res = depot->install(argv[i]); - // uninstall old archive - if (res == 0) res = depot->uninstall(old); - } else if (strcmp(argv[0], "files") == 0) { - if (i==1 && depot->initialize(false)) exit(12); - res = depot->process_archive(argv[0], argv[i]); - } else if (strcmp(argv[0], "uninstall") == 0) { - if (i==1 && depot->initialize(true)) exit(15); - res = depot->process_archive(argv[0], argv[i]); - } else if (strcmp(argv[0], "verify") == 0) { - if (i==1 && depot->initialize(true)) exit(16); - res = depot->process_archive(argv[0], argv[i]); - } else if (strcmp(argv[0], "rename") == 0) { - if (i==1 && depot->initialize(true)) exit(17); - if ((i+1) >= argc) { - fprintf(stderr, - "Error: rename command for '%s' takes 2 arguments.\n", - argv[i]); - exit(18); - } - res = depot->rename_archive(argv[i], argv[i+1]); - i++; - } else { - fprintf(stderr, "Error: unknown command: '%s' \n", argv[0]); - usage(progname); - } - } -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - if (!disable_automation && depot->is_dirty() && res == 0) { - res = update_dyld_shared_cache(path); - if (res) fprintf(stderr, "Warning: could not update dyld cache.\n"); - res = 0; - } - if (!disable_automation && depot->has_modified_extensions() && res == 0) { - char *sle_path; - res = join_path(&sle_path, depot->prefix(), "/System/Library/Extensions"); - IF_DEBUG("Touching /System/Library/Extensions\n"); - if (res == 0) res = utimes(sle_path, NULL); - if (res) { - fprintf(stderr, "Warning: unable to touch %s \n", sle_path); - res = 0; - } - free(sle_path); - } -#endif - if (!disable_automation && depot->has_modified_xpc_services() && res == 0) { - res = update_xpc_services_cache(path); - if (res) fprintf(stderr, "Warning: could not update xpc services cache.\n"); - res = 0; - } -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - if (restart && res == 0) { - res = tell_finder_to_restart(); - if (res) fprintf(stderr, "Warning: tried to tell Finder to restart" - "but failed.\n"); - res = 0; - } -#endif - } - - free(path); - exit(res); - return res; -} diff --git a/darwinxref/DBDataStore.c b/darwinxref/DBDataStore.c index 1f67107..492a599 100644 --- a/darwinxref/DBDataStore.c +++ b/darwinxref/DBDataStore.c @@ -557,8 +557,8 @@ int DBSetProp(CFStringRef build, CFStringRef project, CFStringRef property, CFTy int res = 0; CFTypeID type = DBCopyPropType(property); if (type == -1) { - cfprintf(stderr, "Error: unknown property in project \"%@\": %@\n", project, property); - return -1; + // Silently ignore unknown properties. + return 0; } if (type != CFGetTypeID(value)) { CFStringRef expected = CFCopyTypeIDDescription(type); diff --git a/darwinxref/DBDataStore.h b/darwinxref/DBDataStore.h index 7e0f177..ded27a9 100644 --- a/darwinxref/DBDataStore.h +++ b/darwinxref/DBDataStore.h @@ -41,6 +41,6 @@ int SQL_CALLBACK(sqlite3_callback callback, void* context, const char* fmt, . void SQL_NOERR(char* sql); char* SQL_STRING(const char* fmt, ...); -void* _DBPluginGetDataStorePtr(); +void* _DBPluginGetDataStorePtr(void); #endif diff --git a/darwinxref/DBPlugin.h b/darwinxref/DBPlugin.h index 53053ca..67267e1 100644 --- a/darwinxref/DBPlugin.h +++ b/darwinxref/DBPlugin.h @@ -63,7 +63,7 @@ typedef int (*DBPluginRunFunc)(CFArrayRef argv); any callbacks from the plugin. @result The command line usage string. */ -typedef CFStringRef (*DBPluginUsageFunc)(); +typedef CFStringRef (*DBPluginUsageFunc)(void); /*! @@ -132,13 +132,13 @@ void DBPluginSetSubDictDataType(CFTypeID type); // default handlers int DBPluginPropertyDefaultRun(CFArrayRef argv); -CFStringRef DBPluginPropertyDefaultUsage(); +CFStringRef DBPluginPropertyDefaultUsage(void); // generally available routines -CFStringRef DBGetCurrentBuild(); +CFStringRef DBGetCurrentBuild(void); int DBHasBuild(CFStringRef build); -CFArrayRef DBCopyBuilds(); +CFArrayRef DBCopyBuilds(void); CFArrayRef DBCopyBuildInheritance(CFStringRef build); @@ -188,9 +188,9 @@ CFArrayRef DBCopyGroupNames(CFStringRef build); CFArrayRef DBCopyGroupMembers(CFStringRef build, CFStringRef group); int DBSetGroupMembers(CFStringRef build, CFStringRef group, CFArrayRef members); -int DBBeginTransaction(); -int DBCommitTransaction(); -int DBRollbackTransaction(); +int DBBeginTransaction(void); +int DBCommitTransaction(void); +int DBRollbackTransaction(void); #include "cfutils.h" diff --git a/darwinxref/DBPluginPriv.h b/darwinxref/DBPluginPriv.h index e3bcc9a..a533fa0 100644 --- a/darwinxref/DBPluginPriv.h +++ b/darwinxref/DBPluginPriv.h @@ -67,18 +67,18 @@ struct DBPlugin { // DBPluginSetPropFunc setprop; }; -void* _DBPluginGetDataStorePtr(); -DBPlugin* _DBPluginGetCurrentPlugin(); +void* _DBPluginGetDataStorePtr(void); +DBPlugin* _DBPluginGetCurrentPlugin(void); const DBPlugin* DBGetPluginWithName(CFStringRef name); -int DBBeginTransaction(); -int DBRollbackTransaction(); -int DBCommitTransaction(); +int DBBeginTransaction(void); +int DBRollbackTransaction(void); +int DBCommitTransaction(void); #if HAVE_TCL_PLUGINS int load_tcl_plugin(DBPlugin* plugin, const char* filename); -CFStringRef _DBPluginTclUsage(); +CFStringRef _DBPluginTclUsage(void); int _DBPluginTclRun(CFArrayRef args); #endif diff --git a/darwinxref/cfutils.c b/darwinxref/cfutils.c index 0d483a6..f0903a0 100644 --- a/darwinxref/cfutils.c +++ b/darwinxref/cfutils.c @@ -84,15 +84,29 @@ CFPropertyListRef read_plist(char* path) { if (stat(path, &sb) != -1) { size_t size = (size_t)sb.st_size; void* buffer = mmap(NULL, size, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, (off_t)0); - if (buffer != (void*)-1) { - CFDataRef data = CFDataCreateWithBytesNoCopy(NULL, buffer, size, kCFAllocatorNull); - if (data) { + if (buffer != (void*)-1) { + CFDataRef data = CFDataCreateWithBytesNoCopy(NULL, buffer, size, kCFAllocatorNull); + if (data) { +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + CFErrorRef str = 0; + result = CFPropertyListCreateWithData(NULL, data, kCFPropertyListMutableContainers, 0, &str); + CFRelease(data); + if (result == NULL) { + CFStringRef errorDesc = CFErrorCopyDescription(str); + perror_cfstr(errorDesc); + CFRelease(errorDesc); + } +#else CFStringRef str = NULL; result = CFPropertyListCreateFromXMLData(NULL, data, kCFPropertyListMutableContainers, &str); CFRelease(data); if (result == NULL) { perror_cfstr(str); } +#endif + if (str) { + CFRelease(str); + } } munmap(buffer, size); } else { diff --git a/darwinxref/darwinxref.entitlements b/darwinxref/darwinxref.entitlements new file mode 100644 index 0000000..8cc185a --- /dev/null +++ b/darwinxref/darwinxref.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.cs.disable-library-validation + + + diff --git a/darwinxref/main.c b/darwinxref/main.c index e706001..9cfda30 100644 --- a/darwinxref/main.c +++ b/darwinxref/main.c @@ -44,8 +44,8 @@ // user environment global extern char** environ; -char* readBuildFile(); -char* determineHostBuildVersion(); +char* readBuildFile(void); +char* determineHostBuildVersion(void); int main(int argc, char* argv[]) { char* progname = argv[0]; @@ -130,7 +130,7 @@ char* determineHostBuildVersion() // Notice the careful dance around these symbols as they may // someday disappear entirely, in which case this program // will need to be revved. - CFDictionaryRef (*fptr)() = dlsym(RTLD_DEFAULT, "_CFCopySystemVersionDictionary"); + CFDictionaryRef (*fptr)(void) = dlsym(RTLD_DEFAULT, "_CFCopySystemVersionDictionary"); if (fptr) { CFDictionaryRef dict = fptr(); if (dict != NULL) { diff --git a/darwinxref/plugins/branch.tcl b/darwinxref/plugins/branch.tcl deleted file mode 100644 index 94f66e7..0000000 --- a/darwinxref/plugins/branch.tcl +++ /dev/null @@ -1,3 +0,0 @@ -DBPluginSetName branch -DBPluginSetType property.project -DBPluginSetDatatype string diff --git a/darwinxref/plugins/c_plugins.xcconfig b/darwinxref/plugins/c_plugins.xcconfig index 6054d37..3020e37 100644 --- a/darwinxref/plugins/c_plugins.xcconfig +++ b/darwinxref/plugins/c_plugins.xcconfig @@ -41,7 +41,7 @@ GCC_WARN_UNUSED_LABEL = YES GCC_WARN_UNUSED_VALUE = YES GCC_WARN_UNUSED_VARIABLE = YES OTHER_CFLAGS = -OTHER_LDFLAGS = -framework CoreFoundation -ltcl -lsqlite3 +OTHER_LDFLAGS = -framework CoreFoundation -lsqlite3 $(SRCROOT)/darwinxref/libtcl8.6.dylib -rpath "@loader_path/.." PRODUCT_NAME = $(TARGET_NAME) WARNING_CFLAGS = -Werror -Wall PREFIX = /usr/local diff --git a/darwinxref/plugins/exportIndex.c b/darwinxref/plugins/exportIndex.c index 8baac6b..3c348f0 100644 --- a/darwinxref/plugins/exportIndex.c +++ b/darwinxref/plugins/exportIndex.c @@ -53,11 +53,15 @@ static int run(CFArrayRef argv) { CFPropertyListRef plist = DBCopyBuildPlist(build); if (xml) { +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 CFDataRef data = CFPropertyListCreateData(kCFAllocatorDefault, plist, kCFPropertyListXMLFormat_v1_0, 0, NULL); +#else + CFDataRef data = CFPropertyListCreateXMLData(NULL, plist); +#endif res = write(STDOUT_FILENO, CFDataGetBytePtr(data), (size_t)CFDataGetLength(data)); } else { res = writePlist(stdout, plist, 0); diff --git a/darwinxref/plugins/exportProject.c b/darwinxref/plugins/exportProject.c index 4c6bc67..121d0ae 100644 --- a/darwinxref/plugins/exportProject.c +++ b/darwinxref/plugins/exportProject.c @@ -44,7 +44,7 @@ static int run(CFArrayRef argv) { CFDictionaryRef project = NULL; CFStringRef projname; CFArrayRef builds; - const void *ssites, *bsites; + const void *ssites, *bsites, *psites; CFStringRef build = DBGetCurrentBuild(); if (count == 2) { @@ -64,6 +64,7 @@ static int run(CFArrayRef argv) { preplist = (CFMutableDictionaryRef)DBCopyProjectPlist(build, NULL); ssites = CFDictionaryGetValue(preplist, CFSTR("source_sites")); bsites = CFDictionaryGetValue(preplist, CFSTR("binary_sites")); + psites = CFDictionaryGetValue(preplist, CFSTR("patch_sites")); preplist = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks,&kCFTypeDictionaryValueCallBacks); for( i = 0; i < CFArrayGetCount(builds); i++ ) { @@ -80,10 +81,19 @@ static int run(CFArrayRef argv) { CFDictionarySetValue(preplist, CFSTR("projects"), dict); if(ssites) CFDictionarySetValue(preplist, CFSTR("source_sites"), ssites); if(bsites) CFDictionarySetValue(preplist, CFSTR("binary_sites"), bsites); + if(psites) CFDictionarySetValue(preplist, CFSTR("patch_sites"), psites); CFPropertyListRef plist = preplist; if (xml) { +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + CFDataRef data = CFPropertyListCreateData(kCFAllocatorDefault, + plist, + kCFPropertyListXMLFormat_v1_0, + 0, + NULL); +#else CFDataRef data = CFPropertyListCreateXMLData(NULL, plist); +#endif res = write(STDOUT_FILENO, CFDataGetBytePtr(data), (ssize_t)CFDataGetLength(data)); } else { res = writePlist(stdout, plist, 0); diff --git a/darwinup/SerialSet.h b/darwinxref/plugins/patch_sites.c similarity index 78% rename from darwinup/SerialSet.h rename to darwinxref/plugins/patch_sites.c index b6abb5a..296375d 100644 --- a/darwinup/SerialSet.h +++ b/darwinxref/plugins/patch_sites.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2010 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. * * @APPLE_BSD_LICENSE_HEADER_START@ * @@ -30,22 +30,15 @@ * @APPLE_BSD_LICENSE_HEADER_END@ */ -#ifndef _SERIALSET_H -#define _SERIALSET_H +#include "DBPlugin.h" -#include -#include - -// a variably lengthed set of serial numbers from the database -struct SerialSet { - SerialSet(); - ~SerialSet(); - - int add(uint64_t value); - - uint32_t capacity; - uint32_t count; - uint64_t* values; -}; - -#endif +int initialize(int version) { + //if ( version < kDBPluginCurrentVersion ) return -1; + + DBPluginSetType(kDBPluginPropertyType); + DBPluginSetName(CFSTR("patch_sites")); + DBPluginSetRunFunc(&DBPluginPropertyDefaultRun); + DBPluginSetUsageFunc(&DBPluginPropertyDefaultUsage); + DBPluginSetDataType(CFArrayGetTypeID()); + return 0; +} diff --git a/darwinxref/plugins/patch_sites.tcl b/darwinxref/plugins/patch_sites.tcl new file mode 100644 index 0000000..67dfdb2 --- /dev/null +++ b/darwinxref/plugins/patch_sites.tcl @@ -0,0 +1,3 @@ +DBPluginSetName patch_sites +DBPluginSetType property.project +DBPluginSetDatatype array diff --git a/darwinxref/plugins/register.c b/darwinxref/plugins/register.c index 4eea2b7..d9c10d3 100644 --- a/darwinxref/plugins/register.c +++ b/darwinxref/plugins/register.c @@ -122,7 +122,7 @@ static size_t ent_filename(FTSENT* ent, char* filename, size_t bufsiz) { } strncat(filename, "/", bufsiz); bufsiz -= 1; - if (ent->fts_name) { + if (ent->fts_namelen != 0) { strncat(filename, ent->fts_name, bufsiz); bufsiz -= strlen(ent->fts_name); } @@ -154,62 +154,6 @@ static char* calculate_digest(int fd) { return format_digest(md); } -static char* calculate_unprebound_digest(const char* filename); - -static int have_undo_prebinding() { - static int result = -2; - if (result == -2) { - struct stat sb; - result = stat("/usr/bin/redo_prebinding", &sb); - } - - // Not all versions of redo_prebinding support -u - if (result == 0) { - char* digest = calculate_unprebound_digest("/bin/sh"); - if (digest) { - if (strcmp(digest, "ERROR") == 0) { - result = -1; - } - free(digest); - } - } - return result; -} - -static char* calculate_unprebound_digest(const char* filename) { - pid_t pid; - int status; - int fds[2]; - - assert(pipe(fds) != -1); - - pid = fork(); - assert(pid != -1); - if (pid == 0) { - close(fds[0]); - assert(dup2(fds[1], STDOUT_FILENO) != -1); - const char* args[] = { - "/usr/bin/redo_prebinding", - "-z", "-u", "-i", "-s", - filename, - NULL - }; - assert(execve(args[0], (char**)args, environ) != -1); - // NOT REACHED - } - close(fds[1]); - - char* checksum = calculate_digest(fds[0]); - - close(fds[0]); - waitpid(pid, &status, 0); - if (status != 0) { - checksum = strdup("ERROR"); - } - - return checksum; -} - // If the path points to a Mach-O file, records all dylib // link commands as library dependencies in the database. // XXX @@ -649,11 +593,7 @@ int register_files(char* build, char* project, char* path) { int isMachO; res = register_libraries(fd, build, project, filename, &isMachO); lseek(fd, (off_t)0, SEEK_SET); - if (isMachO && have_undo_prebinding() == 0) { - checksum = calculate_unprebound_digest(ent->fts_accpath); - } else { - checksum = calculate_digest(fd); - } + checksum = calculate_digest(fd); close(fd); } diff --git a/darwinxref/vendor-tcl.sh b/darwinxref/vendor-tcl.sh new file mode 100755 index 0000000..d063a42 --- /dev/null +++ b/darwinxref/vendor-tcl.sh @@ -0,0 +1,5 @@ +#!/bin/zsh -e + +cp /usr/local/opt/tcl-tk/lib/libtcl8.6.dylib $SRCROOT/darwinxref +chmod 644 $SRCROOT/darwinxref/libtcl8.6.dylib +install_name_tool -id '@rpath/libtcl8.6.dylib' $SRCROOT/darwinxref/libtcl8.6.dylib diff --git a/installer/build.sh b/installer/build.sh new file mode 100755 index 0000000..ab74d8e --- /dev/null +++ b/installer/build.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +set -e + +MY_DIR=$(cd `dirname $0` && pwd) +cd $MY_DIR + +xcodebuild install \ + -project $MY_DIR/../darwinbuild.xcodeproj \ + -scheme world -configuration Release \ + DSTROOT=$MY_DIR/payload + +pkgbuild \ + --ownership recommended \ + --identifier org.puredarwin.darwinbuild.component \ + --version 2.0 \ + --root $MY_DIR/payload \ + --install-location / \ + $MY_DIR/darwinbuild-component.pkg + +productbuild \ + --distribution $MY_DIR/distribution.xml \ + --identifier org.puredarwin.darwinbuild.release \ + --version 2.0 \ + --sign 'Developer ID Installer' --timestamp \ + --package-path $MY_DIR \ + --resources $MY_DIR \ + $MY_DIR/darwinbuild-installer.pkg + +echo "Complete! Your installer is located at: $MY_DIR/darwinbuild-installer.pkg" diff --git a/installer/conclusion.html b/installer/conclusion.html new file mode 100644 index 0000000..eb574c5 --- /dev/null +++ b/installer/conclusion.html @@ -0,0 +1,26 @@ + + + + PureDarwin Build System Installer + + + + +

+ You can find the darwinbuild tool at:
+ /usr/local/bin/darwinbuild +

+ +

+ http://puredarwin.org/ +

+ + diff --git a/installer/distribution.xml b/installer/distribution.xml new file mode 100644 index 0000000..59516a1 --- /dev/null +++ b/installer/distribution.xml @@ -0,0 +1,17 @@ + + + + + + + + + + darwinbuild-component.pkg + + PureDarwin Build System + + + + + diff --git a/installer/license.html b/installer/license.html new file mode 100644 index 0000000..fe24c57 --- /dev/null +++ b/installer/license.html @@ -0,0 +1,54 @@ + + + + + + + + +

+Copyright © 2004-2012 Apple Inc. All rights reserved.
+Portions of the file DBTclPlugin.c are copyright © 2003 Kevin Van Vechten <kevin@opendarwin.org>
+Portions of the file dot.c are copyright © 2008 Michael Franz <mvfranz@gmail.com> +

+

+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. +
  3. + 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. +
  4. +
  5. + Neither the name of Apple 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. +
  6. +
+

+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. +

+ + + diff --git a/installer/notarize.sh b/installer/notarize.sh new file mode 100755 index 0000000..8d410ef --- /dev/null +++ b/installer/notarize.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +MY_DIR=$(cd `dirname $0` && pwd) +cd $MY_DIR + +if [ ! -f $MY_DIR/darwinbuild-installer.pkg ]; then + echo "darwinbuild-installer.pkg not present, please run build.sh to create it" 1>&2 + exit 1 +fi + +ALTOOL_LOG=$(mktemp -q -t altool.log) +if [ $? -ne 0 ]; then + echo "Could not create temporary file for altool log" 1>&2 + exit 1 +fi + +xcrun altool --notarize-app --primary-bundle-id org.puredarwin.darwinbuild.release \ + --username "wjk011@gmail.com" --password "@keychain:ADC Notarization" \ + --file $MY_DIR/darwinbuild-installer.pkg \ + --output-format xml > $ALTOOL_LOG +if [ $? -ne 0 ]; then + echo "altool failed to upload, cannot continue" 1>&2 + echo "altool log file is located at: $ALTOOL_LOG" 1>&2 + exit 1 +fi + +request_id=$(/usr/libexec/PlistBuddy -c "print :notarization-upload:RequestUUID" $ALTOOL_LOG) +if [[ $request_id =~ ^\{?[A-F0-9a-f]{8}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{12}\}?$ ]]; then + + while :; do + echo "Sleeping 20 seconds before checking notarization status..." + sleep 20 + + xcrun altool --notarization-info $request_id \ + --username "wjk011@gmail.com" --password "@keychain:ADC Notarization" \ + --output-format xml > $ALTOOL_LOG + + notarization_status=$(/usr/libexec/PlistBuddy -c "print :notarization-info:Status" $ALTOOL_LOG) + + if [ ! -z "$notarization_status" ]; then + [ "$notarization_status" != "in progress" ] && break + fi + done + + log_url=$(/usr/libexec/PlistBuddy -c "print :notarization-info:LogFileURL" $ALTOOL_LOG) + echo "Log file can be downloaded from: $log_url" + + if [ "$notarization_status" != "success" ]; then + echo "altool reported notarization error" 1>&2 + exit 1 + fi + + xcrun stapler staple $MY_DIR/darwinbuild-installer.pkg + xcrun stapler validate -v $MY_DIR/darwinbuild-installer.pkg + if [ $? -ne 0 ]; then + echo "validation of installer notarization failed" 1>&2 + exit 1 + fi +else + echo "Invalid request ID found in altool output, cannot continue." 1>&2 + exit 1 +fi diff --git a/installer/welcome.html b/installer/welcome.html new file mode 100644 index 0000000..07bab02 --- /dev/null +++ b/installer/welcome.html @@ -0,0 +1,24 @@ + + + + PureDarwin Build System Installer + + + + +

+ This package installs darwinbuild, the build system used by + the PureDarwin project. You can learn more about darwinbuild at our GitHub + repository, + https://github.com/PureDarwin/darwinbuild. +

+ + diff --git a/patches/dtrace-209.50.12.host-install.p1.patch b/patches/dtrace-209.50.12.host-install.p1.patch new file mode 100644 index 0000000..245c77a --- /dev/null +++ b/patches/dtrace-209.50.12.host-install.p1.patch @@ -0,0 +1,58 @@ +diff --git a/dtrace.xcodeproj/project.pbxproj b/dtrace.xcodeproj/project.pbxproj +index c97d7b6..1900353 100644 +--- a/dtrace.xcodeproj/project.pbxproj ++++ b/dtrace.xcodeproj/project.pbxproj +@@ -5792,7 +5792,7 @@ + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; +- INSTALL_PATH = "$(DT_TOOLCHAIN_DIR)/usr/local/bin"; ++ INSTALL_PATH = /usr/local/bin; + OTHER_CFLAGS = ( + "-D_INT64_TYPE", + "-D_LONGLONG_TYPE", +@@ -5822,7 +5822,7 @@ + ); + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; +- INSTALL_PATH = "$(DT_TOOLCHAIN_DIR)/usr/local/bin"; ++ INSTALL_PATH = /usr/local/bin; + OTHER_CFLAGS = ( + "-D_INT64_TYPE", + "-D_LONGLONG_TYPE", +@@ -5854,7 +5854,7 @@ + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; +- INSTALL_PATH = "$(DT_TOOLCHAIN_DIR)/usr/local/bin"; ++ INSTALL_PATH = /usr/local/bin; + OTHER_CFLAGS = ( + "-D_INT64_TYPE", + "-D_LONGLONG_TYPE", +@@ -5883,7 +5883,7 @@ + ); + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; +- INSTALL_PATH = "$(DT_TOOLCHAIN_DIR)/usr/local/bin"; ++ INSTALL_PATH = /usr/local/bin; + OTHER_CFLAGS = ( + "-D_INT64_TYPE", + "-D_LONGLONG_TYPE", +@@ -5949,7 +5949,7 @@ + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; +- INSTALL_PATH = "$(DT_TOOLCHAIN_DIR)/usr/local/bin"; ++ INSTALL_PATH = /usr/local/bin; + OTHER_CFLAGS = ( + "-D_INT64_TYPE", + "-D_LONGLONG_TYPE", +@@ -5979,7 +5979,7 @@ + ); + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; +- INSTALL_PATH = "$(DT_TOOLCHAIN_DIR)/usr/local/bin"; ++ INSTALL_PATH = /usr/local/bin; + OTHER_CFLAGS = ( + "-D_INT64_TYPE", + "-D_LONGLONG_TYPE", diff --git a/patches/libdispatch-703.50.37.libfirehose-install.p1.patch b/patches/libdispatch-703.50.37.libfirehose-install.p1.patch new file mode 100644 index 0000000..f20e1e6 --- /dev/null +++ b/patches/libdispatch-703.50.37.libfirehose-install.p1.patch @@ -0,0 +1,24 @@ +diff --git a/libdispatch.xcodeproj/project.pbxproj b/libdispatch.xcodeproj/project.pbxproj +index 5fa010b..ef132a5 100644 +--- a/libdispatch.xcodeproj/project.pbxproj ++++ b/libdispatch.xcodeproj/project.pbxproj +@@ -2253,6 +2253,9 @@ + isa = XCBuildConfiguration; + baseConfigurationReference = 6E040C721C499C3600411A2E /* libfirehose_kernel.xcconfig */; + buildSettings = { ++ INSTALL_PATH = "/usr/local/lib/kernel/"; ++ PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include/kernel/os"; ++ PUBLIC_HEADERS_FOLDER_PATH = "/usr/include/os"; + }; + name = Release; + }; +@@ -2260,6 +2263,9 @@ + isa = XCBuildConfiguration; + baseConfigurationReference = 6E040C721C499C3600411A2E /* libfirehose_kernel.xcconfig */; + buildSettings = { ++ INSTALL_PATH = "/usr/local/lib/kernel/"; ++ PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include/kernel/os"; ++ PUBLIC_HEADERS_FOLDER_PATH = "/usr/include/os"; + }; + name = Debug; + }; diff --git a/patches/libdispatch-703.50.37.libfirehose.p1.patch b/patches/libdispatch-703.50.37.libfirehose.p1.patch new file mode 100644 index 0000000..a1663a6 --- /dev/null +++ b/patches/libdispatch-703.50.37.libfirehose.p1.patch @@ -0,0 +1,13 @@ +diff --git a/xcodeconfig/libfirehose_kernel.xcconfig b/xcodeconfig/libfirehose_kernel.xcconfig +index f6b2a99..ab26649 100644 +--- a/xcodeconfig/libfirehose_kernel.xcconfig ++++ b/xcodeconfig/libfirehose_kernel.xcconfig +@@ -27,7 +27,7 @@ INSTALL_PATH = /usr/local/lib/kernel/ + PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/kernel/os + SUPPORTED_PLATFORMS = macosx iphoneos appletvos watchos + +-HEADER_SEARCH_PATHS = $(PROJECT_DIR) $(SDKROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders $(SDKROOT)/System/Library/Frameworks/Kernel.framework/Headers $(SDKROOT)/usr/local/include/os $(SDKROOT)/usr/local/include/firehose ++HEADER_SEARCH_PATHS = $(PROJECT_DIR) $(RC_BuildRoot)/System/Library/Frameworks/Kernel.framework/PrivateHeaders $(SDKROOT)/System/Library/Frameworks/Kernel.framework/Headers $(RC_BuildRoot)/usr/local/include/os $(RC_BuildRoot)/usr/local/include/firehose + + GCC_PREPROCESSOR_DEFINITIONS = $(inherited) KERNEL=1 DISPATCH_USE_DTRACE=0 + diff --git a/patches/libplatform-126.50.8.xcode.p1.patch b/patches/libplatform-126.50.8.xcode.p1.patch new file mode 100644 index 0000000..d1c2221 --- /dev/null +++ b/patches/libplatform-126.50.8.xcode.p1.patch @@ -0,0 +1,964 @@ +diff --git a/libplatform.xcodeproj/project.pbxproj b/libplatform.xcodeproj/project.pbxproj +new file mode 100644 +index 0000000..7f64f67 +--- /dev/null ++++ b/libplatform.xcodeproj/project.pbxproj +@@ -0,0 +1,945 @@ ++// !$*UTF8*$! ++{ ++ archiveVersion = 1; ++ classes = { ++ }; ++ objectVersion = 46; ++ objects = { ++ ++/* Begin PBXBuildFile section */ ++ 1F2E2B8C1ED4FFB300518432 /* atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2AD61ED4F81200518432 /* atomic.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++ 1F2E2B8D1ED4FFB300518432 /* crashlog.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2AD71ED4F81200518432 /* crashlog.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++ 1F2E2B8E1ED4FFB300518432 /* internal_shared.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2AD81ED4F81200518432 /* internal_shared.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++ 1F2E2B911ED4FFBF00518432 /* alloc_once_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2AD21ED4F81200518432 /* alloc_once_impl.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++ 1F2E2B921ED4FFBF00518432 /* base.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2AD31ED4F81200518432 /* base.h */; settings = {ATTRIBUTES = (Public, ); }; }; ++ 1F2E2B931ED4FFBF00518432 /* base_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2AD41ED4F81200518432 /* base_private.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++ 1F2E2B941ED4FFBF00518432 /* lock.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2AD91ED4F81200518432 /* lock.h */; settings = {ATTRIBUTES = (Public, ); }; }; ++ 1F2E2B951ED4FFBF00518432 /* lock_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2ADA1ED4F81200518432 /* lock_private.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++ 1F2E2B961ED4FFBF00518432 /* once_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2ADB1ED4F81200518432 /* once_private.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++ 1F2E2B971ED4FFBF00518432 /* semaphore_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2E2ADC1ED4F81200518432 /* semaphore_private.h */; settings = {ATTRIBUTES = (Private, ); }; }; ++/* End PBXBuildFile section */ ++ ++/* Begin PBXContainerItemProxy section */ ++ 1F2E2B8F1ED4FFB900518432 /* PBXContainerItemProxy */ = { ++ isa = PBXContainerItemProxy; ++ containerPortal = 1F2E2AC31ED4F80200518432 /* Project object */; ++ proxyType = 1; ++ remoteGlobalIDString = 1F2E2B871ED4FFA300518432; ++ remoteInfo = "os_internal headers"; ++ }; ++/* End PBXContainerItemProxy section */ ++ ++/* Begin PBXFileReference section */ ++ 1F2E2ACA1ED4F81200518432 /* _simple.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _simple.h; sourceTree = ""; }; ++ 1F2E2ACC1ED4F81200518432 /* OSAtomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomic.h; sourceTree = ""; }; ++ 1F2E2ACD1ED4F81200518432 /* OSAtomicDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomicDeprecated.h; sourceTree = ""; }; ++ 1F2E2ACE1ED4F81200518432 /* OSAtomicQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomicQueue.h; sourceTree = ""; }; ++ 1F2E2ACF1ED4F81200518432 /* OSCacheControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSCacheControl.h; sourceTree = ""; }; ++ 1F2E2AD01ED4F81200518432 /* OSSpinLockDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSSpinLockDeprecated.h; sourceTree = ""; }; ++ 1F2E2AD21ED4F81200518432 /* alloc_once_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = alloc_once_impl.h; sourceTree = ""; }; ++ 1F2E2AD31ED4F81200518432 /* base.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = base.h; sourceTree = ""; }; ++ 1F2E2AD41ED4F81200518432 /* base_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = base_private.h; sourceTree = ""; }; ++ 1F2E2AD61ED4F81200518432 /* atomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atomic.h; sourceTree = ""; }; ++ 1F2E2AD71ED4F81200518432 /* crashlog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = crashlog.h; sourceTree = ""; }; ++ 1F2E2AD81ED4F81200518432 /* internal_shared.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = internal_shared.h; sourceTree = ""; }; ++ 1F2E2AD91ED4F81200518432 /* lock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lock.h; sourceTree = ""; }; ++ 1F2E2ADA1ED4F81200518432 /* lock_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lock_private.h; sourceTree = ""; }; ++ 1F2E2ADB1ED4F81200518432 /* once_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = once_private.h; sourceTree = ""; }; ++ 1F2E2ADC1ED4F81200518432 /* semaphore_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = semaphore_private.h; sourceTree = ""; }; ++ 1F2E2ADE1ED4F81200518432 /* compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = ""; }; ++ 1F2E2ADF1ED4F81200518432 /* introspection_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = introspection_private.h; sourceTree = ""; }; ++ 1F2E2AE01ED4F81200518432 /* string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string.h; sourceTree = ""; }; ++ 1F2E2AE11ED4F81200518432 /* setjmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = setjmp.h; sourceTree = ""; }; ++ 1F2E2AE21ED4F81200518432 /* ucontext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ucontext.h; sourceTree = ""; }; ++ 1F2E2AE51ED4F81200518432 /* internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = ""; }; ++ 1F2E2AE61ED4F81200518432 /* internal_asm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = internal_asm.h; sourceTree = ""; }; ++ 1F2E2AE71ED4F81200518432 /* yield.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = yield.h; sourceTree = ""; }; ++ 1F2E2AE91ED4F81200518432 /* atomic.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atomic.3; sourceTree = ""; }; ++ 1F2E2AEA1ED4F81200518432 /* atomic_deprecated.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atomic_deprecated.3; sourceTree = ""; }; ++ 1F2E2AEB1ED4F81200518432 /* cache.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = cache.3; sourceTree = ""; }; ++ 1F2E2AEC1ED4F81200518432 /* ffs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ffs.3; sourceTree = ""; }; ++ 1F2E2AED1ED4F81200518432 /* getcontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getcontext.3; sourceTree = ""; }; ++ 1F2E2AEE1ED4F81200518432 /* makecontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = makecontext.3; sourceTree = ""; }; ++ 1F2E2AEF1ED4F81200518432 /* manpages.lst */ = {isa = PBXFileReference; lastKnownFileType = text; path = manpages.lst; sourceTree = ""; }; ++ 1F2E2AF01ED4F81200518432 /* setjmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setjmp.3; sourceTree = ""; }; ++ 1F2E2AF11ED4F81200518432 /* spinlock_deprecated.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = spinlock_deprecated.3; sourceTree = ""; }; ++ 1F2E2AF21ED4F81200518432 /* ucontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ucontext.3; sourceTree = ""; }; ++ 1F2E2AF51ED4F81200518432 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; ++ 1F2E2AF61ED4F81200518432 /* OSAtomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomic.h; sourceTree = ""; }; ++ 1F2E2AFA1ED4F81200518432 /* MKGetTimeBaseInfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = MKGetTimeBaseInfo.c; sourceTree = ""; }; ++ 1F2E2AFC1ED4F81200518432 /* OSAtomic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = OSAtomic.s; sourceTree = ""; }; ++ 1F2E2AFD1ED4F81200518432 /* pfz.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pfz.s; sourceTree = ""; }; ++ 1F2E2AFE1ED4F81200518432 /* init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init.c; sourceTree = ""; }; ++ 1F2E2B001ED4F81200518432 /* OSAtomic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = OSAtomic.s; sourceTree = ""; }; ++ 1F2E2B011ED4F81200518432 /* pfz.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pfz.s; sourceTree = ""; }; ++ 1F2E2B041ED4F81200518432 /* cache.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cache.s; sourceTree = ""; }; ++ 1F2E2B061ED4F81200518432 /* cache.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cache.s; sourceTree = ""; }; ++ 1F2E2B081ED4F81200518432 /* cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; ++ 1F2E2B0A1ED4F81200518432 /* cache.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cache.s; sourceTree = ""; }; ++ 1F2E2B0C1ED4F81200518432 /* cache.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cache.s; sourceTree = ""; }; ++ 1F2E2B0D1ED4F81200518432 /* force_libplatform_to_build.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = force_libplatform_to_build.c; sourceTree = ""; }; ++ 1F2E2B0E1ED4F81200518432 /* init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init.c; sourceTree = ""; }; ++ 1F2E2B101ED4F81200518432 /* introspection.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = introspection.c; sourceTree = ""; }; ++ 1F2E2B111ED4F81200518432 /* introspection_internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = introspection_internal.h; sourceTree = ""; }; ++ 1F2E2B131ED4F81200518432 /* alloc_once.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = alloc_once.c; sourceTree = ""; }; ++ 1F2E2B141ED4F81200518432 /* atomic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atomic.c; sourceTree = ""; }; ++ 1F2E2B151ED4F81200518432 /* atomic_up.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atomic_up.c; sourceTree = ""; }; ++ 1F2E2B161ED4F81200518432 /* lock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lock.c; sourceTree = ""; }; ++ 1F2E2B171ED4F81200518432 /* lock_internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lock_internal.h; sourceTree = ""; }; ++ 1F2E2B181ED4F81200518432 /* lock_up.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lock_up.c; sourceTree = ""; }; ++ 1F2E2B191ED4F81200518432 /* lock_wfe.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lock_wfe.c; sourceTree = ""; }; ++ 1F2E2B1A1ED4F81200518432 /* resolver.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = resolver.c; sourceTree = ""; }; ++ 1F2E2B1B1ED4F81200518432 /* resolver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resolver.h; sourceTree = ""; }; ++ 1F2E2B1C1ED4F81200518432 /* semaphore.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = semaphore.c; sourceTree = ""; }; ++ 1F2E2B1F1ED4F81200518432 /* _longjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _longjmp.s; sourceTree = ""; }; ++ 1F2E2B201ED4F81200518432 /* _setjmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _setjmp.h; sourceTree = ""; }; ++ 1F2E2B211ED4F81200518432 /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = ""; }; ++ 1F2E2B221ED4F81200518432 /* longjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = longjmp.s; sourceTree = ""; }; ++ 1F2E2B231ED4F81200518432 /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; ++ 1F2E2B251ED4F81200518432 /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; ++ 1F2E2B271ED4F81200518432 /* setjmperr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setjmperr.c; sourceTree = ""; }; ++ 1F2E2B281ED4F81200518432 /* sigtramp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigtramp.c; sourceTree = ""; }; ++ 1F2E2B2A1ED4F81200518432 /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = ""; }; ++ 1F2E2B2B1ED4F81200518432 /* _sigtramp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _sigtramp.s; sourceTree = ""; }; ++ 1F2E2B2C1ED4F81200518432 /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; ++ 1F2E2B2E1ED4F81200518432 /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = ""; }; ++ 1F2E2B2F1ED4F81200518432 /* _sigtramp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _sigtramp.s; sourceTree = ""; }; ++ 1F2E2B301ED4F81200518432 /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; ++ 1F2E2B321ED4F81200518432 /* asl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl.c; sourceTree = ""; }; ++ 1F2E2B331ED4F81200518432 /* getenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getenv.c; sourceTree = ""; }; ++ 1F2E2B341ED4F81200518432 /* string_io.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = string_io.c; sourceTree = ""; }; ++ 1F2E2B371ED4F81200518432 /* bzero.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bzero.c; sourceTree = ""; }; ++ 1F2E2B381ED4F81200518432 /* ffsll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ffsll.c; sourceTree = ""; }; ++ 1F2E2B391ED4F81200518432 /* flsll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = flsll.c; sourceTree = ""; }; ++ 1F2E2B3A1ED4F81200518432 /* memccpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memccpy.c; sourceTree = ""; }; ++ 1F2E2B3B1ED4F81200518432 /* memchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memchr.c; sourceTree = ""; }; ++ 1F2E2B3C1ED4F81200518432 /* memcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcmp.c; sourceTree = ""; }; ++ 1F2E2B3D1ED4F81200518432 /* memmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove.c; sourceTree = ""; }; ++ 1F2E2B3E1ED4F81200518432 /* memset_pattern.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memset_pattern.c; sourceTree = ""; }; ++ 1F2E2B3F1ED4F81200518432 /* strchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strchr.c; sourceTree = ""; }; ++ 1F2E2B401ED4F81200518432 /* strcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcmp.c; sourceTree = ""; }; ++ 1F2E2B411ED4F81200518432 /* strncmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strncmp.c; sourceTree = ""; }; ++ 1F2E2B441ED4F81200518432 /* getmcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getmcontext.c; sourceTree = ""; }; ++ 1F2E2B451ED4F81200518432 /* makecontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makecontext.c; sourceTree = ""; }; ++ 1F2E2B461ED4F81200518432 /* setcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setcontext.c; sourceTree = ""; }; ++ 1F2E2B471ED4F81200518432 /* swapcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swapcontext.c; sourceTree = ""; }; ++ 1F2E2B491ED4F81200518432 /* _ctx_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _ctx_start.s; sourceTree = ""; }; ++ 1F2E2B4A1ED4F81200518432 /* _setcontext.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setcontext.s; sourceTree = ""; }; ++ 1F2E2B4B1ED4F81200518432 /* getcontext.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = getcontext.s; sourceTree = ""; }; ++ 1F2E2B4D1ED4F81200518432 /* _ctx_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _ctx_start.s; sourceTree = ""; }; ++ 1F2E2B4E1ED4F81200518432 /* _setcontext.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setcontext.s; sourceTree = ""; }; ++ 1F2E2B4F1ED4F81200518432 /* getcontext.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = getcontext.s; sourceTree = ""; }; ++ 1F2E2B511ED4F81200518432 /* atomics.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = atomics.xcconfig; sourceTree = ""; }; ++ 1F2E2B521ED4F81200518432 /* libplatform.aliases */ = {isa = PBXFileReference; lastKnownFileType = text; path = libplatform.aliases; sourceTree = ""; }; ++ 1F2E2B531ED4F81200518432 /* libplatform.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = libplatform.xcconfig; sourceTree = ""; }; ++ 1F2E2B541ED4F81200518432 /* os.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = os.xcconfig; sourceTree = ""; }; ++ 1F2E2B551ED4F81200518432 /* perarch.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = perarch.xcconfig; sourceTree = ""; }; ++ 1F2E2B561ED4F81200518432 /* static.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = static.xcconfig; sourceTree = ""; }; ++ 1F2E2B801ED4FF8300518432 /* libos headers.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libos headers.a"; sourceTree = BUILT_PRODUCTS_DIR; }; ++ 1F2E2B881ED4FFA300518432 /* libos_internal headers.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libos_internal headers.a"; sourceTree = BUILT_PRODUCTS_DIR; }; ++/* End PBXFileReference section */ ++ ++/* Begin PBXFrameworksBuildPhase section */ ++ 1F2E2B7D1ED4FF8300518432 /* Frameworks */ = { ++ isa = PBXFrameworksBuildPhase; ++ buildActionMask = 2147483647; ++ files = ( ++ ); ++ runOnlyForDeploymentPostprocessing = 0; ++ }; ++ 1F2E2B851ED4FFA300518432 /* Frameworks */ = { ++ isa = PBXFrameworksBuildPhase; ++ buildActionMask = 2147483647; ++ files = ( ++ ); ++ runOnlyForDeploymentPostprocessing = 0; ++ }; ++/* End PBXFrameworksBuildPhase section */ ++ ++/* Begin PBXGroup section */ ++ 1F2E2AC21ED4F80200518432 = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AC91ED4F81200518432 /* include */, ++ 1F2E2AE31ED4F81200518432 /* internal */, ++ 1F2E2AE81ED4F81200518432 /* man */, ++ 1F2E2AF31ED4F81200518432 /* private */, ++ 1F2E2AF71ED4F81200518432 /* src */, ++ 1F2E2B501ED4F81200518432 /* xcodeconfig */, ++ 1F2E2B5C1ED4F8EA00518432 /* Products */, ++ ); ++ sourceTree = ""; ++ }; ++ 1F2E2AC91ED4F81200518432 /* include */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2ACA1ED4F81200518432 /* _simple.h */, ++ 1F2E2ACB1ED4F81200518432 /* libkern */, ++ 1F2E2AD11ED4F81200518432 /* os */, ++ 1F2E2ADD1ED4F81200518432 /* platform */, ++ 1F2E2AE11ED4F81200518432 /* setjmp.h */, ++ 1F2E2AE21ED4F81200518432 /* ucontext.h */, ++ ); ++ path = include; ++ sourceTree = ""; ++ }; ++ 1F2E2ACB1ED4F81200518432 /* libkern */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2ACC1ED4F81200518432 /* OSAtomic.h */, ++ 1F2E2ACD1ED4F81200518432 /* OSAtomicDeprecated.h */, ++ 1F2E2ACE1ED4F81200518432 /* OSAtomicQueue.h */, ++ 1F2E2ACF1ED4F81200518432 /* OSCacheControl.h */, ++ 1F2E2AD01ED4F81200518432 /* OSSpinLockDeprecated.h */, ++ ); ++ path = libkern; ++ sourceTree = ""; ++ }; ++ 1F2E2AD11ED4F81200518432 /* os */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AD21ED4F81200518432 /* alloc_once_impl.h */, ++ 1F2E2AD31ED4F81200518432 /* base.h */, ++ 1F2E2AD41ED4F81200518432 /* base_private.h */, ++ 1F2E2AD51ED4F81200518432 /* internal */, ++ 1F2E2AD91ED4F81200518432 /* lock.h */, ++ 1F2E2ADA1ED4F81200518432 /* lock_private.h */, ++ 1F2E2ADB1ED4F81200518432 /* once_private.h */, ++ 1F2E2ADC1ED4F81200518432 /* semaphore_private.h */, ++ ); ++ path = os; ++ sourceTree = ""; ++ }; ++ 1F2E2AD51ED4F81200518432 /* internal */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AD61ED4F81200518432 /* atomic.h */, ++ 1F2E2AD71ED4F81200518432 /* crashlog.h */, ++ 1F2E2AD81ED4F81200518432 /* internal_shared.h */, ++ ); ++ path = internal; ++ sourceTree = ""; ++ }; ++ 1F2E2ADD1ED4F81200518432 /* platform */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2ADE1ED4F81200518432 /* compat.h */, ++ 1F2E2ADF1ED4F81200518432 /* introspection_private.h */, ++ 1F2E2AE01ED4F81200518432 /* string.h */, ++ ); ++ path = platform; ++ sourceTree = ""; ++ }; ++ 1F2E2AE31ED4F81200518432 /* internal */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AE41ED4F81200518432 /* os */, ++ ); ++ path = internal; ++ sourceTree = ""; ++ }; ++ 1F2E2AE41ED4F81200518432 /* os */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AE51ED4F81200518432 /* internal.h */, ++ 1F2E2AE61ED4F81200518432 /* internal_asm.h */, ++ 1F2E2AE71ED4F81200518432 /* yield.h */, ++ ); ++ path = os; ++ sourceTree = ""; ++ }; ++ 1F2E2AE81ED4F81200518432 /* man */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AE91ED4F81200518432 /* atomic.3 */, ++ 1F2E2AEA1ED4F81200518432 /* atomic_deprecated.3 */, ++ 1F2E2AEB1ED4F81200518432 /* cache.3 */, ++ 1F2E2AEC1ED4F81200518432 /* ffs.3 */, ++ 1F2E2AED1ED4F81200518432 /* getcontext.3 */, ++ 1F2E2AEE1ED4F81200518432 /* makecontext.3 */, ++ 1F2E2AEF1ED4F81200518432 /* manpages.lst */, ++ 1F2E2AF01ED4F81200518432 /* setjmp.3 */, ++ 1F2E2AF11ED4F81200518432 /* spinlock_deprecated.3 */, ++ 1F2E2AF21ED4F81200518432 /* ucontext.3 */, ++ ); ++ path = man; ++ sourceTree = ""; ++ }; ++ 1F2E2AF31ED4F81200518432 /* private */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AF41ED4F81200518432 /* libkern */, ++ ); ++ path = private; ++ sourceTree = ""; ++ }; ++ 1F2E2AF41ED4F81200518432 /* libkern */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AF51ED4F81200518432 /* module.modulemap */, ++ 1F2E2AF61ED4F81200518432 /* OSAtomic.h */, ++ ); ++ path = libkern; ++ sourceTree = ""; ++ }; ++ 1F2E2AF71ED4F81200518432 /* src */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B0D1ED4F81200518432 /* force_libplatform_to_build.c */, ++ 1F2E2B0E1ED4F81200518432 /* init.c */, ++ 1F2E2AF81ED4F81200518432 /* atomics */, ++ 1F2E2B021ED4F81200518432 /* cachecontrol */, ++ 1F2E2B0F1ED4F81200518432 /* introspection */, ++ 1F2E2B121ED4F81200518432 /* os */, ++ 1F2E2B1D1ED4F81200518432 /* setjmp */, ++ 1F2E2B311ED4F81200518432 /* simple */, ++ 1F2E2B351ED4F81200518432 /* string */, ++ 1F2E2B421ED4F81200518432 /* ucontext */, ++ ); ++ path = src; ++ sourceTree = ""; ++ }; ++ 1F2E2AF81ED4F81200518432 /* atomics */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AF91ED4F81200518432 /* common */, ++ 1F2E2AFB1ED4F81200518432 /* i386 */, ++ 1F2E2AFE1ED4F81200518432 /* init.c */, ++ 1F2E2AFF1ED4F81200518432 /* x86_64 */, ++ ); ++ path = atomics; ++ sourceTree = ""; ++ }; ++ 1F2E2AF91ED4F81200518432 /* common */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AFA1ED4F81200518432 /* MKGetTimeBaseInfo.c */, ++ ); ++ path = common; ++ sourceTree = ""; ++ }; ++ 1F2E2AFB1ED4F81200518432 /* i386 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2AFC1ED4F81200518432 /* OSAtomic.s */, ++ 1F2E2AFD1ED4F81200518432 /* pfz.s */, ++ ); ++ path = i386; ++ sourceTree = ""; ++ }; ++ 1F2E2AFF1ED4F81200518432 /* x86_64 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B001ED4F81200518432 /* OSAtomic.s */, ++ 1F2E2B011ED4F81200518432 /* pfz.s */, ++ ); ++ path = x86_64; ++ sourceTree = ""; ++ }; ++ 1F2E2B021ED4F81200518432 /* cachecontrol */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B031ED4F81200518432 /* arm */, ++ 1F2E2B051ED4F81200518432 /* arm64 */, ++ 1F2E2B071ED4F81200518432 /* generic */, ++ 1F2E2B091ED4F81200518432 /* i386 */, ++ 1F2E2B0B1ED4F81200518432 /* x86_64 */, ++ ); ++ path = cachecontrol; ++ sourceTree = ""; ++ }; ++ 1F2E2B031ED4F81200518432 /* arm */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B041ED4F81200518432 /* cache.s */, ++ ); ++ path = arm; ++ sourceTree = ""; ++ }; ++ 1F2E2B051ED4F81200518432 /* arm64 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B061ED4F81200518432 /* cache.s */, ++ ); ++ path = arm64; ++ sourceTree = ""; ++ }; ++ 1F2E2B071ED4F81200518432 /* generic */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B081ED4F81200518432 /* cache.c */, ++ ); ++ path = generic; ++ sourceTree = ""; ++ }; ++ 1F2E2B091ED4F81200518432 /* i386 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B0A1ED4F81200518432 /* cache.s */, ++ ); ++ path = i386; ++ sourceTree = ""; ++ }; ++ 1F2E2B0B1ED4F81200518432 /* x86_64 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B0C1ED4F81200518432 /* cache.s */, ++ ); ++ path = x86_64; ++ sourceTree = ""; ++ }; ++ 1F2E2B0F1ED4F81200518432 /* introspection */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B101ED4F81200518432 /* introspection.c */, ++ 1F2E2B111ED4F81200518432 /* introspection_internal.h */, ++ ); ++ path = introspection; ++ sourceTree = ""; ++ }; ++ 1F2E2B121ED4F81200518432 /* os */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B131ED4F81200518432 /* alloc_once.c */, ++ 1F2E2B141ED4F81200518432 /* atomic.c */, ++ 1F2E2B151ED4F81200518432 /* atomic_up.c */, ++ 1F2E2B161ED4F81200518432 /* lock.c */, ++ 1F2E2B171ED4F81200518432 /* lock_internal.h */, ++ 1F2E2B181ED4F81200518432 /* lock_up.c */, ++ 1F2E2B191ED4F81200518432 /* lock_wfe.c */, ++ 1F2E2B1A1ED4F81200518432 /* resolver.c */, ++ 1F2E2B1B1ED4F81200518432 /* resolver.h */, ++ 1F2E2B1C1ED4F81200518432 /* semaphore.c */, ++ ); ++ path = os; ++ sourceTree = ""; ++ }; ++ 1F2E2B1D1ED4F81200518432 /* setjmp */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B1E1ED4F81200518432 /* arm */, ++ 1F2E2B241ED4F81200518432 /* arm64 */, ++ 1F2E2B261ED4F81200518432 /* generic */, ++ 1F2E2B291ED4F81200518432 /* i386 */, ++ 1F2E2B2D1ED4F81200518432 /* x86_64 */, ++ ); ++ path = setjmp; ++ sourceTree = ""; ++ }; ++ 1F2E2B1E1ED4F81200518432 /* arm */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B1F1ED4F81200518432 /* _longjmp.s */, ++ 1F2E2B201ED4F81200518432 /* _setjmp.h */, ++ 1F2E2B211ED4F81200518432 /* _setjmp.s */, ++ 1F2E2B221ED4F81200518432 /* longjmp.s */, ++ 1F2E2B231ED4F81200518432 /* setjmp.s */, ++ ); ++ path = arm; ++ sourceTree = ""; ++ }; ++ 1F2E2B241ED4F81200518432 /* arm64 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B251ED4F81200518432 /* setjmp.s */, ++ ); ++ path = arm64; ++ sourceTree = ""; ++ }; ++ 1F2E2B261ED4F81200518432 /* generic */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B271ED4F81200518432 /* setjmperr.c */, ++ 1F2E2B281ED4F81200518432 /* sigtramp.c */, ++ ); ++ path = generic; ++ sourceTree = ""; ++ }; ++ 1F2E2B291ED4F81200518432 /* i386 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B2A1ED4F81200518432 /* _setjmp.s */, ++ 1F2E2B2B1ED4F81200518432 /* _sigtramp.s */, ++ 1F2E2B2C1ED4F81200518432 /* setjmp.s */, ++ ); ++ path = i386; ++ sourceTree = ""; ++ }; ++ 1F2E2B2D1ED4F81200518432 /* x86_64 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B2E1ED4F81200518432 /* _setjmp.s */, ++ 1F2E2B2F1ED4F81200518432 /* _sigtramp.s */, ++ 1F2E2B301ED4F81200518432 /* setjmp.s */, ++ ); ++ path = x86_64; ++ sourceTree = ""; ++ }; ++ 1F2E2B311ED4F81200518432 /* simple */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B321ED4F81200518432 /* asl.c */, ++ 1F2E2B331ED4F81200518432 /* getenv.c */, ++ 1F2E2B341ED4F81200518432 /* string_io.c */, ++ ); ++ path = simple; ++ sourceTree = ""; ++ }; ++ 1F2E2B351ED4F81200518432 /* string */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B361ED4F81200518432 /* generic */, ++ ); ++ path = string; ++ sourceTree = ""; ++ }; ++ 1F2E2B361ED4F81200518432 /* generic */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B371ED4F81200518432 /* bzero.c */, ++ 1F2E2B381ED4F81200518432 /* ffsll.c */, ++ 1F2E2B391ED4F81200518432 /* flsll.c */, ++ 1F2E2B3A1ED4F81200518432 /* memccpy.c */, ++ 1F2E2B3B1ED4F81200518432 /* memchr.c */, ++ 1F2E2B3C1ED4F81200518432 /* memcmp.c */, ++ 1F2E2B3D1ED4F81200518432 /* memmove.c */, ++ 1F2E2B3E1ED4F81200518432 /* memset_pattern.c */, ++ 1F2E2B3F1ED4F81200518432 /* strchr.c */, ++ 1F2E2B401ED4F81200518432 /* strcmp.c */, ++ 1F2E2B411ED4F81200518432 /* strncmp.c */, ++ ); ++ path = generic; ++ sourceTree = ""; ++ }; ++ 1F2E2B421ED4F81200518432 /* ucontext */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B431ED4F81200518432 /* generic */, ++ 1F2E2B481ED4F81200518432 /* i386 */, ++ 1F2E2B4C1ED4F81200518432 /* x86_64 */, ++ ); ++ path = ucontext; ++ sourceTree = ""; ++ }; ++ 1F2E2B431ED4F81200518432 /* generic */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B441ED4F81200518432 /* getmcontext.c */, ++ 1F2E2B451ED4F81200518432 /* makecontext.c */, ++ 1F2E2B461ED4F81200518432 /* setcontext.c */, ++ 1F2E2B471ED4F81200518432 /* swapcontext.c */, ++ ); ++ path = generic; ++ sourceTree = ""; ++ }; ++ 1F2E2B481ED4F81200518432 /* i386 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B491ED4F81200518432 /* _ctx_start.s */, ++ 1F2E2B4A1ED4F81200518432 /* _setcontext.s */, ++ 1F2E2B4B1ED4F81200518432 /* getcontext.s */, ++ ); ++ path = i386; ++ sourceTree = ""; ++ }; ++ 1F2E2B4C1ED4F81200518432 /* x86_64 */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B4D1ED4F81200518432 /* _ctx_start.s */, ++ 1F2E2B4E1ED4F81200518432 /* _setcontext.s */, ++ 1F2E2B4F1ED4F81200518432 /* getcontext.s */, ++ ); ++ path = x86_64; ++ sourceTree = ""; ++ }; ++ 1F2E2B501ED4F81200518432 /* xcodeconfig */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B511ED4F81200518432 /* atomics.xcconfig */, ++ 1F2E2B521ED4F81200518432 /* libplatform.aliases */, ++ 1F2E2B531ED4F81200518432 /* libplatform.xcconfig */, ++ 1F2E2B541ED4F81200518432 /* os.xcconfig */, ++ 1F2E2B551ED4F81200518432 /* perarch.xcconfig */, ++ 1F2E2B561ED4F81200518432 /* static.xcconfig */, ++ ); ++ path = xcodeconfig; ++ sourceTree = ""; ++ }; ++ 1F2E2B5C1ED4F8EA00518432 /* Products */ = { ++ isa = PBXGroup; ++ children = ( ++ 1F2E2B801ED4FF8300518432 /* libos headers.a */, ++ 1F2E2B881ED4FFA300518432 /* libos_internal headers.a */, ++ ); ++ name = Products; ++ sourceTree = ""; ++ }; ++/* End PBXGroup section */ ++ ++/* Begin PBXHeadersBuildPhase section */ ++ 1F2E2B7E1ED4FF8300518432 /* Headers */ = { ++ isa = PBXHeadersBuildPhase; ++ buildActionMask = 2147483647; ++ files = ( ++ 1F2E2B921ED4FFBF00518432 /* base.h in Headers */, ++ 1F2E2B941ED4FFBF00518432 /* lock.h in Headers */, ++ 1F2E2B911ED4FFBF00518432 /* alloc_once_impl.h in Headers */, ++ 1F2E2B931ED4FFBF00518432 /* base_private.h in Headers */, ++ 1F2E2B951ED4FFBF00518432 /* lock_private.h in Headers */, ++ 1F2E2B961ED4FFBF00518432 /* once_private.h in Headers */, ++ 1F2E2B971ED4FFBF00518432 /* semaphore_private.h in Headers */, ++ ); ++ runOnlyForDeploymentPostprocessing = 0; ++ }; ++ 1F2E2B861ED4FFA300518432 /* Headers */ = { ++ isa = PBXHeadersBuildPhase; ++ buildActionMask = 2147483647; ++ files = ( ++ 1F2E2B8C1ED4FFB300518432 /* atomic.h in Headers */, ++ 1F2E2B8D1ED4FFB300518432 /* crashlog.h in Headers */, ++ 1F2E2B8E1ED4FFB300518432 /* internal_shared.h in Headers */, ++ ); ++ runOnlyForDeploymentPostprocessing = 0; ++ }; ++/* End PBXHeadersBuildPhase section */ ++ ++/* Begin PBXNativeTarget section */ ++ 1F2E2B7F1ED4FF8300518432 /* os headers */ = { ++ isa = PBXNativeTarget; ++ buildConfigurationList = 1F2E2B811ED4FF8300518432 /* Build configuration list for PBXNativeTarget "os headers" */; ++ buildPhases = ( ++ 1F2E2B7C1ED4FF8300518432 /* Sources */, ++ 1F2E2B7D1ED4FF8300518432 /* Frameworks */, ++ 1F2E2B7E1ED4FF8300518432 /* Headers */, ++ ); ++ buildRules = ( ++ ); ++ dependencies = ( ++ 1F2E2B901ED4FFB900518432 /* PBXTargetDependency */, ++ ); ++ name = "os headers"; ++ productName = "os headers"; ++ productReference = 1F2E2B801ED4FF8300518432 /* libos headers.a */; ++ productType = "com.apple.product-type.library.static"; ++ }; ++ 1F2E2B871ED4FFA300518432 /* os_internal headers */ = { ++ isa = PBXNativeTarget; ++ buildConfigurationList = 1F2E2B891ED4FFA300518432 /* Build configuration list for PBXNativeTarget "os_internal headers" */; ++ buildPhases = ( ++ 1F2E2B841ED4FFA300518432 /* Sources */, ++ 1F2E2B851ED4FFA300518432 /* Frameworks */, ++ 1F2E2B861ED4FFA300518432 /* Headers */, ++ ); ++ buildRules = ( ++ ); ++ dependencies = ( ++ ); ++ name = "os_internal headers"; ++ productName = "os_internal headers"; ++ productReference = 1F2E2B881ED4FFA300518432 /* libos_internal headers.a */; ++ productType = "com.apple.product-type.library.static"; ++ }; ++/* End PBXNativeTarget section */ ++ ++/* Begin PBXProject section */ ++ 1F2E2AC31ED4F80200518432 /* Project object */ = { ++ isa = PBXProject; ++ attributes = { ++ LastUpgradeCheck = 0830; ++ TargetAttributes = { ++ 1F2E2B7F1ED4FF8300518432 = { ++ CreatedOnToolsVersion = 8.3.2; ++ DevelopmentTeam = 3P242C9ES5; ++ ProvisioningStyle = Automatic; ++ }; ++ 1F2E2B871ED4FFA300518432 = { ++ CreatedOnToolsVersion = 8.3.2; ++ DevelopmentTeam = 3P242C9ES5; ++ ProvisioningStyle = Automatic; ++ }; ++ }; ++ }; ++ buildConfigurationList = 1F2E2AC61ED4F80200518432 /* Build configuration list for PBXProject "libplatform" */; ++ compatibilityVersion = "Xcode 3.2"; ++ developmentRegion = English; ++ hasScannedForEncodings = 0; ++ knownRegions = ( ++ en, ++ ); ++ mainGroup = 1F2E2AC21ED4F80200518432; ++ productRefGroup = 1F2E2B5C1ED4F8EA00518432 /* Products */; ++ projectDirPath = ""; ++ projectRoot = ""; ++ targets = ( ++ 1F2E2B7F1ED4FF8300518432 /* os headers */, ++ 1F2E2B871ED4FFA300518432 /* os_internal headers */, ++ ); ++ }; ++/* End PBXProject section */ ++ ++/* Begin PBXSourcesBuildPhase section */ ++ 1F2E2B7C1ED4FF8300518432 /* Sources */ = { ++ isa = PBXSourcesBuildPhase; ++ buildActionMask = 2147483647; ++ files = ( ++ ); ++ runOnlyForDeploymentPostprocessing = 0; ++ }; ++ 1F2E2B841ED4FFA300518432 /* Sources */ = { ++ isa = PBXSourcesBuildPhase; ++ buildActionMask = 2147483647; ++ files = ( ++ ); ++ runOnlyForDeploymentPostprocessing = 0; ++ }; ++/* End PBXSourcesBuildPhase section */ ++ ++/* Begin PBXTargetDependency section */ ++ 1F2E2B901ED4FFB900518432 /* PBXTargetDependency */ = { ++ isa = PBXTargetDependency; ++ target = 1F2E2B871ED4FFA300518432 /* os_internal headers */; ++ targetProxy = 1F2E2B8F1ED4FFB900518432 /* PBXContainerItemProxy */; ++ }; ++/* End PBXTargetDependency section */ ++ ++/* Begin XCBuildConfiguration section */ ++ 1F2E2AC71ED4F80200518432 /* Debug */ = { ++ isa = XCBuildConfiguration; ++ buildSettings = { ++ }; ++ name = Debug; ++ }; ++ 1F2E2AC81ED4F80200518432 /* Release */ = { ++ isa = XCBuildConfiguration; ++ buildSettings = { ++ }; ++ name = Release; ++ }; ++ 1F2E2B821ED4FF8300518432 /* Debug */ = { ++ isa = XCBuildConfiguration; ++ buildSettings = { ++ ALWAYS_SEARCH_USER_PATHS = NO; ++ CLANG_ANALYZER_NONNULL = YES; ++ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; ++ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; ++ CLANG_CXX_LIBRARY = "libc++"; ++ CLANG_ENABLE_MODULES = YES; ++ CLANG_ENABLE_OBJC_ARC = YES; ++ CLANG_WARN_BOOL_CONVERSION = YES; ++ CLANG_WARN_CONSTANT_CONVERSION = YES; ++ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; ++ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; ++ CLANG_WARN_EMPTY_BODY = YES; ++ CLANG_WARN_ENUM_CONVERSION = YES; ++ CLANG_WARN_INFINITE_RECURSION = YES; ++ CLANG_WARN_INT_CONVERSION = YES; ++ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; ++ CLANG_WARN_SUSPICIOUS_MOVE = YES; ++ CLANG_WARN_UNREACHABLE_CODE = YES; ++ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ++ CODE_SIGN_IDENTITY = "-"; ++ COPY_PHASE_STRIP = NO; ++ DEBUG_INFORMATION_FORMAT = dwarf; ++ DEVELOPMENT_TEAM = 3P242C9ES5; ++ ENABLE_STRICT_OBJC_MSGSEND = YES; ++ ENABLE_TESTABILITY = YES; ++ EXECUTABLE_PREFIX = lib; ++ GCC_C_LANGUAGE_STANDARD = gnu99; ++ GCC_DYNAMIC_NO_PIC = NO; ++ GCC_NO_COMMON_BLOCKS = YES; ++ GCC_OPTIMIZATION_LEVEL = 0; ++ GCC_PREPROCESSOR_DEFINITIONS = ( ++ "DEBUG=1", ++ "$(inherited)", ++ ); ++ GCC_WARN_64_TO_32_BIT_CONVERSION = YES; ++ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; ++ GCC_WARN_UNDECLARED_SELECTOR = YES; ++ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; ++ GCC_WARN_UNUSED_FUNCTION = YES; ++ GCC_WARN_UNUSED_VARIABLE = YES; ++ MACOSX_DEPLOYMENT_TARGET = 10.12; ++ MTL_ENABLE_DEBUG_INFO = YES; ++ ONLY_ACTIVE_ARCH = YES; ++ PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/os; ++ PRODUCT_NAME = "$(TARGET_NAME)"; ++ PUBLIC_HEADERS_FOLDER_PATH = /usr/include/os; ++ SDKROOT = macosx; ++ }; ++ name = Debug; ++ }; ++ 1F2E2B831ED4FF8300518432 /* Release */ = { ++ isa = XCBuildConfiguration; ++ buildSettings = { ++ ALWAYS_SEARCH_USER_PATHS = NO; ++ CLANG_ANALYZER_NONNULL = YES; ++ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; ++ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; ++ CLANG_CXX_LIBRARY = "libc++"; ++ CLANG_ENABLE_MODULES = YES; ++ CLANG_ENABLE_OBJC_ARC = YES; ++ CLANG_WARN_BOOL_CONVERSION = YES; ++ CLANG_WARN_CONSTANT_CONVERSION = YES; ++ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; ++ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; ++ CLANG_WARN_EMPTY_BODY = YES; ++ CLANG_WARN_ENUM_CONVERSION = YES; ++ CLANG_WARN_INFINITE_RECURSION = YES; ++ CLANG_WARN_INT_CONVERSION = YES; ++ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; ++ CLANG_WARN_SUSPICIOUS_MOVE = YES; ++ CLANG_WARN_UNREACHABLE_CODE = YES; ++ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ++ CODE_SIGN_IDENTITY = "-"; ++ COPY_PHASE_STRIP = NO; ++ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ++ DEVELOPMENT_TEAM = 3P242C9ES5; ++ ENABLE_NS_ASSERTIONS = NO; ++ ENABLE_STRICT_OBJC_MSGSEND = YES; ++ EXECUTABLE_PREFIX = lib; ++ GCC_C_LANGUAGE_STANDARD = gnu99; ++ GCC_NO_COMMON_BLOCKS = YES; ++ GCC_WARN_64_TO_32_BIT_CONVERSION = YES; ++ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; ++ GCC_WARN_UNDECLARED_SELECTOR = YES; ++ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; ++ GCC_WARN_UNUSED_FUNCTION = YES; ++ GCC_WARN_UNUSED_VARIABLE = YES; ++ MACOSX_DEPLOYMENT_TARGET = 10.12; ++ MTL_ENABLE_DEBUG_INFO = NO; ++ PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/os; ++ PRODUCT_NAME = "$(TARGET_NAME)"; ++ PUBLIC_HEADERS_FOLDER_PATH = /usr/include/os; ++ SDKROOT = macosx; ++ }; ++ name = Release; ++ }; ++ 1F2E2B8A1ED4FFA300518432 /* Debug */ = { ++ isa = XCBuildConfiguration; ++ buildSettings = { ++ ALWAYS_SEARCH_USER_PATHS = NO; ++ CLANG_ANALYZER_NONNULL = YES; ++ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; ++ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; ++ CLANG_CXX_LIBRARY = "libc++"; ++ CLANG_ENABLE_MODULES = YES; ++ CLANG_ENABLE_OBJC_ARC = YES; ++ CLANG_WARN_BOOL_CONVERSION = YES; ++ CLANG_WARN_CONSTANT_CONVERSION = YES; ++ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; ++ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; ++ CLANG_WARN_EMPTY_BODY = YES; ++ CLANG_WARN_ENUM_CONVERSION = YES; ++ CLANG_WARN_INFINITE_RECURSION = YES; ++ CLANG_WARN_INT_CONVERSION = YES; ++ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; ++ CLANG_WARN_SUSPICIOUS_MOVE = YES; ++ CLANG_WARN_UNREACHABLE_CODE = YES; ++ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ++ CODE_SIGN_IDENTITY = "-"; ++ COPY_PHASE_STRIP = NO; ++ DEBUG_INFORMATION_FORMAT = dwarf; ++ DEVELOPMENT_TEAM = 3P242C9ES5; ++ ENABLE_STRICT_OBJC_MSGSEND = YES; ++ ENABLE_TESTABILITY = YES; ++ EXECUTABLE_PREFIX = lib; ++ GCC_C_LANGUAGE_STANDARD = gnu99; ++ GCC_DYNAMIC_NO_PIC = NO; ++ GCC_NO_COMMON_BLOCKS = YES; ++ GCC_OPTIMIZATION_LEVEL = 0; ++ GCC_PREPROCESSOR_DEFINITIONS = ( ++ "DEBUG=1", ++ "$(inherited)", ++ ); ++ GCC_WARN_64_TO_32_BIT_CONVERSION = YES; ++ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; ++ GCC_WARN_UNDECLARED_SELECTOR = YES; ++ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; ++ GCC_WARN_UNUSED_FUNCTION = YES; ++ GCC_WARN_UNUSED_VARIABLE = YES; ++ MACOSX_DEPLOYMENT_TARGET = 10.12; ++ MTL_ENABLE_DEBUG_INFO = YES; ++ ONLY_ACTIVE_ARCH = YES; ++ PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/os/internal; ++ PRODUCT_NAME = "$(TARGET_NAME)"; ++ SDKROOT = macosx; ++ }; ++ name = Debug; ++ }; ++ 1F2E2B8B1ED4FFA300518432 /* Release */ = { ++ isa = XCBuildConfiguration; ++ buildSettings = { ++ ALWAYS_SEARCH_USER_PATHS = NO; ++ CLANG_ANALYZER_NONNULL = YES; ++ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; ++ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; ++ CLANG_CXX_LIBRARY = "libc++"; ++ CLANG_ENABLE_MODULES = YES; ++ CLANG_ENABLE_OBJC_ARC = YES; ++ CLANG_WARN_BOOL_CONVERSION = YES; ++ CLANG_WARN_CONSTANT_CONVERSION = YES; ++ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; ++ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; ++ CLANG_WARN_EMPTY_BODY = YES; ++ CLANG_WARN_ENUM_CONVERSION = YES; ++ CLANG_WARN_INFINITE_RECURSION = YES; ++ CLANG_WARN_INT_CONVERSION = YES; ++ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; ++ CLANG_WARN_SUSPICIOUS_MOVE = YES; ++ CLANG_WARN_UNREACHABLE_CODE = YES; ++ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ++ CODE_SIGN_IDENTITY = "-"; ++ COPY_PHASE_STRIP = NO; ++ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ++ DEVELOPMENT_TEAM = 3P242C9ES5; ++ ENABLE_NS_ASSERTIONS = NO; ++ ENABLE_STRICT_OBJC_MSGSEND = YES; ++ EXECUTABLE_PREFIX = lib; ++ GCC_C_LANGUAGE_STANDARD = gnu99; ++ GCC_NO_COMMON_BLOCKS = YES; ++ GCC_WARN_64_TO_32_BIT_CONVERSION = YES; ++ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; ++ GCC_WARN_UNDECLARED_SELECTOR = YES; ++ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; ++ GCC_WARN_UNUSED_FUNCTION = YES; ++ GCC_WARN_UNUSED_VARIABLE = YES; ++ MACOSX_DEPLOYMENT_TARGET = 10.12; ++ MTL_ENABLE_DEBUG_INFO = NO; ++ PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/os/internal; ++ PRODUCT_NAME = "$(TARGET_NAME)"; ++ SDKROOT = macosx; ++ }; ++ name = Release; ++ }; ++/* End XCBuildConfiguration section */ ++ ++/* Begin XCConfigurationList section */ ++ 1F2E2AC61ED4F80200518432 /* Build configuration list for PBXProject "libplatform" */ = { ++ isa = XCConfigurationList; ++ buildConfigurations = ( ++ 1F2E2AC71ED4F80200518432 /* Debug */, ++ 1F2E2AC81ED4F80200518432 /* Release */, ++ ); ++ defaultConfigurationIsVisible = 0; ++ defaultConfigurationName = Release; ++ }; ++ 1F2E2B811ED4FF8300518432 /* Build configuration list for PBXNativeTarget "os headers" */ = { ++ isa = XCConfigurationList; ++ buildConfigurations = ( ++ 1F2E2B821ED4FF8300518432 /* Debug */, ++ 1F2E2B831ED4FF8300518432 /* Release */, ++ ); ++ defaultConfigurationIsVisible = 0; ++ }; ++ 1F2E2B891ED4FFA300518432 /* Build configuration list for PBXNativeTarget "os_internal headers" */ = { ++ isa = XCConfigurationList; ++ buildConfigurations = ( ++ 1F2E2B8A1ED4FFA300518432 /* Debug */, ++ 1F2E2B8B1ED4FFA300518432 /* Release */, ++ ); ++ defaultConfigurationIsVisible = 0; ++ }; ++/* End XCConfigurationList section */ ++ }; ++ rootObject = 1F2E2AC31ED4F80200518432 /* Project object */; ++} +diff --git a/libplatform.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/libplatform.xcodeproj/project.xcworkspace/contents.xcworkspacedata +new file mode 100644 +index 0000000..aa6ce5d +--- /dev/null ++++ b/libplatform.xcodeproj/project.xcworkspace/contents.xcworkspacedata +@@ -0,0 +1,7 @@ ++ ++ ++ ++ ++ diff --git a/patches/xnu-3789.51.2.copyright-check.p1.patch b/patches/xnu-3789.51.2.copyright-check.p1.patch new file mode 100644 index 0000000..3801639 --- /dev/null +++ b/patches/xnu-3789.51.2.copyright-check.p1.patch @@ -0,0 +1,22 @@ +diff --git a/libkern/kxld/kxld_copyright.c b/libkern/kxld/kxld_copyright.c +index e1f13c2..8664226 100644 +--- a/libkern/kxld/kxld_copyright.c ++++ b/libkern/kxld/kxld_copyright.c +@@ -49,6 +49,7 @@ + + #define kCopyrightToken "Copyright © " + #define kRightsToken " Apple Inc. All rights reserved." ++#define kRightsTokenPD " PureDarwin Project. All rights reserved." + + /****************************************************************************** + * Globals +@@ -252,6 +253,9 @@ kxld_validate_copyright_string(const char *str) + + copyright = kxld_strstr(str, kCopyrightToken); + rights = kxld_strstr(str, kRightsToken); ++ if (!rights) { ++ rights = kxld_strstr(str, kRightsTokenPD); ++ } + + if (!copyright || !rights || copyright > rights) goto finish; + diff --git a/patches/xnu-3789.51.2.firehose-buildroot.p1.patch b/patches/xnu-3789.51.2.firehose-buildroot.p1.patch new file mode 100644 index 0000000..d685efd --- /dev/null +++ b/patches/xnu-3789.51.2.firehose-buildroot.p1.patch @@ -0,0 +1,22 @@ +diff --git a/makedefs/MakeInc.def b/makedefs/MakeInc.def +index 31825ce..de93142 100644 +--- a/makedefs/MakeInc.def ++++ b/makedefs/MakeInc.def +@@ -325,7 +325,7 @@ LDFLAGS_KERNEL_GEN = \ + -Wl,-function_starts \ + -Wl,-headerpad,152 + +-LDFLAGS_KERNEL_SDK = -L$(SDKROOT)/usr/local/lib/kernel -lfirehose_kernel ++LDFLAGS_KERNEL_SDK = -L$(RC_BuildRoot)/usr/local/lib/kernel -lfirehose_kernel + + LDFLAGS_KERNEL_RELEASE = + LDFLAGS_KERNEL_DEVELOPMENT = +@@ -420,7 +420,7 @@ INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_L + INCFLAGS_EXTERN = -I$(SRCROOT)/EXTERNAL_HEADERS + INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) -I$(OBJROOT)/EXPORT_HDRS/$(COMPONENT) + INCFLAGS_LOCAL = -I. +-INCFLAGS_SDK = -I$(SDKROOT)/usr/local/include/kernel ++INCFLAGS_SDK = -I$(RC_BuildRoot)/usr/local/include/kernel + + INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE) $(INCFLAGS_SDK) + diff --git a/patches/xnu-3789.51.2.fix-codesign.p1.patch b/patches/xnu-3789.51.2.fix-codesign.p1.patch new file mode 100644 index 0000000..e39071d --- /dev/null +++ b/patches/xnu-3789.51.2.fix-codesign.p1.patch @@ -0,0 +1,91 @@ +diff --git a/SETUP/config/Makefile b/SETUP/config/Makefile +index 56032b4..1e73452 100644 +--- a/SETUP/config/Makefile ++++ b/SETUP/config/Makefile +@@ -20,7 +20,7 @@ config: $(OBJS) + @echo "$(ColorH)HOST_LD$(Color0) $(ColorF)$@$(Color0)" + $(_v)$(HOST_CC) $(LDFLAGS) -o $@ $^ + @echo "$(ColorH)HOST_CODESIGN$(Color0) $(ColorF)$@$(Color0)" +- $(_v)env CODESIGN_ALLOCATE=$(HOST_CODESIGN_ALLOCATE) $(HOST_CODESIGN) -s - $@ ++ $(_v)env $(HOST_CODESIGN) -s - $@ + + %.o: %.c + @echo "$(ColorH)HOST_CC$(Color0) $(ColorF)$@$(Color0)" +diff --git a/SETUP/decomment/Makefile b/SETUP/decomment/Makefile +index 7018eb1..877ca15 100644 +--- a/SETUP/decomment/Makefile ++++ b/SETUP/decomment/Makefile +@@ -18,7 +18,7 @@ decomment: $(OBJS) + @echo "$(ColorH)HOST_LD$(Color0) $(ColorF)$@$(Color0)" + $(_v)$(HOST_CC) $(LDFLAGS) -o $@ $^ + @echo "$(ColorH)HOST_CODESIGN$(Color0) $(ColorF)$@$(Color0)" +- $(_v)env CODESIGN_ALLOCATE=$(HOST_CODESIGN_ALLOCATE) $(HOST_CODESIGN) -s - $@ ++ $(_v)env $(HOST_CODESIGN) -s - $@ + + %.o: %.c + @echo "$(ColorH)HOST_CC$(Color0) $(ColorF)$@$(Color0)" +diff --git a/SETUP/installfile/Makefile b/SETUP/installfile/Makefile +index eb1f3af..a74b483 100644 +--- a/SETUP/installfile/Makefile ++++ b/SETUP/installfile/Makefile +@@ -18,7 +18,7 @@ installfile: $(OBJS) + @echo "$(ColorH)HOST_LD$(Color0) $(ColorF)$@$(Color0)" + $(_v)$(HOST_CC) $(LDFLAGS) -o $@ $^ + @echo "$(ColorH)HOST_CODESIGN$(Color0) $(ColorF)$@$(Color0)" +- $(_v)env CODESIGN_ALLOCATE=$(HOST_CODESIGN_ALLOCATE) $(HOST_CODESIGN) -s - $@ ++ $(_v)env $(HOST_CODESIGN) -s - $@ + + %.o: %.c + @echo "$(ColorH)HOST_CC$(Color0) $(ColorF)$@$(Color0)" +diff --git a/SETUP/json_compilation_db/Makefile b/SETUP/json_compilation_db/Makefile +index 518644c..bf453c3 100644 +--- a/SETUP/json_compilation_db/Makefile ++++ b/SETUP/json_compilation_db/Makefile +@@ -18,7 +18,7 @@ json_compilation_db: $(OBJS) + @echo "$(ColorH)HOST_LD$(Color0) $(ColorF)$@$(Color0)" + $(_v)$(HOST_CC) $(LDFLAGS) -o $@ $^ + @echo "$(ColorH)HOST_CODESIGN$(Color0) $(ColorF)$@$(Color0)" +- $(_v)env CODESIGN_ALLOCATE=$(HOST_CODESIGN_ALLOCATE) $(HOST_CODESIGN) -s - $@ ++ $(_v)env $(HOST_CODESIGN) -s - $@ + + %.o: %.c + @echo "$(ColorH)HOST_CC$(Color0) $(ColorF)$@$(Color0)" +diff --git a/SETUP/kextsymboltool/Makefile b/SETUP/kextsymboltool/Makefile +index af6cdca..e38782f 100644 +--- a/SETUP/kextsymboltool/Makefile ++++ b/SETUP/kextsymboltool/Makefile +@@ -18,7 +18,7 @@ kextsymboltool: $(OBJS) + @echo "$(ColorH)HOST_LD$(Color0) $(ColorF)$@$(Color0)" + $(_v)$(HOST_CC) $(LDFLAGS) -o $@ $^ + @echo "$(ColorH)HOST_CODESIGN$(Color0) $(ColorF)$@$(Color0)" +- $(_v)env CODESIGN_ALLOCATE=$(HOST_CODESIGN_ALLOCATE) $(HOST_CODESIGN) -s - $@ ++ $(_v)env $(HOST_CODESIGN) -s - $@ + + %.o: %.c + @echo "$(ColorH)HOST_CC$(Color0) $(ColorF)$@$(Color0)" +diff --git a/SETUP/replacecontents/Makefile b/SETUP/replacecontents/Makefile +index e1e8484..44b81b9 100644 +--- a/SETUP/replacecontents/Makefile ++++ b/SETUP/replacecontents/Makefile +@@ -18,7 +18,7 @@ replacecontents: $(OBJS) + @echo "$(ColorH)HOST_LD$(Color0) $(ColorF)$@$(Color0)" + $(_v)$(HOST_CC) $(LDFLAGS) -o $@ $^ + @echo "$(ColorH)HOST_CODESIGN$(Color0) $(ColorF)$@$(Color0)" +- $(_v)env CODESIGN_ALLOCATE=$(HOST_CODESIGN_ALLOCATE) $(HOST_CODESIGN) -s - $@ ++ $(_v)env $(HOST_CODESIGN) -s - $@ + + %.o: %.c + @echo "$(ColorH)HOST_CC$(Color0) $(ColorF)$@$(Color0)" +diff --git a/SETUP/setsegname/Makefile b/SETUP/setsegname/Makefile +index 7e9224e..c2ed335 100644 +--- a/SETUP/setsegname/Makefile ++++ b/SETUP/setsegname/Makefile +@@ -18,7 +18,7 @@ setsegname: $(OBJS) + @echo "$(ColorH)HOST_LD$(Color0) $(ColorF)$@$(Color0)" + $(_v)$(HOST_CC) $(LDFLAGS) -o $@ $^ + @echo "$(ColorH)HOST_CODESIGN$(Color0) $(ColorF)$@$(Color0)" +- $(_v)env CODESIGN_ALLOCATE=$(HOST_CODESIGN_ALLOCATE) $(HOST_CODESIGN) -s - $@ ++ $(_v)env $(HOST_CODESIGN) -s - $@ + + %.o: %.c + @echo "$(ColorH)HOST_CC$(Color0) $(ColorF)$@$(Color0)" diff --git a/patches/xnu-3789.51.2.fix-path.patch b/patches/xnu-3789.51.2.fix-path.patch new file mode 100644 index 0000000..70a110b --- /dev/null +++ b/patches/xnu-3789.51.2.fix-path.patch @@ -0,0 +1,31 @@ +--- ../xnu-3789.51.2.orig/bsd/sys/make_symbol_aliasing.sh 2017-05-23 18:07:20.000000000 -0400 ++++ bsd/sys/make_symbol_aliasing.sh 2017-05-23 17:57:10.000000000 -0400 +@@ -34,8 +34,8 @@ + SDKROOT="$1" + OUTPUT="$2" + +-if [ ! -x "${SDKROOT}/usr/local/libexec/availability.pl" ] ; then +- echo "Unable to locate ${SDKROOT}/usr/local/libexec/availability.pl (or not executable)" >&2 ++if [ ! -x "/usr/local/libexec/availability.pl" ] ; then ++ echo "Unable to locate /usr/local/libexec/availability.pl (or not executable)" >&2 + exit 1 + fi + +@@ -74,7 +74,7 @@ + + EOF + +-for ver in $(${SDKROOT}/usr/local/libexec/availability.pl --ios) ; do ++for ver in $(/usr/local/libexec/availability.pl --ios) ; do + ver_major=${ver%.*} + ver_minor=${ver#*.} + value=$(printf "%d%02d00" ${ver_major} ${ver_minor}) +@@ -87,7 +87,7 @@ + echo "" + done + +-for ver in $(${SDKROOT}/usr/local/libexec/availability.pl --macosx) ; do ++for ver in $(/usr/local/libexec/availability.pl --macosx) ; do + set -- $(echo "$ver" | tr '.' ' ') + ver_major=$1 + ver_minor=$2 diff --git a/patches/xnu-3789.51.2.paths.p1.patch b/patches/xnu-3789.51.2.paths.p1.patch new file mode 100644 index 0000000..10e8503 --- /dev/null +++ b/patches/xnu-3789.51.2.paths.p1.patch @@ -0,0 +1,48 @@ +diff --git a/bsd/sys/make_symbol_aliasing.sh b/bsd/sys/make_symbol_aliasing.sh +index bfddb2d..a1e694a 100755 +--- a/bsd/sys/make_symbol_aliasing.sh ++++ b/bsd/sys/make_symbol_aliasing.sh +@@ -34,8 +34,8 @@ fi + SDKROOT="$1" + OUTPUT="$2" + +-if [ ! -x "/usr/local/libexec/availability.pl" ] ; then +- echo "Unable to locate /usr/local/libexec/availability.pl (or not executable)" >&2 ++if [ ! -x "${RC_BuildRoot}/usr/local/libexec/availability.pl" ] ; then ++ echo "Unable to locate ${RC_BuildRoot}/usr/local/libexec/availability.pl (or not executable)" >&2 + exit 1 + fi + +@@ -74,7 +74,7 @@ cat <.allocate(capacity: Int(MAXPATHLEN) * MemoryLayout.stride) + defer { + buffer.deallocate() + } + + getcwd(buffer, Int(MAXPATHLEN)) + return String(cString: UnsafePointer(OpaquePointer(buffer))) + } + + set { + _ = newValue.withCString { + buffer in + chdir(buffer) + } + } + } + + enum Environment { + internal static subscript(name: String) -> String? { + get { + let buffer = name.withCString { + nameBuffer in + getenv(nameBuffer) + } + + if let buffer = buffer { + return String(cString: buffer) + } else { + return nil + } + } + + set { + if let newValue = newValue { + _ = name.withCString { + nameBuffer in + newValue.withCString { + valueBuffer in + setenv(nameBuffer, valueBuffer, 1) + } + } + } else { + _ = name.withCString { + nameBuffer in + unsetenv(nameBuffer) + } + } + } + } + } +} + +internal extension FileManager { + func directoryExists(atPath path: String) -> Bool { + var isDir = ObjCBool(false) + let exists = self.fileExists(atPath: path, isDirectory: &isDir) + return exists && isDir.boolValue + } + + func fileExists(atPath path: String) -> Bool { + var isDir = ObjCBool(false) + let exists = self.fileExists(atPath: path, isDirectory: &isDir) + return exists && !isDir.boolValue + } +} + +internal func joinPath(_ paths: String...) -> String { + var accumulator = URL(fileURLWithPath: paths[0]) + for element in paths[1...] { + accumulator = accumulator.appendingPathComponent(element) + } + return accumulator.path +} diff --git a/swift/darwinbuild-codesign/main.swift b/swift/darwinbuild-codesign/main.swift new file mode 100644 index 0000000..dc52a57 --- /dev/null +++ b/swift/darwinbuild-codesign/main.swift @@ -0,0 +1,191 @@ +// +// Copyright (c) 2019 William Kent. All rights reserved. +// +// 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 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. +// + +import Foundation +import SwiftCLI + +fileprivate enum Exception: Error { + case message(_ text: String) +} + +internal extension Dictionary { + func get(_ key: Key) -> Type? { + if let value = self[key] { + return value as? Type + } else { + return nil + } + } +} + +class CodesignCommand: Command { + let name = "sign-root" + + private let certificateName = Param.Required() + private let dstroot = Param.Required() + + private enum TimestampType + { + case apple + case custom(arg: String) + case disabled + } + + private func parseTimestampType(_ plistValue: Any) throws -> TimestampType { + if let arg = plistValue as? String { + return .custom(arg: arg) + } else if let arg = plistValue as? Bool { + if arg { + return .apple + } else { + return .disabled + } + } else { + throw Exception.message("Unrecognized timestamp value: must be either string or boolean") + } + } + + public func execute() throws { + let dstroot = self.dstroot.value + let codesignPlistPath = joinPath(dstroot, "usr", "local", "darwinbuild", "darwinbuild-codesign.plist") + let data = try Data(contentsOf: URL(fileURLWithPath: codesignPlistPath)) + let codesignPlist = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as! [String: Any] + + let defaultHardenedRuntime = codesignPlist.get("hardened_runtime") ?? false + let defaultPrefix: String? = codesignPlist.get("prefix") + let defaultTimestamp: TimestampType + if let timestampValue: Any = codesignPlist.get("timestamp") { + defaultTimestamp = try parseTimestampType(timestampValue) + } else { + defaultTimestamp = .apple + } + + var signingMap: [Int: [(String, Task)]] = [:] + guard let fileMap: [String: Any] = codesignPlist.get("files") else { + print("Warning: Nothing to sign") + return + } + + for (key, data) in fileMap { + let identifier: String? + let prefix: String? + let hardenedRuntime: Bool + let dr: String? + let order: Int + let timestamp: TimestampType + + if let flag = data as? Bool { + if !flag { + print("Warning: false value interpreted as \"use all default values\"", to: &standardError) + } + + identifier = nil + prefix = defaultPrefix + hardenedRuntime = defaultHardenedRuntime + dr = nil + order = 0xFFFF + timestamp = defaultTimestamp + } else if let data = data as? [String: Any] { + identifier = data.get("identifier") + prefix = data.get("prefix") ?? defaultPrefix + hardenedRuntime = (data["hardened_runtime"] as? Bool) ?? defaultHardenedRuntime + dr = data.get("dr") + order = data.get("order") ?? 0xFFFF + if let timestampValue: Any = data.get("timestamp") { + timestamp = try parseTimestampType(timestampValue) + } else { + timestamp = defaultTimestamp + } + } else { + throw Exception.message("Values in \"files\" dictionary must be booleans or dictionaries only") + } + + var codesignArgv = ["-s", self.certificateName.value, "-f", "--preserve-metadata=entitlements"] + if let identifier = identifier { + codesignArgv.append("-i") + codesignArgv.append(identifier) + } + if let prefix = prefix { + codesignArgv.append("--prefix") + + if prefix.hasSuffix(".") { + codesignArgv.append(prefix) + } else { + codesignArgv.append(prefix + ".") + } + } + if let dr = dr { + codesignArgv.append("-r") + codesignArgv.append(dr) + } + if hardenedRuntime { + codesignArgv.append("-o") + codesignArgv.append("runtime") + } + switch timestamp { + case .apple: + codesignArgv.append("--timestamp") + case .disabled: + codesignArgv.append("--timestamp=none") + case .custom(let arg): + codesignArgv.append("--timestamp=\(arg)") + } + codesignArgv.append(joinPath(dstroot, key)) + + let task = Task(executable: "/usr/bin/codesign", arguments: codesignArgv, stdout: WriteStream.stdout, stderr: WriteStream.stderr) + if var orderDict = signingMap[order] { + orderDict.append((key, task)) + signingMap[order] = orderDict + } else { + signingMap[order] = [(key, task)] + } + } + + let keyVector = signingMap.keys.sorted() + for index in keyVector { + if let tasks = signingMap[index] { + for (path, task) in tasks { + print("Signing", path) + + let exitCode = task.runSync() + if exitCode != 0 { + print("Signing command failed with code", exitCode, to: &standardError) + exit(1) + } + } + } + } + } +} + +func main() { + let parser = CLI(singleCommand: CodesignCommand()) + parser.goAndExit() +} + +main() diff --git a/swift/darwinbuild-recursive/main.swift b/swift/darwinbuild-recursive/main.swift new file mode 100644 index 0000000..a0ecc5a --- /dev/null +++ b/swift/darwinbuild-recursive/main.swift @@ -0,0 +1,139 @@ +// +// Copyright (c) 2019 William Kent. All rights reserved. +// +// 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 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. +// + +import Foundation +import SwiftCLI + +fileprivate func readProcessOutput(commandName: String, arguments: [String]) -> String { + let output = CaptureStream() + let task = Task(executable: commandName, arguments: arguments, stdout: output, stderr: WriteStream.stderr) + + let exitCode = task.runSync() + if exitCode != 0 { + print("\(commandName) \(arguments) failed with code \(exitCode)", to: &standardError) + exit(1) + } + + if let text = String(data: output.readAllData(), encoding: .utf8) { + return text + } else { + fatalError("could not decode tool output into UTF-8 string") + } +} + +fileprivate func splitLines(_ input: String) -> [String] { + var retval: [String] = [] + input.enumerateLines { + (line, _) in + retval.append(line) + } + return retval +} + +fileprivate struct RecursiveBuildContext { + fileprivate var completedDependencies = Set() + fileprivate var completedHeaderDependencies = Set() + + fileprivate mutating func buildProject(projectName: String, isHeaderDependency: Bool = false) { + if isHeaderDependency { + if completedHeaderDependencies.contains(projectName) { + return + } else { + completedHeaderDependencies.insert(projectName) + } + } else { + if completedDependencies.contains(projectName) { + return + } else { + completedDependencies.insert(projectName) + } + } + + let buildDependencies = splitLines(readProcessOutput(commandName: "/usr/local/bin/darwinxref", arguments: ["dependencies", "-build", projectName])) + let headerDependencies = splitLines(readProcessOutput(commandName: "/usr/local/bin/darwinxref", arguments: ["dependencies", "-header", projectName])) + + for dep in headerDependencies { + buildProject(projectName: dep, isHeaderDependency: true) + } + for dep in buildDependencies { + buildProject(projectName: dep, isHeaderDependency: false) + } + + let task = Task(executable: "/usr/local/bin/darwinbuild", arguments: isHeaderDependency ? ["-headers", projectName] : [projectName], stdout: WriteStream.stdout, stderr: WriteStream.stderr) + let exitCode = task.runSync() + if exitCode != 0 { + print("darwinbuild \(isHeaderDependency ? "-headers " : "")\(projectName) failed with code \(exitCode)", to: &standardError) + exit(1) + } + } +} + +func main() { + if CommandLine.arguments.count < 3 { + print("Internal tool used by darwinbuild, please do not invoke directly", to: &standardError) + exit(1) + } + + let fm = FileManager() + let buildroot = CommandLine.Environment["DARWIN_BUILDROOT"] ?? CommandLine.workingDirectory + if !(fm.directoryExists(atPath: joinPath(buildroot, "Roots")) && + fm.directoryExists(atPath: joinPath(buildroot, "Sources")) && + fm.directoryExists(atPath: joinPath(buildroot, "Symbols")) && + fm.directoryExists(atPath: joinPath(buildroot, "Headers")) && + fm.directoryExists(atPath: joinPath(buildroot, "Logs"))) { + print("ERROR: Could not find darwinbuild root, this is required", to: &standardError) + print("Please change your working directory to one initialized by:", to: &standardError) + print("\t$ darwinbuild -init ", to: &standardError) + print("Alternatively, you may set the DARWIN_BUILDROOT environment variable to the", to: &standardError) + print("absolute path of that directory.", to: &standardError) + + exit(1) + } + CommandLine.workingDirectory = buildroot + + var context = RecursiveBuildContext() + if CommandLine.arguments[1] == "-g" { + let groupOutput = splitLines(readProcessOutput(commandName: "darwinxref", arguments: ["group", CommandLine.arguments[2]])) + for line in groupOutput { + for word in line.components(separatedBy: NSCharacterSet.whitespaces) { + if word != "" { + context.buildProject(projectName: word) + } + } + } + } else if CommandLine.arguments[1] == "-p" { + for projectName in CommandLine.arguments[2...] { + context.buildProject(projectName: projectName) + } + } else { + print("ERROR: First argument must be either -g or -p", to: &standardError) + exit(1) + } +} + +main() diff --git a/swift/fetch-from-github/main.swift b/swift/fetch-from-github/main.swift new file mode 100644 index 0000000..077f830 --- /dev/null +++ b/swift/fetch-from-github/main.swift @@ -0,0 +1,116 @@ +// +// Copyright (c) 2019 William Kent. All rights reserved. +// +// 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 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. +// + +import Foundation +import SwiftCLI + +class FetchSourcesCommand: Command { + let name = "fetch-from-github" + + private let plistFilename = Param.Required() + private let projectName = Param.Required() + private let projectVersion = Param.Required() + private let sourcesDir = Param.Required() + + func execute() throws { + let data = try Data(contentsOf: URL(fileURLWithPath: plistFilename.value)) + let darwinbuildPlist = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as! [String : Any] + + let projects = darwinbuildPlist["projects"] as! [String: Any] + if !projects.keys.contains(projectName.value) { + print("ERROR: Project \(projectName.value) not found", to: &standardError) + exit(1) + } + + let projectData = projects[projectName.value] as! [String: Any] + guard let githubData = projectData["github"] else { + return + } + + var downloadURL: String + var repoBasename: String + var tag: String + + if let githubRepoName = githubData as? String { + let repoParts = githubRepoName.components(separatedBy: "/") + repoBasename = repoParts[1] + tag = projectVersion.value + + downloadURL = "https://github.com/\(githubRepoName)/archive/\(projectVersion.value).tar.gz" + } else if let githubData = githubData as? [String: Any] { + let githubRepoName = githubData["repo"] as! String + let repoParts = githubRepoName.components(separatedBy: "/") + repoBasename = repoParts[1] + if let tagFromPlist = githubData["tag"] as? String { + tag = tagFromPlist + downloadURL = "https://github.com/\(githubRepoName)/archive/\(tag).tar.gz" + } else { + tag = projectVersion.value + downloadURL = "https://github.com/\(githubRepoName)/archive/\(projectVersion.value).tar.gz" + } + } else { + print("ERROR: github key must be of type string or dictionary", to: &standardError) + exit(1) + } + + let tarballFilename = projectName.value + "-" + projectVersion.value + ".tar.gz" + let downloadPath = joinPath(sourcesDir.value, tarballFilename) + print("Downloading \(downloadURL) ...") + + do { + try Task.run("/usr/bin/curl", arguments: ["-fLs", "-o", downloadPath, downloadURL]) + } catch is RunError { + // This can occur if the server returns a 404 or other error. + exit(1) + } + + if repoBasename != projectName.value || tag != projectVersion.value { + let fm = FileManager() + let tempDir = joinPath(fm.temporaryDirectory.path, "fetch-from-github") + try fm.createDirectory(at: URL(fileURLWithPath: tempDir), withIntermediateDirectories: true, attributes: nil) + + do { + try Task.run("/usr/bin/tar", arguments: ["xf", downloadPath], directory: tempDir) + try fm.moveItem(at: URL(fileURLWithPath: joinPath(tempDir, repoBasename + "-" + tag)), to: URL(fileURLWithPath: joinPath(tempDir, projectName.value + "-" + projectVersion.value))) + try Task.run("/usr/bin/tar", arguments: ["czf", downloadPath, projectName.value + "-" + projectVersion.value], directory: tempDir) + + try? fm.removeItem(atPath: tempDir) + } catch is RunError { + try! fm.removeItem(atPath: tempDir) + exit(1) + } + } + } +} + +func main() { + let handler = CLI(singleCommand: FetchSourcesCommand()) + handler.goAndExit() +} + +main() diff --git a/testing/darwintrace/close-test b/testing/darwintrace/close-test old mode 100755 new mode 100644 diff --git a/testing/darwintrace/exec b/testing/darwintrace/exec old mode 100755 new mode 100644 diff --git a/testing/darwintrace/realpath b/testing/darwintrace/realpath old mode 100755 new mode 100644 diff --git a/testing/darwintrace/redirection-test b/testing/darwintrace/redirection-test old mode 100755 new mode 100644 diff --git a/testing/darwintrace/run-tests.sh b/testing/darwintrace/run-tests.sh old mode 100755 new mode 100644 diff --git a/testing/darwinup/300dirs.tbz2 b/testing/darwinup/300dirs.tbz2 deleted file mode 100644 index cdb2bb9..0000000 Binary files a/testing/darwinup/300dirs.tbz2 and /dev/null differ diff --git a/testing/darwinup/300files.tbz2 b/testing/darwinup/300files.tbz2 deleted file mode 100644 index f314631..0000000 Binary files a/testing/darwinup/300files.tbz2 and /dev/null differ diff --git a/testing/darwinup/corrupt.tgz b/testing/darwinup/corrupt.tgz deleted file mode 100644 index a20c150..0000000 --- a/testing/darwinup/corrupt.tgz +++ /dev/null @@ -1,2 +0,0 @@ -This is a text file. Darwinup will see the .tgz extension and try to use tar on it. -This will fail, which allows us to test early failures from external tools (like ditto and tar). diff --git a/testing/darwinup/deep-rollback-2.xar b/testing/darwinup/deep-rollback-2.xar deleted file mode 100644 index 1efbfb5..0000000 Binary files a/testing/darwinup/deep-rollback-2.xar and /dev/null differ diff --git a/testing/darwinup/deep-rollback.cpgz b/testing/darwinup/deep-rollback.cpgz deleted file mode 100644 index dc3f238..0000000 Binary files a/testing/darwinup/deep-rollback.cpgz and /dev/null differ diff --git a/testing/darwinup/depotroot.tar.gz b/testing/darwinup/depotroot.tar.gz deleted file mode 100644 index 4b2e72d..0000000 Binary files a/testing/darwinup/depotroot.tar.gz and /dev/null differ diff --git a/testing/darwinup/dest.tar.gz b/testing/darwinup/dest.tar.gz deleted file mode 100644 index 1ad0730..0000000 Binary files a/testing/darwinup/dest.tar.gz and /dev/null differ diff --git a/testing/darwinup/extension.tar.bz2 b/testing/darwinup/extension.tar.bz2 deleted file mode 100644 index 4108ee1..0000000 Binary files a/testing/darwinup/extension.tar.bz2 and /dev/null differ diff --git a/testing/darwinup/rep_dir_file.tar.gz b/testing/darwinup/rep_dir_file.tar.gz deleted file mode 100644 index fb54e8c..0000000 Binary files a/testing/darwinup/rep_dir_file.tar.gz and /dev/null differ diff --git a/testing/darwinup/rep_dir_link.tar.gz b/testing/darwinup/rep_dir_link.tar.gz deleted file mode 100644 index 00f5aae..0000000 Binary files a/testing/darwinup/rep_dir_link.tar.gz and /dev/null differ diff --git a/testing/darwinup/rep_file_dir.tar.gz b/testing/darwinup/rep_file_dir.tar.gz deleted file mode 100644 index 9eda327..0000000 Binary files a/testing/darwinup/rep_file_dir.tar.gz and /dev/null differ diff --git a/testing/darwinup/rep_file_link.tar.gz b/testing/darwinup/rep_file_link.tar.gz deleted file mode 100644 index 6c94b78..0000000 Binary files a/testing/darwinup/rep_file_link.tar.gz and /dev/null differ diff --git a/testing/darwinup/rep_flink_dir.tar.gz b/testing/darwinup/rep_flink_dir.tar.gz deleted file mode 100644 index ef481e6..0000000 Binary files a/testing/darwinup/rep_flink_dir.tar.gz and /dev/null differ diff --git a/testing/darwinup/rep_flink_file.tar.gz b/testing/darwinup/rep_flink_file.tar.gz deleted file mode 100644 index 88e6095..0000000 Binary files a/testing/darwinup/rep_flink_file.tar.gz and /dev/null differ diff --git a/testing/darwinup/rep_link_dir.tar.gz b/testing/darwinup/rep_link_dir.tar.gz deleted file mode 100644 index 871f091..0000000 Binary files a/testing/darwinup/rep_link_dir.tar.gz and /dev/null differ diff --git a/testing/darwinup/rep_link_file.tar.gz b/testing/darwinup/rep_link_file.tar.gz deleted file mode 100644 index f2ca25e..0000000 Binary files a/testing/darwinup/rep_link_file.tar.gz and /dev/null differ diff --git a/testing/darwinup/root.tar.gz b/testing/darwinup/root.tar.gz deleted file mode 100644 index b543bbc..0000000 Binary files a/testing/darwinup/root.tar.gz and /dev/null differ diff --git a/testing/darwinup/root2.tar.gz b/testing/darwinup/root2.tar.gz deleted file mode 100644 index 07ec8cc..0000000 Binary files a/testing/darwinup/root2.tar.gz and /dev/null differ diff --git a/testing/darwinup/root3.tar.gz b/testing/darwinup/root3.tar.gz deleted file mode 100644 index be3d587..0000000 Binary files a/testing/darwinup/root3.tar.gz and /dev/null differ diff --git a/testing/darwinup/root5.tar.gz b/testing/darwinup/root5.tar.gz deleted file mode 100644 index 36b2c3c..0000000 Binary files a/testing/darwinup/root5.tar.gz and /dev/null differ diff --git a/testing/darwinup/root6.tar.gz b/testing/darwinup/root6.tar.gz deleted file mode 100644 index 5f2da65..0000000 Binary files a/testing/darwinup/root6.tar.gz and /dev/null differ diff --git a/testing/darwinup/root7.tar.gz b/testing/darwinup/root7.tar.gz deleted file mode 100644 index 9846fbc..0000000 Binary files a/testing/darwinup/root7.tar.gz and /dev/null differ diff --git a/testing/darwinup/run-tests.sh b/testing/darwinup/run-tests.sh deleted file mode 100755 index 073716f..0000000 --- a/testing/darwinup/run-tests.sh +++ /dev/null @@ -1,571 +0,0 @@ -#!/bin/bash -set -e -set -x -pushd $(dirname $0) >> /dev/null - -# -# Run tests on darwinup -# -PREFIX=/tmp/testing/darwinup -ORIG=$PREFIX/orig -DEST=$PREFIX/dest -DESTTAR=dest.tar.gz - -HASXAR=$(darwinup 2>&1 | grep xar | wc -l) -HAS386=$(file `which darwinup` | grep i386 | wc -l) -HASX64=$(file `which darwinup` | grep x86_64 | wc -l) - -DARWINUP="darwinup $1 -p $DEST " -DIFF="diff -x .DarwinDepot -x broken -qru" - -ROOTS="root root2 root3" - - -function is_file { - test -f $1 -a ! -L $1 -} - -function is_dir { - test -d $1 -a ! -L $1 -} - -function is_link { - test -L $1; -} - - -echo "INFO: Cleaning up testing area ..." -rm -rf $PREFIX -mkdir -p $PREFIX - -echo "INFO: Untarring the test files ..." -tar zxvf $DESTTAR -C $PREFIX - -for R in $ROOTS; -do - tar zxvf $R.tar.gz -C $PREFIX -done; - -for R in root5 root6 root7 symlinks symlink_update; -do - tar zxvf $R.tar.gz -C $PREFIX -done; - -for R in rep_dir_file rep_dir_link rep_file_dir rep_file_link \ - rep_link_dir rep_link_file rep_flink_dir rep_flink_file; -do - tar zxvf $R.tar.gz -C $PREFIX -done; - -for R in 300dirs.tbz2 300files.tbz2 deep-rollback.cpgz deep-rollback-2.xar extension.tar.bz2 sandboxprofile.tar.bz2 xpcservice.tar.bz2; -do - cp $R $PREFIX/ -done; - -cp corrupt.tgz $PREFIX/ -cp depotroot.tar.gz $PREFIX/ - -mkdir -p $ORIG -cp -R $DEST/* $ORIG/ - -if [ -f /usr/bin/sudo ]; -then - echo "========== TEST: Listing =============" - /usr/bin/sudo -u nobody $DARWINUP list - $DARWINUP list -fi - -if [ $HAS386 -gt 0 -a $HASX64 -gt 0 ]; -then - echo "========== TEST: Trying both 32 and 64 bit ==========" - for R in $ROOTS; - do - echo "INFO: Installing $R ..."; - arch -i386 $DARWINUP install $PREFIX/$R - UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}') - echo "INFO: Uninstalling $R ..."; - arch -x86_64 $DARWINUP uninstall $UUID - echo "DIFF: diffing original test files to dest (should be no diffs) ..." - $DIFF $ORIG $DEST 2>&1 - echo "INFO: Installing $R ..."; - arch -x86_64 $DARWINUP install $PREFIX/$R - UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}') - echo "INFO: Uninstalling $R ..."; - arch -i386 $DARWINUP uninstall $UUID - echo "DIFF: diffing original test files to dest (should be no diffs) ..." - $DIFF $ORIG $DEST 2>&1 - done -fi - -echo "========== TEST: Test uninstall build check safety ==========" -$DARWINUP install $PREFIX/root2 -sqlite3 $DEST/.DarwinDepot/Database-V100 "UPDATE archives SET osbuild = '$(sw_vers -buildVersion)X'" -set +e -$DARWINUP uninstall root2 -if [ $? -eq 0 ]; then exit 1; fi -set -e -$DARWINUP -f uninstall root2 -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - - -echo "========== TEST: Try installing a symlink-to-directory ==========" -ln -s root2 $PREFIX/root_link -# test without trailing slash -$DARWINUP install $PREFIX/root_link -$DARWINUP uninstall root_link -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -# test with trailing slash -$DARWINUP install $PREFIX/root_link/ -$DARWINUP uninstall root_link -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Trying roots one at a time ==========" -for R in $ROOTS; -do - echo "INFO: Installing $R ..."; - $DARWINUP install $PREFIX/$R - UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}') - echo "INFO: Uninstalling $R ..."; - $DARWINUP uninstall $UUID - echo "DIFF: diffing original test files to dest (should be no diffs) ..." - $DIFF $ORIG $DEST 2>&1 -done - -echo "========== TEST: Multiple argument test =========="; -$DARWINUP install $PREFIX/root{,2,3} -LINES=$($DARWINUP list | wc -l) -if [ $LINES -lt 5 ]; then - echo "Failed multiple argument test." - exit 1; -fi -$DARWINUP uninstall all -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - - -echo "========== TEST: Trying all roots at once and verifying =============="; -for R in $ROOTS; -do - echo "INFO: Installing $R ..."; - $DARWINUP install $PREFIX/$R -done - -$DARWINUP verify all -$DARWINUP files all -$DARWINUP dump - -echo "========== TEST: uninstall in reverse =========="; -for R in $ROOTS; -do - UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}') - echo "INFO: Uninstalling $UUID ..."; - $DARWINUP uninstall $UUID -done -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Trying all roots at once, uninstall in install order by serial ==========" -for R in $ROOTS; -do - echo "INFO: Installing $R ..."; - $DARWINUP install $PREFIX/$R -done -for R in $ROOTS; -do - UUID=$($DARWINUP list | grep $R$ | awk '{print $1}') - echo "INFO: Uninstalling $UUID ..."; - $DARWINUP uninstall $UUID -done -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Trying all roots at once, uninstall root2, root3, root by UUID ==========" -for R in $ROOTS; -do - echo "INFO: Installing $R ..."; - $DARWINUP install $PREFIX/$R -done -for R in root2 root3 root; -do - UUID=$($DARWINUP list | grep $R$ | awk '{print $2}') - echo "INFO: Uninstalling $UUID ..."; - $DARWINUP uninstall $UUID -done -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Trying roots in reverse, uninstall in install order ==========" -for R in root3 root2 root; -do - echo "INFO: Installing $R ..."; - $DARWINUP install $PREFIX/$R -done -for R in root3 root2 root; -do - UUID=$($DARWINUP list | grep $R$ | awk '{print $1}') - echo "INFO: Uninstalling $UUID ..."; - $DARWINUP uninstall $UUID -done -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: trying large roots =========="; -echo "INFO: installing 300files"; -$DARWINUP install $PREFIX/300files.tbz2 -$DARWINUP uninstall 300files.tbz2 -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -echo "INFO: installing 300dir"; -$DARWINUP install $PREFIX/300dirs.tbz2 -$DARWINUP uninstall 300dirs.tbz2 -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -echo "INFO: installing both 300files and 300dirs"; -$DARWINUP install $PREFIX/300dirs.tbz2 -$DARWINUP install $PREFIX/300files.tbz2 -$DARWINUP uninstall 300dirs.tbz2 -$DARWINUP uninstall 300files.tbz2 -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Try uninstalling with user data in rollback ==========" -echo "INFO: Installing root5 ..."; -$DARWINUP install $PREFIX/root5 -$DARWINUP install $PREFIX/root6 -echo "modification" >> $DEST/d/file -$DARWINUP install $PREFIX/root7 -$DARWINUP uninstall root6 -$DARWINUP uninstall root5 -$DARWINUP uninstall root7 -stat $DEST/d/file -rm $DEST/d/file -rmdir $DEST/d -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Deep rollback while saving user data ==========" -$DARWINUP install $PREFIX/deep-rollback.cpgz -echo "modified" >> $DEST/d1/d2/d3/d4/d5/d6/file -$DARWINUP install $PREFIX/deep-rollback.cpgz -$DARWINUP uninstall newest -$DARWINUP uninstall newest -stat $DEST/d1/d2/d3/d4/d5/d6/file -rm $DEST/d1/d2/d3/d4/d5/d6/file -rm -rf $DEST/d1 -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -if [ $HASXAR -gt 0 ]; -then - $DARWINUP install $PREFIX/deep-rollback.cpgz - $DARWINUP install $PREFIX/deep-rollback-2.xar ; - $DARWINUP uninstall all - echo "DIFF: diffing original test files to dest (should be no diffs) ..." - $DIFF $ORIG $DEST 2>&1 -fi - -echo "========== TEST: Testing broken symlink handling ==========" -$DARWINUP install $PREFIX/symlinks -$DARWINUP uninstall symlinks -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -$DARWINUP install $PREFIX/symlink_update -stat -L $DEST/broken -$DARWINUP uninstall newest -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Upgrades =============" -$DARWINUP install $PREFIX/root5 -$DARWINUP upgrade $PREFIX/root5 -$DARWINUP upgrade $PREFIX/root5 -$DARWINUP upgrade $PREFIX/root5 -C=$($DARWINUP list | grep root5 | wc -l | xargs) -test "$C" == "1" -$DARWINUP uninstall oldest -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Try to upgrade with non-existent file =============" -$DARWINUP install $PREFIX/root5 -mv $PREFIX/root5 $PREFIX/root5.tmp -set +e -$DARWINUP upgrade $PREFIX/root5 -set -e -C=$($DARWINUP list | grep root5 | wc -l | xargs) -test "$C" == "1" -mv $PREFIX/root5.tmp $PREFIX/root5 -$DARWINUP uninstall oldest -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Superseded =============" -$DARWINUP install $PREFIX/root5 -$DARWINUP install $PREFIX/root6 -$DARWINUP install $PREFIX/root5 -$DARWINUP install $PREFIX/root2 -$DARWINUP install $PREFIX/root6 -$DARWINUP install $PREFIX/root6 -$DARWINUP install $PREFIX/root5 -$DARWINUP list superseded -$DARWINUP uninstall superseded -C=$($DARWINUP list | grep root | wc -l | xargs) -test "$C" == "2" -$DARWINUP uninstall oldest -$DARWINUP uninstall oldest -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - - -echo "========== TEST: Archive Rename =============" -$DARWINUP install $PREFIX/root2 -$DARWINUP install $PREFIX/root -$DARWINUP install $PREFIX/root6 -$DARWINUP rename root "RENAME1" -C=$($DARWINUP list | grep "RENAME1" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "1" -$DARWINUP rename oldest "RENAME2" -C=$($DARWINUP list | grep "RENAME2" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "1" -$DARWINUP uninstall "RENAME1" -C=$($DARWINUP list | grep "RENAME1" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "0" -C=$($DARWINUP files "RENAME2" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "17" -C=$($DARWINUP verify "RENAME2" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "17" -$DARWINUP rename root6 RENAME3 RENAME3 RENAME4 RENAME4 RENAME5 RENAME5 RENAME6 -C=$($DARWINUP list | grep "root6" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "0" -C=$($DARWINUP list | grep "RENAME6" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "1" -C=$($DARWINUP files "RENAME6" | grep -Ev '^Found' | wc -l | xargs) -test "$C" == "8" -$DARWINUP uninstall all -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Modify /System/Library/Extensions ==========" -mkdir -p $DEST/System/Library/Extensions/Foo.kext -BEFORE=$(ls -Tld $DEST/System/Library/Extensions/ | awk '{print $6$7$8$9}'); -sleep 2; -$DARWINUP install extension.tar.bz2 -AFTER=$(ls -Tld $DEST/System/Library/Extensions/ | awk '{print $6$7$8$9}'); -test $BEFORE != $AFTER -$DARWINUP uninstall newest -rm -rf $DEST/System -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Install XPC Service ==========" -mkdir -p $DEST/usr/libexec -mkdir -p $DEST/System -cp /usr/libexec/xpchelper $DEST/usr/libexec -$DARWINUP install xpcservice.tar.bz2 -test -f $DEST/System/Library/Caches/com.apple.xpchelper.cache -$DARWINUP uninstall newest -rm -rf $DEST/System $DEST/usr -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Install Sandbox Profile ==========" -mkdir -p $DEST/usr/libexec -mkdir -p $DEST/System -cp /usr/libexec/xpchelper $DEST/usr/libexec -$DARWINUP install sandboxprofile.tar.bz2 -test -f $DEST/System/Library/Caches/com.apple.xpchelper.cache -$DARWINUP uninstall newest -rm -rf $DEST/System $DEST/usr -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: file to directory ==========" -is_file $DEST/rep_file -$DARWINUP -f install $PREFIX/rep_file_dir -is_dir $DEST/rep_file -is_file $DEST/rep_file/subfile -is_dir $DEST/rep_file/subdir -is_file $DEST/rep_file/subdir/subsubfile -$DARWINUP uninstall newest -is_file $DEST/rep_file -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: file to symlink ==========" -is_file $DEST/rep_file -$DARWINUP -f install $PREFIX/rep_file_link -is_link $DEST/rep_file -$DARWINUP uninstall newest -is_file $DEST/rep_file -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: directory to file ==========" -is_dir $DEST/rep_dir -is_file $DEST/rep_dir/subfile -is_dir $DEST/rep_dir/subdir -is_file $DEST/rep_dir/subdir/subsubfile -$DARWINUP -f install $PREFIX/rep_dir_file -is_file $DEST/rep_dir -$DARWINUP uninstall newest -is_dir $DEST/rep_dir -is_file $DEST/rep_dir/subfile -is_dir $DEST/rep_dir/subdir -is_file $DEST/rep_dir/subdir/subsubfile -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: directory to symlink ==========" -is_dir $DEST/rep_dir -is_file $DEST/rep_dir/subfile -is_dir $DEST/rep_dir/subdir -is_file $DEST/rep_dir/subdir/subsubfile -$DARWINUP -f install $PREFIX/rep_dir_link -is_link $DEST/rep_dir -$DARWINUP uninstall newest -is_dir $DEST/rep_dir -is_file $DEST/rep_dir/subfile -is_dir $DEST/rep_dir/subdir -is_file $DEST/rep_dir/subdir/subsubfile -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: symlink->dir to file ==========" -is_link $DEST/rep_link -$DARWINUP -f install $PREFIX/rep_link_file -is_file $DEST/rep_link -$DARWINUP uninstall newest -is_link $DEST/rep_link -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: symlink->dir to directory ==========" -is_link $DEST/rep_link -$DARWINUP -f install $PREFIX/rep_link_dir -is_dir $DEST/rep_link -is_file $DEST/rep_link/anotherfile -is_dir $DEST/rep_link/anotherdir -is_file $DEST/rep_link/anotherdir/anothersubfile -$DARWINUP uninstall newest -is_link $DEST/rep_link -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: symlink->file to file ==========" -is_link $DEST/rep_flink -$DARWINUP -f install $PREFIX/rep_flink_file -is_file $DEST/rep_flink -$DARWINUP uninstall newest -is_link $DEST/rep_flink -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - -echo "========== TEST: Forcing object change: symlink->file to directory ==========" -is_link $DEST/rep_flink -$DARWINUP -f install $PREFIX/rep_flink_dir -is_dir $DEST/rep_flink -is_file $DEST/rep_flink/subfile -is_dir $DEST/rep_flink/subdir -is_file $DEST/rep_flink/subdir/subsubfile -$DARWINUP uninstall newest -is_link $DEST/rep_flink -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 - - - -# -# The following are expected failures -# -echo "========== Expected Failures ==========" -set +e - -echo "========== TEST: testing early ditto failure =========="; - -$DARWINUP install $PREFIX/corrupt.tgz | tee $PREFIX/corrupt.log -C=$(grep -c 'Rolling back' $PREFIX/corrupt.log) -test $C -eq 0 -if [ $? -ne 0 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: testing recursive install guards =========="; -$DARWINUP install $PREFIX/depotroot.tar.gz -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi -$DARWINUP install $DEST -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi -darwinup $1 install / -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing File with Directory ==========" -$DARWINUP install $PREFIX/rep_file_dir -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing File with Symlink ==========" -$DARWINUP install $PREFIX/rep_file_link -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing Directory with Symlink ==========" -$DARWINUP install $PREFIX/rep_dir_link -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing Directory with File ==========" -$DARWINUP install $PREFIX/rep_dir_file -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing Symlink to directory with Directory ==========" -$DARWINUP install $PREFIX/rep_link_dir -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing Symlink to directory with File ==========" -$DARWINUP install $PREFIX/rep_link_file -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing Symlink to file with Directory ==========" -$DARWINUP install $PREFIX/rep_flink_dir -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -echo "========== TEST: Try replacing Symlink to file with File ==========" -$DARWINUP install $PREFIX/rep_flink_file -if [ $? -ne 255 ]; then exit 1; fi -echo "DIFF: diffing original test files to dest (should be no diffs) ..." -$DIFF $ORIG $DEST 2>&1 -if [ $? -ne 0 ]; then exit 1; fi - -popd >> /dev/null -echo "INFO: Done testing!" - diff --git a/testing/darwinup/symlink_update.tar.gz b/testing/darwinup/symlink_update.tar.gz deleted file mode 100644 index 99e9fe6..0000000 Binary files a/testing/darwinup/symlink_update.tar.gz and /dev/null differ diff --git a/testing/darwinup/symlinks.tar.gz b/testing/darwinup/symlinks.tar.gz deleted file mode 100644 index 25896ec..0000000 Binary files a/testing/darwinup/symlinks.tar.gz and /dev/null differ diff --git a/testing/run-all-tests.sh b/testing/run-all-tests.sh old mode 100755 new mode 100644