Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Homebrew support added. #16

Merged
merged 2 commits into from
Jul 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
TEMPORARY_FOLDER=/tmp/Apous.dst
PREFIX=/usr/local
BUILD_TOOL=xcodebuild

XCODEFLAGS=-project 'apous.xcodeproj' -scheme 'apous' DSTROOT=$(TEMPORARY_FOLDER)

APOUS_EXECUTABLE=$(TEMPORARY_FOLDER)/apous

FRAMEWORKS_FOLDER=/Library/Frameworks
BINARIES_FOLDER=/usr/local/bin

VERSION_STRING=v0.2.0
COMPONENTS_PLIST=misc/Components.plist

OUTPUT_PACKAGE=Apous.pkg

.PHONY: all bootstrap clean install package test uninstall

all: bootstrap
$(BUILD_TOOL) $(XCODEFLAGS) build

bootstrap:
misc/scripts/bootstrap.sh

test: clean bootstrap
$(BUILD_TOOL) $(XCODEFLAGS) test

clean:
rm -f "$(OUTPUT_PACKAGE)"
rm -rf "$(TEMPORARY_FOLDER)"
$(BUILD_TOOL) $(XCODEFLAGS) clean

install: package
sudo installer -pkg "$(TEMPORARY_FOLDER)/$(OUTPUT_PACKAGE)" -target /

uninstall:
rm -f "$(BINARIES_FOLDER)/apous"

installables: clean bootstrap
$(BUILD_TOOL) $(XCODEFLAGS) install

mkdir -p "$(TEMPORARY_FOLDER)$(BINARIES_FOLDER)"

prefix_install: installables
mkdir -p "$(PREFIX)/Frameworks" "$(PREFIX)/bin"
cp -f "$(TEMPORARY_FOLDER)$(BINARIES_FOLDER)/apous" "$(PREFIX)/bin/"

package: installables
pkgbuild \
--component-plist "$(COMPONENTS_PLIST)" \
--identifier "io.owensd.apous" \
--install-location "/" \
--root "$(TEMPORARY_FOLDER)" \
--version "$(VERSION_STRING)" \
"$(TEMPORARY_FOLDER)/$(OUTPUT_PACKAGE)"
15 changes: 1 addition & 14 deletions apous.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
7D3AC3461B49F99B0068CC83 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D3AC3451B49F99B0068CC83 /* Utils.swift */; };
7D3AC3481B49FE170068CC83 /* ErrorCodes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D3AC3471B49FE170068CC83 /* ErrorCodes.swift */; };
7D3AC34A1B4A37BC0068CC83 /* Tools.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D3AC3491B4A37BC0068CC83 /* Tools.swift */; };
7DD671141B4BD94400C5DB6D /* apous in Deploy Locally */ = {isa = PBXBuildFile; fileRef = 7D0373351B49021700E2711D /* apous */; };
7DF997441B4B33A200E90F56 /* VersionInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF997431B4B33A200E90F56 /* VersionInfo.swift */; };
7DF997511B4B4A6900E90F56 /* Tools.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D3AC3491B4A37BC0068CC83 /* Tools.swift */; };
7DF9988C1B4B72FD00E90F56 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D3AC3451B49F99B0068CC83 /* Utils.swift */; };
Expand Down Expand Up @@ -46,17 +45,6 @@
);
runOnlyForDeploymentPostprocessing = 1;
};
7D03733F1B49026800E2711D /* Deploy Locally */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(SRCROOT)/bin";
dstSubfolderSpec = 0;
files = (
7DD671141B4BD94400C5DB6D /* apous in Deploy Locally */,
);
name = "Deploy Locally";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -181,7 +169,6 @@
7D0373311B49021700E2711D /* Sources */,
7D0373321B49021700E2711D /* Frameworks */,
7D0373331B49021700E2711D /* CopyFiles */,
7D03733F1B49026800E2711D /* Deploy Locally */,
7DE115081B4C4A9100B198FB /* Package for GitHub Release */,
);
buildRules = (
Expand Down Expand Up @@ -275,7 +262,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "mkdir -p releases\nrm -f $SRCROOT/releases/$TARGET_NAME.zip\nzip -j $SRCROOT/releases/$TARGET_NAME.zip $SRCROOT/bin/$TARGET_NAME";
shellScript = "#mkdir -p releases\n#rm -f $SRCROOT/releases/$TARGET_NAME.zip\n#zip -j $SRCROOT/releases/$TARGET_NAME.zip $SRCROOT/bin/$TARGET_NAME";
};
7DF9988B1B4B4C5600E90F56 /* Copy Samples */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
127 changes: 127 additions & 0 deletions apous.xcodeproj/xcshareddata/xcschemes/apous.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D0373341B49021700E2711D"
BuildableName = "apous"
BlueprintName = "apous"
ReferencedContainer = "container:apous.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D0F00901B4AF32F003B6EF0"
BuildableName = "apoustest.xctest"
BlueprintName = "apoustest"
ReferencedContainer = "container:apous.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D0373341B49021700E2711D"
BuildableName = "apous"
BlueprintName = "apous"
ReferencedContainer = "container:apous.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
customWorkingDirectory = "/Users/owensd/Library/Developer/Xcode/DerivedData/apous-fvgxvrkkgylijchhwanxayhydwrh/Build/Products/Debug/samples/shebang"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D0373341B49021700E2711D"
BuildableName = "apous"
BlueprintName = "apous"
ReferencedContainer = "container:apous.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "~/Projects/owensd.io/apous/samples/carthage"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "/Users/owensd/Library/Developer/Xcode/DerivedData/apous-fvgxvrkkgylijchhwanxayhydwrh/Build/Products/Debug/samples/carthage"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "~/Project/owensd.io/apous/samples/basic"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "./samples/nested"
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "PATH"
value = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/scripts:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D0373341B49021700E2711D"
BuildableName = "apous"
BlueprintName = "apous"
ReferencedContainer = "container:apous.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
6 changes: 6 additions & 0 deletions misc/Components.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
</array>
</plist>
47 changes: 47 additions & 0 deletions misc/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

export SCRIPT_DIR=$(dirname "$0")

##
## Bootstrap Process
##

main ()
{
local submodules=$(git submodule status)
local result=$?

if [ "$result" -ne "0" ]
then
exit $result
fi

if [ -n "$submodules" ]
then
echo "*** Updating submodules..."
update_submodules
fi
}

bootstrap_submodule ()
{
local bootstrap="script/bootstrap"

if [ -e "$bootstrap" ]
then
echo "*** Bootstrapping $name..."
"$bootstrap" >/dev/null
else
update_submodules
fi
}

update_submodules ()
{
git submodule sync --quiet && git submodule update --init && git submodule foreach --quiet bootstrap_submodule
}

export -f bootstrap_submodule
export -f update_submodules

main