Browse Source

alpha 0.1.0

pull/1/head
Burrit0z 4 years ago
parent
commit
a8913e2edc
8 changed files with 571 additions and 75 deletions
  1. +0
    -1
      KAIBattery.h
  2. +41
    -38
      KAIBattery.mm
  3. +30
    -0
      Kai.h
  4. +23
    -15
      Kai.xm
  5. +181
    -0
      build.ninja
  6. +7
    -17
      kaiprefs/KAIRootListController.m
  7. +108
    -4
      kaiprefs/Resources/Root.plist
  8. +181
    -0
      kaiprefs/build.ninja

+ 0
- 1
KAIBattery.h View File

@@ -32,7 +32,6 @@
@property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
@property (nonatomic, assign) BOOL isUpdating;
+(KAIBattery *)sharedInstance;
-(void)darkLightMode;
-(instancetype)init;
-(void)updateBattery;
@end

+ 41
- 38
KAIBattery.mm View File

@@ -13,7 +13,6 @@ KAIBattery *instance;
[self.widthAnchor constraintEqualToConstant:UIScreen.mainScreen.bounds.size.width - 16].active = YES;
[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;*/
[self updateBattery];
[self darkLightMode];
self.userInteractionEnabled = NO;
//[self addSubview:self.batteryLabel];
}
@@ -46,30 +45,35 @@ long long lastPercentage;
BOOL charging = MSHookIvar<long long>(device, "_charging");
BOOL LPM = MSHookIvar<BOOL>(device, "_batterySaverModeActive");

if(charging) {
BOOL shouldAdd = NO;

/*UIVisualEffectView *blank;
if(@available(iOS 12.0, *)) {
if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
} else {
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
}
} else {
if(showAll) {
shouldAdd = YES;
} else if(!showAll && charging) {
shouldAdd = YES;
}

if(shouldAdd) {
UIView *blank;
if(bannerStyle==1) {
blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil];
} else if(bannerStyle==2) {
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
} else if(bannerStyle==3) {
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
}*/
MTMaterialView *blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil];
//blank.recipeDynamic = NO; //makes it stay light
blank.frame = CGRectMake(0, 0 + y, self.superview.bounds.size.width - 16, bannerHeight);
}
blank.layer.masksToBounds = YES;
blank.layer.continuousCorners = YES;
blank.layer.cornerRadius = cornerRadius;
//[blank setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1]];

NSString *labelText = [NSString stringWithFormat:@"%@", deviceName];

UILabel *label = [[UILabel alloc] init];
if(!hideDeviceLabel) {
[label setFont:[UIFont systemFontOfSize:16]];
} else if(hideDeviceLabel) {
[label setFont:[UIFont systemFontOfSize:0]];
}
[label setTextColor:[UIColor whiteColor]];
label.lineBreakMode = NSLineBreakByWordWrapping;
label.numberOfLines = 0;
@@ -108,11 +112,31 @@ long long lastPercentage;
[self addSubview:battery];
[self addSubview:glyphView];

blank.translatesAutoresizingMaskIntoConstraints = NO;
if(bannerAlign==2) { //center
[blank.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = YES;
} else if(bannerAlign==1) { //left
[blank.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
} else if(bannerAlign==3) { //right
[blank.rightAnchor constraintEqualToAnchor:self.rightAnchor].active = YES;
}
[blank.topAnchor constraintEqualToAnchor:self.topAnchor constant:y].active = YES;
[blank.widthAnchor constraintEqualToConstant:((self.superview.bounds.size.width - 16) + bannerWidthFactor)].active = YES;
[blank.heightAnchor constraintEqualToConstant:bannerHeight].active = YES;


//percentLabel.frame = CGRectMake(self.superview.bounds.size.width - 16 - 94,35 + y,36,12);
percentLabel.translatesAutoresizingMaskIntoConstraints = NO;
[percentLabel.leftAnchor constraintEqualToAnchor:blank.rightAnchor constant:(- 94)].active = YES;
[percentLabel.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES;
[percentLabel.widthAnchor constraintEqualToConstant:36].active = YES;
[percentLabel.heightAnchor constraintEqualToConstant:12].active = YES;

//label.frame = CGRectMake(65.5,27.5 + y,275,25);
label.translatesAutoresizingMaskIntoConstraints = NO;
[label.leftAnchor constraintEqualToAnchor:glyphView.rightAnchor constant:4.5].active = YES;
[label.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES;
[label.widthAnchor constraintEqualToConstant:275].active = YES;
[label.rightAnchor constraintEqualToAnchor:percentLabel.leftAnchor constant:7].active = YES;
[label.heightAnchor constraintEqualToConstant:25].active = YES;

//glyphView.frame = CGRectMake(20.5,18.5 + y,40,40);
@@ -126,18 +150,11 @@ long long lastPercentage;
//battery.frame = CGRectMake(self.superview.bounds.size.width - 16 - 49,35 + y,20,10);

battery.translatesAutoresizingMaskIntoConstraints = NO;
[battery.leftAnchor constraintEqualToAnchor:self.rightAnchor constant:(- 49)].active = YES;
[battery.leftAnchor constraintEqualToAnchor:blank.rightAnchor constant:(- 49)].active = YES;
[battery.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES;
[battery.widthAnchor constraintEqualToConstant:20].active = YES;
[battery.heightAnchor constraintEqualToConstant:10].active = YES;

//percentLabel.frame = CGRectMake(self.superview.bounds.size.width - 16 - 94,35 + y,36,12);
percentLabel.translatesAutoresizingMaskIntoConstraints = NO;
[percentLabel.leftAnchor constraintEqualToAnchor:self.rightAnchor constant:(- 94)].active = YES;
[percentLabel.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES;
[percentLabel.widthAnchor constraintEqualToConstant:36].active = YES;
[percentLabel.heightAnchor constraintEqualToConstant:12].active = YES;

y+=bannerHeight + spacing;
self.number +=1;
//blank.alpha = 0.8;
@@ -145,7 +162,6 @@ long long lastPercentage;
}
//[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;
self.isUpdating = NO;
[self darkLightMode];
}
});
}
@@ -154,17 +170,4 @@ long long lastPercentage;
return instance;
}

-(void)darkLightMode {
/*for(UIVisualEffectView *view in self.subviews) {
if(@available(iOS 12.0, *)) {
if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
if([view respondsToSelector:@selector(setEffect:)]) view.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
}
else {
if([view respondsToSelector:@selector(setEffect:)]) view.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
}
}
}*/
}

@end

+ 30
- 0
Kai.h View File

@@ -40,14 +40,21 @@
@property (nonatomic, assign) BOOL continuousCorners;
@end

BOOL isUpdating = NO;

//prefs
BOOL enabled;
BOOL disableGlyphs;
BOOL hidePercent;
BOOL showAll;
BOOL hideDeviceLabel;
NSInteger bannerStyle;
NSInteger bannerAlign;
double spacing;
double glyphSize;
double bannerHeight;
double cornerRadius;
double bannerWidthFactor;

#import "KAIBattery.mm"

@@ -104,8 +111,31 @@ static void preferencesChanged()
cornerRadius = numberForValue(@"cornerRadius", 13);
disableGlyphs = boolValueForKey(@"disableGlyphs", NO);
hidePercent = boolValueForKey(@"hidePercent", NO);
bannerStyle = numberForValue(@"bannerStyle", 1);
showAll = boolValueForKey(@"showAll", NO);
bannerWidthFactor = numberForValue(@"bannerWidthFactor", 0);
hideDeviceLabel = boolValueForKey(@"hideDeviceLabel", NO);
bannerAlign = numberForValue(@"bannerAlign", 2);

if(disableGlyphs) {
glyphSize = 0;
}
}

static void applyPrefs()
{
preferencesChanged();
isUpdating = YES;
[UIView animateWithDuration:0.3 animations:^{
[KAIBattery sharedInstance].alpha = 0;
} completion:^(BOOL finished){
[[KAIBattery sharedInstance] updateBattery];
[(CSAdjunctListView *)([KAIBattery sharedInstance].superview.superview) KaiUpdate];
[UIView animateWithDuration:0.35 animations:^{
[KAIBattery sharedInstance].alpha = 1;
} completion:^(BOOL finished){
isUpdating = NO;
}];
}];

}

+ 23
- 15
Kai.xm View File

@@ -1,6 +1,5 @@
#import "Kai.h"


%hook KAITarget
%property (nonatomic, assign) BOOL hasKai;

@@ -22,7 +21,6 @@
name:@"KaiInfoChanged"
object:nil];
KAISelf.hasKai = YES;
[[KAIBattery sharedInstance] darkLightMode];

UIStackView *newView = arg1;

@@ -37,7 +35,6 @@

%new
-(void)KaiUpdate {
[[KAIBattery sharedInstance] darkLightMode];
KAIBattery *battery = [KAIBattery sharedInstance];

[UIView animateWithDuration:0.3 animations:^{
@@ -50,7 +47,7 @@
battery.heightConstraint.active = YES;

} else {
int height = (battery.number * (80 + spacing));
int height = (battery.number * (bannerHeight + spacing));
battery.heightConstraint.active = NO;
NSLog(@"kai: setting to %d", height);
battery.heightConstraint.constant = height;
@@ -66,17 +63,20 @@

%new
-(void)KaiInfo {
[UIView animateWithDuration:0.3 animations:^{
[KAIBattery sharedInstance].alpha = 0;
} completion:^(BOOL finished){
[[KAIBattery sharedInstance] updateBattery];
[self KaiUpdate];
[UIView animateWithDuration:0.35 animations:^{
[KAIBattery sharedInstance].alpha = 1;
if(!isUpdating) {
isUpdating = YES;
[UIView animateWithDuration:0.3 animations:^{
[KAIBattery sharedInstance].alpha = 0;
} completion:^(BOOL finished){
[[KAIBattery sharedInstance] updateBattery];
[self KaiUpdate];
[UIView animateWithDuration:0.35 animations:^{
[KAIBattery sharedInstance].alpha = 1;
} completion:^(BOOL finished){
isUpdating = NO;
}];
}];
}];
[[KAIBattery sharedInstance] updateBattery];
[self KaiUpdate];
}
}
%end

@@ -86,7 +86,7 @@
- (id)initWithIdentifier:(id)arg1 vendor:(long long)arg2 productIdentifier:(long long)arg3 parts:(unsigned long long)arg4 matchIdentifier:(id)arg5 {

[self addObserver:self forKeyPath:@"charging" options:NSKeyValueObservingOptionNew context:nil];
[self addObserver:self forKeyPath:@"powerSourceState" options:NSKeyValueObservingOptionNew context:nil];
//[self addObserver:self forKeyPath:@"powerSourceState" options:NSKeyValueObservingOptionNew context:nil];
[self addObserver:self forKeyPath:@"batterySaverModeActive" options:NSKeyValueObservingOptionNew context:nil];
[self addObserver:self forKeyPath:@"percentCharge" options:NSKeyValueObservingOptionNew context:nil];

@@ -120,6 +120,14 @@

%ctor {
preferencesChanged();
CFNotificationCenterAddObserver(
CFNotificationCenterGetDarwinNotifyCenter(),
&observer,
(CFNotificationCallback)applyPrefs,
kSettingsChangedNotification,
NULL,
CFNotificationSuspensionBehaviorDeliverImmediately
);
Class cls = kCFCoreFoundationVersionNumber > 1600 ? ([objc_getClass("CSAdjunctListView") class]) : ([objc_getClass("SBDashBoardAdjunctListView") class]);
if(enabled) {
%init(KAITarget = cls);

+ 181
- 0
build.ninja View File

@@ -0,0 +1,181 @@
name = kai
lowername = kai

# Build file for kai
# Generated at 05/20/20 13:44:10

pdirname = .dragon

location = /Library/MobileSubstrate/DynamicLibraries/
resource_dir = Resources
target = $pdirname/_$location$name.dylib

stage2 = cp $name.plist $
.dragon/_/Library/MobileSubstrate/DynamicLibraries/$name.plist

builddir = $pdirname/build
objdir = $pdirname/obj
signdir = $pdirname/sign
signtarget = $signdir/$target.unsigned
symtarget = $signdir/$target.unsym

dragondir = $$DRAGONBUILD
pwd = .
sysroot = $dragondir/sdks/iPhoneOS.sdk

fwSearch = -F$sysroot/System/Library/Frameworks $
-F$sysroot/System/Library/PrivateFrameworks -F$dragondir/frameworks
libSearch = -L$dragondir/lib -L.

cc = clang++
ccpp = clang++
ld = clang++
ldid = ldid
dsym = dsymutil
logos = $dragondir/bin/logos.pl
plutil = plutil
stage = true;

targetios = 10.0

frameworks = -framework BatteryCenter -framework CoreFoundation -framework $
Foundation -framework UIKit -framework CoreGraphics -framework $
QuartzCore -framework CoreImage -framework AudioToolbox

libs = -lsubstrate -lobjc -lc++

arc = -fobjc-arc
btarg = -DTARGET_IPHONE=1
warnings = -Wall
optim = -O0
debug = -fcolor-diagnostics

header_includes =
cinclude = -I$dragondir/include -I$dragondir/vendor/include $
-I$dragondir/include/_fallback -I$DRAGONBUILD/headers/ -I$pwd

usrCflags =
usrLDflags =
usrLDIDFlags = -S

lopt = -dynamiclib -ggdb -Xlinker -segalign -Xlinker 4000
typeldflags = -install_name $location$name

cflags = $cinclude -fmodules -fcxx-modules -fmodule-name=$name $
-fbuild-session-file=.dragon/modules/ -fmodules-prune-after=345600 $
-fmodules-prune-interval=86400 $
-fmodules-validate-once-per-build-session $arc $fwSearch $
-miphoneos-version-min=$targetios -isysroot $sysroot $btarg $warnings $
$optim $debug $usrCflags $header_includes

lflags = $cflags $typeldflags $frameworks $libs $lopt $libSearch $usrLDflags

ldflags = $usrLDFlags

pool solo
depth = 1

rule prelogos
command = cat $in | python3 $$DRAGONBUILD/bin/prelogos.py > $out
description = Processing $in with Pre/Logos

rule logos
command = $logos $in > $out
description = Processing $in with Logos

rule compilearm64
command = $cc -arch arm64 $cflags -c $in -o $out
description = Compiling $in for arm64

rule compilexxarm64
command = $cxx -arch arm64 $cflags -c $in -o $out
description = Compiling $in for arm64

rule linkarm64
command = $ld -arch arm64 $lflags -o $out $in
description = Linking $name for arm64

rule compilearm64e
command = $cc -arch arm64e $cflags -c $in -o $out
description = Compiling $in for arm64e

rule compilexxarm64e
command = $cxx -arch arm64e $cflags -c $in -o $out
description = Compiling $in for arm64e

rule linkarm64e
command = $ld -arch arm64e $lflags -o $out $in
description = Linking $name for arm64e

rule compilearmv7
command = $cc -arch armv7 $cflags -c $in -o $out
description = Compiling $in for armv7

rule compilexxarmv7
command = $cxx -arch armv7 $cflags -c $in -o $out
description = Compiling $in for armv7

rule linkarmv7
command = $ld -arch armv7 $lflags -o $out $in
description = Linking $name for armv7

rule compilex86_64
command = $cc -arch x86_64 $cflags -c $in -o $out
description = Compiling $in for x86_64

rule compilexxx86_64
command = $cxx -arch x86_64 $cflags -c $in -o $out
description = Compiling $in for x86_64

rule linkx86_64
command = $ld -arch x86_64 $lflags -o $out $in
description = Linking $name for x86_64

rule lipo
command = lipo -create $in -output $out
description = Merging architectures

rule bundle
command = mkdir -p ".dragon/_$location/" && cp -r "$resource_dir/" $
".dragon/_$location" && cp $in $out
description = Copying Bundle Resources
pool = solo

rule plist
command = $plutil -convert binary1 $in -o $out
description = Converting $in

rule debug
command = $dsym "$in" 2&> /dev/null; cp $in $out
description = Generating Debug Symbols for $name

rule sign
command = $ldid $usrLDIDFlags $in && cp $in $target
description = Signing $name

rule stage
command = $stage $stage2
description = Running Stage for $name

build $builddir/logos/Kai.xm.mm: logos Kai.xm

build $builddir/armv7/Kai.xm.mm.o: compilearmv7 $builddir/logos/Kai.xm.mm

build $builddir/$name.armv7: linkarmv7 $builddir/armv7/Kai.xm.mm.o
build $builddir/arm64/Kai.xm.mm.o: compilearm64 $builddir/logos/Kai.xm.mm

build $builddir/$name.arm64: linkarm64 $builddir/arm64/Kai.xm.mm.o
build $builddir/arm64e/Kai.xm.mm.o: compilearm64e $builddir/logos/Kai.xm.mm

build $builddir/$name.arm64e: linkarm64e $builddir/arm64e/Kai.xm.mm.o
build $builddir/trash/stage: stage $target

build $symtarget: lipo $builddir/$name.armv7 $builddir/$name.arm64 $
$builddir/$name.arm64e

build $signtarget: debug $symtarget

build $target: sign $signtarget

default $target $builddir/trash/stage


+ 7
- 17
kaiprefs/KAIRootListController.m View File

@@ -35,7 +35,7 @@ NSBundle *tweakBundle;
-(void)viewDidLoad {
[super viewDidLoad];

UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Respring" style:UIBarButtonItemStylePlain target:self action:@selector(respring:)];
UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Apply" style:UIBarButtonItemStylePlain target:self action:@selector(respring:)];
self.navigationItem.rightBarButtonItem = applyButton;

self.navigationItem.titleView = [UIView new];
@@ -67,26 +67,16 @@ NSBundle *tweakBundle;
}

-(void)respring:(id)sender {
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.burritoz.kaiprefs/reload"), nil, nil, true);

tweakBundle = [NSBundle bundleWithPath:@"/Library/PreferenceBundles/MultiplaPrefs.bundle"];
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Kai"
message:@"Your settings have been applied. You can now go back to your lockscreen (CoverSheet) to see the changes."
preferredStyle:UIAlertControllerStyleAlert];

UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Respring"
message:@"Are you sure you want to respring now?"
preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Amazing!" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];

UIAlertAction* yes = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * action) {
NSTask *t = [[NSTask alloc] init];
[t setLaunchPath:@"usr/bin/killall"];
[t setArguments:[NSArray arrayWithObjects:@"backboardd", nil]];
[t launch];
}];

[alert addAction:defaultAction];
[alert addAction:yes];
[self presentViewController:alert animated:YES completion:nil];
}


+ 108
- 4
kaiprefs/Resources/Root.plist View File

@@ -28,6 +28,18 @@
<key>cell</key>
<string>PSGroupCell</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.burritoz.kaiprefs</string>
<key>key</key>
<string>showAll</string>
<key>label</key>
<string>Show all devices</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
@@ -52,6 +64,74 @@
<key>label</key>
<string>Hide Percent Label</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.burritoz.kaiprefs</string>
<key>key</key>
<string>hideDeviceLabel</string>
<key>label</key>
<string>Hide Device Name Label</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Banner Style</string>
</dict>
<dict>
<key>cell</key>
<string>PSSegmentCell</string>
<key>defaults</key>
<string>com.burritoz.kaiprefs</string>
<key>default</key>
<string>1</string>
<key>key</key>
<string>bannerStyle</string>
<key>validValues</key>
<array>
<string>1</string>
<string>2</string>
<string>3</string>
</array>
<key>validTitles</key>
<array>
<string>Automatic</string>
<string>Dark</string>
<string>Light</string>
</array>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Banner Alignment</string>
</dict>
<dict>
<key>cell</key>
<string>PSSegmentCell</string>
<key>defaults</key>
<string>com.burritoz.kaiprefs</string>
<key>default</key>
<string>2</string>
<key>key</key>
<string>bannerAlign</string>
<key>validValues</key>
<array>
<string>1</string>
<string>2</string>
<string>3</string>
</array>
<key>validTitles</key>
<array>
<string>Left</string>
<string>Center</string>
<string>Right</string>
</array>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
@@ -66,7 +146,7 @@
<key>min</key>
<real>20</real>
<key>max</key>
<real>200</real>
<real>400</real>
<key>isSegmented</key>
<false/>
<key>showValue</key>
@@ -76,6 +156,30 @@
<key>key</key>
<string>bannerHeight</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Banner Width Adjustment (0)</string>
</dict>
<dict>
<key>default</key>
<real>0</real>
<key>cell</key>
<string>PSSliderCell</string>
<key>min</key>
<real>-400</real>
<key>max</key>
<real>400</real>
<key>isSegmented</key>
<false/>
<key>showValue</key>
<true/>
<key>defaults</key>
<string>com.burritoz.kaiprefs</string>
<key>key</key>
<string>bannerWidthFactor</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
@@ -88,9 +192,9 @@
<key>cell</key>
<string>PSSliderCell</string>
<key>min</key>
<real>0.0</real>
<real>-100.0</real>
<key>max</key>
<real>100</real>
<real>300</real>
<key>isSegmented</key>
<false/>
<key>showValue</key>
@@ -136,7 +240,7 @@
<key>cell</key>
<string>PSSliderCell</string>
<key>min</key>
<real>0.1</real>
<real>0.0</real>
<key>max</key>
<real>100</real>
<key>isSegmented</key>

+ 181
- 0
kaiprefs/build.ninja View File

@@ -0,0 +1,181 @@
name = kaiPrefs
lowername = kaiprefs

# Build file for kaiPrefs
# Generated at 05/20/20 13:44:10

pdirname = .dragon

location = /Library/PreferenceBundles/$name.bundle/
resource_dir = Resources
target = $pdirname/_$location$name

stage2 =

builddir = $pdirname/build
objdir = $pdirname/obj
signdir = $pdirname/sign
signtarget = $signdir/$target.unsigned
symtarget = $signdir/$target.unsym

dragondir = $$DRAGONBUILD
pwd = .
sysroot = $dragondir/sdks/iPhoneOS.sdk

fwSearch = -F$sysroot/System/Library/Frameworks $
-F$sysroot/System/Library/PrivateFrameworks -F$dragondir/frameworks
libSearch = -L$dragondir/lib -L.

cc = clang++
ccpp = clang++
ld = clang++
ldid = ldid
dsym = dsymutil
logos = $dragondir/bin/logos.pl
plutil = plutil
stage = mkdir -p .dragon/_/Library/PreferenceLoader/Preferences/ && cp $
entry.plist .dragon/_/Library/PreferenceLoader/Preferences/$name.plist

targetios = 10.0

frameworks = -framework Preferences -framework CoreFoundation -framework $
Foundation -framework UIKit -framework CoreGraphics -framework $
QuartzCore -framework CoreImage -framework AudioToolbox

libs = -lobjc -lc++

arc = -fobjc-arc
btarg = -DTARGET_IPHONE=1
warnings = -Wall
optim = -O0
debug = -fcolor-diagnostics

header_includes =
cinclude = -I$dragondir/include -I$dragondir/vendor/include $
-I$dragondir/include/_fallback -I$DRAGONBUILD/headers/ -I$pwd

usrCflags =
usrLDflags =
usrLDIDFlags = -S

lopt = -dynamiclib -ggdb -Xlinker -segalign -Xlinker 4000
typeldflags = -install_name $location$name

cflags = $cinclude -fmodules -fcxx-modules -fmodule-name=$name $
-fbuild-session-file=.dragon/modules/ -fmodules-prune-after=345600 $
-fmodules-prune-interval=86400 $
-fmodules-validate-once-per-build-session $arc $fwSearch $
-miphoneos-version-min=$targetios -isysroot $sysroot $btarg $warnings $
$optim $debug $usrCflags $header_includes

lflags = $cflags $typeldflags $frameworks $libs $lopt $libSearch $usrLDflags

ldflags = $usrLDFlags

pool solo
depth = 1

rule prelogos
command = cat $in | python3 $$DRAGONBUILD/bin/prelogos.py > $out
description = Processing $in with Pre/Logos

rule logos
command = $logos $in > $out
description = Processing $in with Logos

rule compilearm64
command = $cc -arch arm64 $cflags -c $in -o $out
description = Compiling $in for arm64

rule compilexxarm64
command = $cxx -arch arm64 $cflags -c $in -o $out
description = Compiling $in for arm64

rule linkarm64
command = $ld -arch arm64 $lflags -o $out $in
description = Linking $name for arm64

rule compilearm64e
command = $cc -arch arm64e $cflags -c $in -o $out
description = Compiling $in for arm64e

rule compilexxarm64e
command = $cxx -arch arm64e $cflags -c $in -o $out
description = Compiling $in for arm64e

rule linkarm64e
command = $ld -arch arm64e $lflags -o $out $in
description = Linking $name for arm64e

rule compilearmv7
command = $cc -arch armv7 $cflags -c $in -o $out
description = Compiling $in for armv7

rule compilexxarmv7
command = $cxx -arch armv7 $cflags -c $in -o $out
description = Compiling $in for armv7

rule linkarmv7
command = $ld -arch armv7 $lflags -o $out $in
description = Linking $name for armv7

rule compilex86_64
command = $cc -arch x86_64 $cflags -c $in -o $out
description = Compiling $in for x86_64

rule compilexxx86_64
command = $cxx -arch x86_64 $cflags -c $in -o $out
description = Compiling $in for x86_64

rule linkx86_64
command = $ld -arch x86_64 $lflags -o $out $in
description = Linking $name for x86_64

rule lipo
command = lipo -create $in -output $out
description = Merging architectures

rule bundle
command = mkdir -p ".dragon/_$location/" && cp -r "$resource_dir/" $
".dragon/_$location" && cp $in $out
description = Copying Bundle Resources
pool = solo

rule plist
command = $plutil -convert binary1 $in -o $out
description = Converting $in

rule debug
command = $dsym "$in" 2&> /dev/null; cp $in $out
description = Generating Debug Symbols for $name

rule sign
command = $ldid $usrLDIDFlags $in && cp $in $target
description = Signing $name

rule stage
command = $stage $stage2
description = Running Stage for $name

build $builddir/arm64/KAIRootListController.m.o: compilearm64 $
KAIRootListController.m

build $builddir/$name.arm64: linkarm64 $
$builddir/arm64/KAIRootListController.m.o
build $builddir/arm64e/KAIRootListController.m.o: compilearm64e $
KAIRootListController.m

build $builddir/$name.arm64e: linkarm64e $
$builddir/arm64e/KAIRootListController.m.o
build $builddir/trash/bundles: bundle build.ninja

build $builddir/trash/stage: stage $target

build $symtarget: lipo $builddir/$name.arm64 $builddir/$name.arm64e

build $signtarget: debug $symtarget

build $target: sign $signtarget

default $target $builddir/trash/bundles $builddir/trash/stage


Loading…
Cancel
Save