diff --git a/src/dragon/config/types.yml b/src/dragon/config/types.yml index 51f70cc6e..8e583f2e3 100644 --- a/src/dragon/config/types.yml +++ b/src/dragon/config/types.yml @@ -4,17 +4,23 @@ Types: app: variables: install_location: '/Applications/' - target: '$dragon_data_dir/$stagedir/$location/$name.app/$name' + build_target_file: '$dragon_data_dir/$stagedir/$location/$name.app/$name' + stage2: + - 'cp -R Resources/* $dragon_data_dir/$stagedir/$location/$name.app/' application: variables: install_location: '/Applications/' - target: '$dragon_data_dir/$stagedir/$location/$name.app/$name' + build_target_file: '$dragon_data_dir/$stagedir/$location/$name.app/$name' + stage2: + - 'cp -R Resources/* $dragon_data_dir/$stagedir/$location/$name.app/' tweak-jailed: variables: install_location: '/Applications/' - target: '$dragon_data_dir/$stagedir/$location/$name.app/$name' + build_target_file: '$dragon_data_dir/$stagedir/$location/$name.app/$name' embed-libs: - CydiaSubstrate + stage2: + - 'cp -R Resources/* $dragon_data_dir/$stagedir/$location/$name.app/' tweak: variables: install_location: '/Library/MobileSubstrate/DynamicLibraries/' @@ -38,7 +44,7 @@ Types: stage2: - 'mkdir -p $dragon_data_dir/_/Library/PreferenceLoader/Preferences/' - 'cp entry.plist $dragon_data_dir/_/Library/PreferenceLoader/Preferences/$name.plist 2> /dev/null' - - 'cp -R Resources/ $dragon_data_dir/$stagedir/$location' + - 'cp -R Resources/* $dragon_data_dir/$stagedir/$location' bundle: variables: install_location: '/Library/$name/' @@ -49,7 +55,12 @@ Types: - UIKit stage2: - 'cp -R Resources/ $dragon_data_dir/$stagedir/$location/$name.bundle/' - + resource-bundle: + variables: + install_location: '/Library/$name/$name.bundle/' + build_target_file: 'build.ninja' + stage2: + - 'true;' framework: variables: install_location: '/Library/Frameworks/$name.framework' @@ -60,32 +71,12 @@ Types: frameworks: - Foundation stage2: - - 'cp -R Resources/ $dragon_data_dir/$stagedir/$location' + - 'cp -R Resources/* $dragon_data_dir/$stagedir/$location' - 'cp -R $dragon_data_dir/$stagedir$location $dragon_root_dir/frameworks/$name.framework' - 'if ! [ -z "$public_headers" ]; then mkdir -p $dragon_data_dir/$stagedir/$location/Headers; cp $public_headers $dragon_data_dir/$stagedir/$location/Headers; fi' - resource-bundle: - variables: - install_location: '/Library/$name/$name.bundle/' - build_target_file: 'build.ninja' - stage2: - - 'true;' - stage: - variables: - build_target_file: 'build.ninja' - stage2: - - 'true;' - library: - variables: - install_location: '/usr/lib' - build_target_file: '$dragon_data_dir/$stagedir/$location/$name.dylib' - ldflags: '-install_name $location$name.dylib' - lopts: '-dynamiclib -ggdb' - ldflags: '-install_name @rpath/$name.dylib' - stage2: - - 'true;' cli: variables: install_location: '/usr/bin' @@ -101,15 +92,26 @@ Types: tool: variables: install_location: '/usr/bin' - lopts: '' build_target_file: '$dragon_data_dir/$stagedir/$location/$name' stage2: - 'true;' + library: + variables: + install_location: '/usr/lib' + build_target_file: '$dragon_data_dir/$stagedir/$location/$name.dylib' + ldflags: '-install_name @rpath/$name.dylib' + lopts: '-dynamiclib -ggdb' + stage2: + - 'true;' static: variables: install_location: '/usr/lib' - lopts: '' build_target_file: '$dragon_data_dir/$stagedir/$location/$name.a' stage2: - 'true;' + stage: + variables: + build_target_file: 'build.ninja' + stage2: + - 'true;' raw: diff --git a/src/dragon/editor.py b/src/dragon/editor.py index 92fe7b4e7..29fcda362 100644 --- a/src/dragon/editor.py +++ b/src/dragon/editor.py @@ -337,6 +337,16 @@ def get_from_selector(prompt, values, default): // Don’t forget to also add them to {} in your Makefile! """ +CLI_ents_plist = """ + + + platform-application + + com.apple.private.security.container-required + + + +""" class Project: def __init__(self, root_directory): @@ -403,6 +413,13 @@ def _new_for_type(self, type, proj_root): self.variables['files'] = [f'{self.name}.x'] with open(f'{self.name}.x', 'w') as out: out.write('// Insert your code here!\n') + elif type == 'cli': + self.variables['entfile'] = 'ents.plist' + with open('ents.plist', 'w') as out: + out.write(CLI_ents_plist) + self.variables['files'] = [f'{self.name}.m'] + with open(f'{self.name}.m', 'w') as out: + out.write('// Insert your code here!\n') elif type == 'framework': if not os.path.exists('Resources'): os.mkdir('Resources') diff --git a/src/dragon/shscripts/building b/src/dragon/shscripts/building index ed663e1e9..90ad7e6ba 100644 --- a/src/dragon/shscripts/building +++ b/src/dragon/shscripts/building @@ -69,7 +69,7 @@ build() ninja -t compdb > compile_commands.json fi - cp -R layout/* $DRAGON_DIR/_/ 2>/dev/null + cp -R $projroot/layout/* layout/* $DRAGON_DIR/_/ 2>/dev/null # mv build.ninja $DRAGON_DIR/ninja # Was this renamed "ninja" for use elsewhere? mv build.ninja $DRAGON_DIR/build.ninja diff --git a/src/dragongen/generation.py b/src/dragongen/generation.py index 1a6ed3122..77c843bc6 100644 --- a/src/dragongen/generation.py +++ b/src/dragongen/generation.py @@ -344,16 +344,16 @@ def rules_and_build_statements(self) -> (list, list): arch_specific_object_files)) build_state.extend([ - # lipo if needed, else use a dummy rule to rename it to what the next rule expects - # the dummy rule could be optimized out, but its probably more developmentally clear + # lipo if needed, else use a copy rule to rename it to what the next rule expects + # the copy rule could be optimized out, but its probably more developmentally clear # to have it there anyways /shrug Build('$internalsymtarget', - 'lipo' if len(self.project_variables['archs']) > 1 else 'dummy', + 'lipo' if len(self.project_variables['archs']) > 1 else 'copy', [f'$builddir/$name.{a}' for a in self.project_variables['archs']]), # Debug symbols Build('$internalsigntarget', 'debug', '$internalsymtarget'), # Codesign - Build('$build_target_file', 'sign', '$internalsigntarget'), + Build('$build_target_file', 'dummy' if self.project_variables['type'] == 'static' else 'sign', '$internalsigntarget'), # Stage commands (these are actually ran at a different point in the 'runner') Build('stage', 'stage', 'build.ninja'), ]) @@ -361,6 +361,13 @@ def rules_and_build_statements(self) -> (list, list): # Fix used_rules, TODO: maybe this could be optimized elsewhere? if len(self.project_variables['archs']) <= 1: used_rules.remove("lipo") + used_rules.add("copy") + + if self.project_variables['type'] == 'static': + # use a dummy rule to rename it to what the next rule expects + # the dummy rule could be optimized out, but its probably more developmentally clear + # to have it there anyways /shrug + used_rules.remove("sign") used_rules.add("dummy") rule_list.extend(get_generic_rule(r) for r in used_rules)