From a8913e2edc31aa7dc0e794891b3fcc5c5c3c7afd Mon Sep 17 00:00:00 2001 From: Burrit0z Date: Wed, 20 May 2020 13:44:20 -0400 Subject: [PATCH] alpha 0.1.0 --- KAIBattery.h | 1 - KAIBattery.mm | 79 +++++++------- Kai.h | 30 +++++ Kai.xm | 38 ++++--- build.ninja | 181 +++++++++++++++++++++++++++++++ kaiprefs/KAIRootListController.m | 24 ++-- kaiprefs/Resources/Root.plist | 112 ++++++++++++++++++- kaiprefs/build.ninja | 181 +++++++++++++++++++++++++++++++ 8 files changed, 571 insertions(+), 75 deletions(-) create mode 100644 build.ninja create mode 100644 kaiprefs/build.ninja diff --git a/KAIBattery.h b/KAIBattery.h index df5c83f..5c823ea 100644 --- a/KAIBattery.h +++ b/KAIBattery.h @@ -32,7 +32,6 @@ @property (nonatomic, strong) NSLayoutConstraint *heightConstraint; @property (nonatomic, assign) BOOL isUpdating; +(KAIBattery *)sharedInstance; --(void)darkLightMode; -(instancetype)init; -(void)updateBattery; @end \ No newline at end of file diff --git a/KAIBattery.mm b/KAIBattery.mm index 6d5f75b..fb43d1d 100644 --- a/KAIBattery.mm +++ b/KAIBattery.mm @@ -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(device, "_charging"); BOOL LPM = MSHookIvar(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 \ No newline at end of file diff --git a/Kai.h b/Kai.h index aea5006..4375804 100644 --- a/Kai.h +++ b/Kai.h @@ -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; + }]; + }]; + } \ No newline at end of file diff --git a/Kai.xm b/Kai.xm index b94aab5..9f19908 100644 --- a/Kai.xm +++ b/Kai.xm @@ -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); diff --git a/build.ninja b/build.ninja new file mode 100644 index 0000000..a160c27 --- /dev/null +++ b/build.ninja @@ -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 + diff --git a/kaiprefs/KAIRootListController.m b/kaiprefs/KAIRootListController.m index 0c2260c..f0aad49 100644 --- a/kaiprefs/KAIRootListController.m +++ b/kaiprefs/KAIRootListController.m @@ -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]; } diff --git a/kaiprefs/Resources/Root.plist b/kaiprefs/Resources/Root.plist index 16ab7f5..468c2fe 100644 --- a/kaiprefs/Resources/Root.plist +++ b/kaiprefs/Resources/Root.plist @@ -28,6 +28,18 @@ cell PSGroupCell + + cell + PSSwitchCell + default + + defaults + com.burritoz.kaiprefs + key + showAll + label + Show all devices + cell PSSwitchCell @@ -52,6 +64,74 @@ label Hide Percent Label + + cell + PSSwitchCell + default + + defaults + com.burritoz.kaiprefs + key + hideDeviceLabel + label + Hide Device Name Label + + + cell + PSGroupCell + label + Banner Style + + + cell + PSSegmentCell + defaults + com.burritoz.kaiprefs + default + 1 + key + bannerStyle + validValues + + 1 + 2 + 3 + + validTitles + + Automatic + Dark + Light + + + + cell + PSGroupCell + label + Banner Alignment + + + cell + PSSegmentCell + defaults + com.burritoz.kaiprefs + default + 2 + key + bannerAlign + validValues + + 1 + 2 + 3 + + validTitles + + Left + Center + Right + + cell PSGroupCell @@ -66,7 +146,7 @@ min 20 max - 200 + 400 isSegmented showValue @@ -76,6 +156,30 @@ key bannerHeight + + cell + PSGroupCell + label + Banner Width Adjustment (0) + + + default + 0 + cell + PSSliderCell + min + -400 + max + 400 + isSegmented + + showValue + + defaults + com.burritoz.kaiprefs + key + bannerWidthFactor + cell PSGroupCell @@ -88,9 +192,9 @@ cell PSSliderCell min - 0.0 + -100.0 max - 100 + 300 isSegmented showValue @@ -136,7 +240,7 @@ cell PSSliderCell min - 0.1 + 0.0 max 100 isSegmented diff --git a/kaiprefs/build.ninja b/kaiprefs/build.ninja new file mode 100644 index 0000000..cf8ec01 --- /dev/null +++ b/kaiprefs/build.ninja @@ -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 +