├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── feature_request.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── update-submodules.yml ├── .gitignore ├── .gitmodules ├── CODE_OF_CONDUCT.md ├── LICENSE.md ├── Prefix.pch ├── README.md ├── bin ├── convert_xml_plist.sh ├── deb_build_num.sh ├── denicify.pl ├── dm.pl ├── fakeroot.sh ├── gen-commands.pl ├── install-theos ├── install.copyFile ├── install.exec ├── install.mergeDir ├── logify.pl ├── logos.pl ├── nic.pl ├── nicify.pl ├── package_version.sh ├── post-update ├── swift-bootstrapper.pl ├── update-git-repo └── update-theos ├── extras └── ci │ ├── common.sh │ ├── cygwin-install.cmd │ ├── cygwin-setup.sh │ ├── macos-setup.sh │ └── test-github-projects.sh ├── include └── .keep ├── lib └── .keep ├── makefiles ├── aggregate.mk ├── appex.mk ├── application.mk ├── bundle.mk ├── common.mk ├── framework.mk ├── install │ ├── deb_local.mk │ ├── deb_remote.mk │ ├── none_local.mk │ ├── none_remote.mk │ ├── pkg_local.mk │ ├── pkg_remote.mk │ ├── rpm_local.mk │ └── rpm_remote.mk ├── instance │ ├── appex.mk │ ├── application.mk │ ├── bundle.mk │ ├── framework.mk │ ├── library.mk │ ├── null.mk │ ├── rules.mk │ ├── shared │ │ └── bundle.mk │ ├── simbltweak.mk │ ├── subproject.mk │ ├── tool.mk │ ├── tweak.mk │ └── xcodeproj.mk ├── legacy.mk ├── library.mk ├── master │ ├── aggregate.mk │ ├── appex.mk │ ├── application.mk │ ├── bundle.mk │ ├── framework.mk │ ├── library.mk │ ├── null.mk │ ├── rules.mk │ ├── simbltweak.mk │ ├── subproject.mk │ ├── tool.mk │ ├── tweak.mk │ └── xcodeproj.mk ├── messages.mk ├── null.mk ├── package.mk ├── package │ ├── deb.mk │ ├── ipa.mk │ ├── none.mk │ ├── pkg.mk │ └── rpm.mk ├── platform │ ├── Cygwin.mk │ ├── Darwin.mk │ ├── FreeBSD.mk │ ├── Linux.mk │ └── Windows.mk ├── rules.mk ├── simbltweak.mk ├── stage.mk ├── subproject.mk ├── target.mk ├── targets │ ├── Cygwin │ ├── Darwin │ │ ├── appletv.mk │ │ ├── appletv_simulator.mk │ │ ├── iphone.mk │ │ ├── macosx.mk │ │ ├── native.mk │ │ ├── simulator.mk │ │ ├── watchos.mk │ │ └── watchos_simulator.mk │ ├── Linux │ │ ├── iphone.mk │ │ ├── linux.mk │ │ └── native.mk │ ├── Windows │ │ ├── cygwin.mk │ │ ├── iphone.mk │ │ └── native.mk │ └── _common │ │ ├── cygwin.mk │ │ ├── darwin_head.mk │ │ ├── darwin_tail.mk │ │ ├── iphone.mk │ │ └── linux.mk ├── tool.mk ├── tweak.mk ├── vercmp.mk └── xcodeproj.mk ├── mod └── .keep ├── package.json ├── sdks └── .keep ├── templates └── .keep ├── toolchain └── .keep └── vendor └── mod └── rootless ├── instance ├── framework.mk ├── library.mk └── rules.mk ├── package.mk └── package └── deb.mk /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Filing an Issue 2 | We always encourage users to report bugs as soon as they experience them. In order to keep everything organized here are some questions you should ask yourself before reporting: 3 | 4 | ## Common mistakes 5 | * Have you followed everything on ? 6 | * Have you set up your environment variables? Most importantly, `$THEOS` must be set or nothing will work. 7 | * Do you have an SDK and toolchain installed? If you're using OS X and building for iOS, OS X, Apple Watch, or Apple TV, Xcode provides both of these. 8 | * When you `git clone`d Theos, did you use `--recursive`? Theos uses Git submodules, so if you don't clone the submodules, you're missing a lot. Try running `make update-theos` from a Theos project. 9 | 10 | ## General issues 11 | * Are you using the latest version of Theos? Run `make update-theos` from a Theos project, then try again. 12 | * Has this issue been reported already? Please check the [list of open issues](https://github.com/theos/theos/issues). 13 | 14 | ## Advice 15 | If you're sure you've followed all instructions and haven't made any of the common mistakes listed above, here are some guidelines for creating an issue: 16 | 17 | * Is this an issue with Theos itself, or a compiler error, or are you looking for help with your code? The Theos issue tracker is for Theos issues only. Try the [GitHub Discussions tab](https://github.com/theos/theos/discussions), [Discord](https://theos.dev/discord), or [Reddit](https://www.reddit.com/r/jailbreakdevelopers). 18 | * When you ask a question, make sure it's not [an XY problem](http://xyproblem.info/). 19 | * Provide as much information as you possibly can. 20 | * Use `make troubleshoot` to quickly create a [Gist](https://gist.github.com/) paste containing the output of `make clean all messages=yes`. 21 | * Issues are formatted by [Markdown](https://guides.github.com/features/mastering-markdown/). If you paste code into your issue, it will probably end up appearing quite broken because it was interpreted as Markdown. Enclose blocks of code with three backticks (\`\`\`) at the start and end to make it a nicely formatted code block. 22 | 23 | ## In your issue, please: 24 | * List all operating system names and versions involved in the issue, as well as the toolchain, SDK version, and (if applicable) Xcode version. 25 | * List any other software name/version you think may be related. 26 | * Include any error messages you see. 27 | * List steps to reproduce. 28 | 29 | The more information you have, the better. Post as much as you can related to the issues to help us resolve it in a timely matter. If you have multiple issues, please file them as separate issues. This will help us sort them out efficiently. 30 | 31 | Don't ask a question not related to the topic of the current issue, especially if it's on someone else's issue. This is known as [thread hijacking](http://www.urbandictionary.com/define.php?term=Thread+Hijacking). You should create a new issue, or ask on another discussion forum. To contact a specific developer, find their GitHub profile and look for their email address, or Twitter, etc. 32 | 33 | Thanks! 34 | 35 | # Contribution Standards 36 | Don't be afraid to contribute to the development of Theos! Even if you don't think you've contributed much, it's still greatly appreciated. 37 | 38 | Please make sure you abide by these contribution standards so we can retain a high quality codebase and make it easy for everyone to understand and contribute to the code. 39 | 40 | * Follow all coding standards set by existing code in the repo. Using your own preferences over the established ones for the project just ends up making the code messy. 41 | * Use a commit message of the format `[component] Explanation of what changed.`. The component is typically a makefile name, or directory name. The first line of commit messages should not be longer than 70 characters. Any subsequent lines should not be longer than 80 characters. 42 | * An explanation of what the commit's changes do in your commit message is extremely useful. It helps people to more quickly understand what your code is doing. 43 | * When you submit a pull request, be willing to accept criticism. We don't criticise to make you feel bad - we want you to know where you may have made a mistake and this helps you grow as a developer. 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | What are the steps to reproduce this issue? 4 | ------------------------------------------- 5 | 1. … 6 | 2. … 7 | 3. … 8 | 9 | What happens? 10 | ------------- 11 | … 12 | 13 | What were you expecting to happen? 14 | ---------------------------------- 15 | … 16 | 17 | Any logs, error output, etc? 18 | ---------------------------- 19 | 20 | 21 | 22 | Any other comments? 23 | ------------------- 24 | … 25 | 26 | What versions of software are you using? 27 | ---------------------------------------- 28 | **Operating System:** … 29 | 30 | **Toolchain Version:** … 31 | 32 | **SDK Version:** … 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: "🐛 Bug Report" 2 | description: We broke something, again 3 | title: "[Bug]: " 4 | labels: ["needs triage"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | **Thanks for reporting an issue!** Please make sure you read our [issue guidelines](https://github.com/theos/theos/blob/master/.github/CONTRIBUTING.md) first, then fill out the fields below. 10 | 11 | If you’re unsure whether the issue you’re having is a bug, you can post in [Discussions](https://github.com/theos/theos/discussions) instead. 12 | 13 | - type: textarea 14 | id: bug-steps 15 | attributes: 16 | label: What are the steps to reproduce this issue? 17 | placeholder: | 18 | 1. Make new project 19 | 2. Run `make package` 20 | 3. … 21 | 4. See error 22 | validations: 23 | required: true 24 | 25 | - type: textarea 26 | id: bug-description 27 | attributes: 28 | label: What happens? 29 | description: A clear and concise description of what the bug is. 30 | validations: 31 | required: true 32 | 33 | - type: textarea 34 | id: bug-expectation 35 | attributes: 36 | label: What were you expecting to happen? 37 | description: A clear and concise description of what was supposed to happen. 38 | validations: 39 | required: true 40 | 41 | - type: textarea 42 | id: bug-logs 43 | attributes: 44 | label: Paste any relevant logs, error output, etc. 45 | description: | 46 | Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. 47 | (If it’s long, please paste to https://gist.github.com/ and insert the link here.) 48 | render: shell 49 | 50 | - type: textarea 51 | id: bug-context 52 | attributes: 53 | label: Additional context 54 | description: Add any other context you can provide about the problem here. 55 | 56 | - type: markdown 57 | attributes: 58 | value: | 59 | ---- 60 | 61 | # Details of your host machine (the device you’re running Theos on) 62 | 63 | - type: dropdown 64 | id: host-os 65 | attributes: 66 | label: What OS are you seeing the problem on? 67 | options: 68 | - iOS 69 | - macOS 70 | - Linux/WSL 71 | - Cygwin 72 | multiple: true 73 | validations: 74 | required: true 75 | 76 | - type: input 77 | id: host-os-version 78 | attributes: 79 | label: What OS version does it have installed? 80 | placeholder: "e.g. macOS 11.5.1" 81 | validations: 82 | required: true 83 | 84 | - type: input 85 | id: host-toolchain 86 | attributes: 87 | label: What toolchain and version are you using? 88 | description: | 89 | If your host machine is running macOS, specify the version of Xcode you’re using here. You can find out by selecting Xcode in Finder, then click File → Get Info. 90 | Otherwise, specify the toolchain you’re using – either the clang version number, or if you’re not sure, just specify where you downloaded it from. 91 | placeholder: "e.g. Xcode 12.5, or clang 12.0.5" 92 | validations: 93 | required: true 94 | 95 | - type: input 96 | id: host-sdk 97 | attributes: 98 | label: Which SDK version are you using? 99 | placeholder: "e.g. iOS 14.0" 100 | validations: 101 | required: true 102 | 103 | - type: markdown 104 | attributes: 105 | value: | 106 | ---- 107 | 108 | # Details of your client device (the device you’re attempting to run your code on) 109 | 110 | - type: dropdown 111 | id: client-os 112 | attributes: 113 | label: What OS is your client device running? 114 | options: 115 | - iOS 116 | - macOS 117 | - Linux/WSL 118 | - Cygwin 119 | multiple: true 120 | validations: 121 | required: true 122 | 123 | - type: input 124 | id: client-os-version 125 | attributes: 126 | label: What OS version does it have installed? 127 | placeholder: "e.g. iOS 14.0" 128 | validations: 129 | required: true 130 | 131 | - type: input 132 | id: client-model 133 | attributes: 134 | label: Which device model is it? 135 | placeholder: "e.g. iPhone X" 136 | validations: 137 | required: true 138 | 139 | - type: input 140 | id: client-jailbreak 141 | attributes: 142 | label: Which jailbreak is it using (if relevant)? 143 | placeholder: "e.g. checkra1n" 144 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | # https://github.com/babel/babel/blob/main/.github/ISSUE_TEMPLATE/feature_request.yml 2 | name: "🚀 Feature Request" 3 | description: "I have a specific suggestion for Theos!" 4 | labels: ["needs triage", "Enhancement"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | **Thanks for taking the time to suggest a new feature!** Please make sure you read our [issue guidelines](https://github.com/theos/theos/blob/master/.github/CONTRIBUTING.md) first, then fill out the fields below. 10 | 11 | If you feel an open-ended discussion with the community and Theos maintainers would be more suitable to forming the right details for your feature request, you can post in [Discussions](https://github.com/theos/theos/discussions) instead. 12 | 13 | - type: textarea 14 | attributes: 15 | label: What problem are you trying to solve? 16 | description: A concise description of what the problem is. 17 | placeholder: "e.g. I want to …" 18 | validations: 19 | required: true 20 | 21 | - type: textarea 22 | attributes: 23 | label: "Describe the solution you’d like" 24 | validations: 25 | required: true 26 | 27 | - type: textarea 28 | attributes: 29 | label: "Describe any alternatives you’ve considered" 30 | description: | 31 | Can Theos already do this, but in a less convenient way? 32 | Can you do this using other tools? 33 | Do other popular build systems, such as Xcode, have a feature for this? 34 | 35 | - type: textarea 36 | attributes: 37 | label: "Documentation, Adoption, Migration Strategy" 38 | description: | 39 | If you can, explain how users will be able to use this and how it might be documented. Maybe a mock-up? 40 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | What does this implement/fix? Explain your changes. 4 | --------------------------------------------------- 5 | … 6 | 7 | Does this close any currently open issues? 8 | ------------------------------------------ 9 | … 10 | 11 | 12 | Any relevant logs, error output, etc? 13 | ------------------------------------- 14 | 15 | 16 | Any other comments? 17 | ------------------- 18 | … 19 | 20 | Where has this been tested? 21 | --------------------------- 22 | **Operating System:** … 23 | 24 | **Platform:** … 25 | 26 | **Target Platform:** … 27 | 28 | **Toolchain Version:** … 29 | 30 | **SDK Version:** … 31 | -------------------------------------------------------------------------------- /.github/workflows/update-submodules.yml: -------------------------------------------------------------------------------- 1 | name: Update Theos Submodules 2 | 3 | on: 4 | workflow_dispatch: 5 | repository_dispatch: 6 | types: [org_push] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | token: ${{ secrets.UPDATE_SUBMODULES_TOKEN }} 16 | 17 | - name: Update submodules 18 | run: | 19 | git config --global user.name "$GITHUB_ACTOR" 20 | git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" 21 | git submodule update --remote --init --recursive 22 | git commit --all -m "[submodules] Update submodules to the latest commit" && git push || echo "No changes were made" 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bootstrap 2 | .DS_Store 3 | ._* 4 | 5 | sdks/* 6 | toolchain/* 7 | 8 | include/* 9 | lib/* 10 | templates/* 11 | mod/* 12 | !*/.keep 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/dm.pl"] 2 | path = vendor/dm.pl 3 | url = https://github.com/theos/dm.pl.git 4 | [submodule "vendor/include"] 5 | path = vendor/include 6 | url = https://github.com/theos/headers.git 7 | [submodule "vendor/lib"] 8 | path = vendor/lib 9 | url = https://github.com/theos/lib.git 10 | [submodule "vendor/logos"] 11 | path = vendor/logos 12 | url = https://github.com/theos/logos.git 13 | [submodule "vendor/nic"] 14 | path = vendor/nic 15 | url = https://github.com/theos/nic.git 16 | [submodule "vendor/templates"] 17 | path = vendor/templates 18 | url = https://github.com/theos/templates.git 19 | [submodule "vendor/swift-support"] 20 | path = vendor/swift-support 21 | url = https://github.com/theos/swift-support.git 22 | [submodule "vendor/orion"] 23 | path = vendor/orion 24 | url = https://github.com/theos/orion.git 25 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | support@theos.dev. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this prefix header are deprecated. Do not rely on any of the implicit 2 | // functionality provided by Prefix.pch, such as automatic import of UIKit, HBLog macro, 3 | // and other iOS-specific convenience macros. Rather, import things you need explicitly. 4 | // 5 | // For example: 6 | // #import 7 | // #import 8 | // 9 | // This header will no longer have any effect when used with the iOS 14 or newer SDK. It 10 | // has already been removed for other platforms, such as macOS and tvOS, and is not used 11 | // at all for Swift files. 12 | 13 | #ifdef DEBUG 14 | #define __DEBUG__ 15 | #endif 16 | 17 | #if __has_include() 18 | #import 19 | #endif 20 | 21 | #if !defined(__IPHONE_14_0) && !defined(THEOS_LEAN_AND_MEAN) 22 | #ifdef __OBJC__ 23 | #if __has_include() 24 | #import 25 | #endif 26 | #if TARGET_OS_IPHONE 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #endif 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | Theos 5 | 6 |

7 |

8 | A cross-platform build system for creating iOS,
9 | macOS, Linux, and Windows programs. 10 |

11 |

12 | Home – 13 | Installation – 14 | Documentation – 15 | Get Help – 16 | @theos@procursus.social – 17 | @theosdev – 18 | Discord 19 |

20 | 21 | ## Contributors 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |

kirb

uroboro

kabiroberai

DHowett

rpetrich
31 | 32 | Thanks to the following people for contributing to Theos in the past: 33 | [Aehmlo](https://github.com/Aehmlo), 34 | [akemin-dayo](https://github.com/akemin-dayo), 35 | [ARM64Darwin1820](https://github.com/ARM64Darwin1820), 36 | [ArtikusHG](https://github.com/ArtikusHG), 37 | [benrosen78](https://github.com/benrosen78), 38 | [brendonjkding](https://github.com/brendonjkding), 39 | [conradev](https://github.com/conradev), 40 | [coolstar](https://github.com/coolstar), 41 | [DavidSkrundz](https://github.com/DavidSkrundz), 42 | [DGh0st](https://github.com/DGh0st), 43 | [Diatrus](https://github.com/Diatrus), 44 | [dlevi309](https://github.com/dlevi309), 45 | [DuIslingr](https://github.com/DuIslingr), 46 | [elihwyma](https://github.com/elihwyma), 47 | [eswick](https://github.com/eswick), 48 | [evelyneee](https://github.com/evelyneee), 49 | [hirakujira](https://github.com/hirakujira), 50 | [inoahdev](https://github.com/inoahdev), 51 | [kemmis](https://github.com/kemmis), 52 | [lechium](https://github.com/lechium), 53 | [leptos-null](https://github.com/leptos-null), 54 | [liuxuan30](https://github.com/liuxuan30), 55 | [mstg](https://github.com/mstg), 56 | [Naville](https://github.com/Naville), 57 | [neoighodaro](https://github.com/neoighodaro), 58 | [nin9tyfour](https://github.com/nin9tyfour), 59 | [NSExceptional](https://github.com/NSExceptional), 60 | [opa334](https://github.com/opa334), 61 | [PoomSmart](https://github.com/PoomSmart), 62 | [quiprr](https://github.com/quiprr), 63 | [r-plus](https://github.com/r-plus), 64 | [Rand01ph](https://github.com/Rand01ph), 65 | [ryannair05](https://github.com/ryannair05), 66 | [sbingner](https://github.com/sbingner), 67 | [Shade-Zepheri](https://github.com/Shade-Zepheri), 68 | [supermamon](https://github.com/supermamon), 69 | [theiostream](https://github.com/theiostream), 70 | [Tyilo](https://github.com/Tyilo), 71 | [vsnrain](https://github.com/vsnrain) 72 | 73 | ## License 74 | See [LICENSE.md](LICENSE.md) for licensing information. 75 | -------------------------------------------------------------------------------- /bin/convert_xml_plist.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Accept 'D' flag 6 | while getopts ":D:" flag; do 7 | case "$flag" in 8 | # Assign the arg associated with -D to $directory 9 | D) directory="$OPTARG" ;; 10 | *) echo "$0: Option -$OPTARG requires an argument." 1>&2 11 | exit 1 12 | ;; 13 | esac 14 | done 15 | 16 | # Check that all arguments were passed 17 | if [[ -z $directory ]]; then 18 | echo "Usage: $0 -D path" >&2 19 | exit 1 20 | fi 21 | 22 | # Check for plist converters 23 | if command -v plutil &> /dev/null; then 24 | cmd=plutil 25 | elif command -v ply &> /dev/null; then 26 | cmd=ply 27 | elif command -v plistutil &> /dev/null; then 28 | cmd=plistutil 29 | else 30 | printf "\e[0;36m==> \e[1;36mNotice:\e[m %s\n" \ 31 | "Neither plutil, ply, or libplist-utils are installed, so XML plist files were not optimized." 32 | exit 33 | fi 34 | 35 | # Get all the .plists and .strings in the project and its sub projects 36 | find "$directory" \( -name \*.plist -o -name \*.strings \) | while read i; do 37 | # Grab printable characters from file's bytes 38 | head="$(od -c "$i" | head)" 39 | # Strip any non-letter charcters 40 | clean_head="${head//[^[:alpha:]]/}" 41 | # bplist's have an 8 byte header ([bplist##] where ## is the version) 42 | # Since we only care to see if the file is in binary format, we're 43 | # going to check for just 6 bytes (i.e., ignore the version) 44 | magic_bytes="${clean_head:0:6}" 45 | 46 | # If file wasn't in binary format, convert it 47 | if ! [[ $magic_bytes == bplist ]]; then 48 | if [[ $cmd == plutil ]]; then 49 | plutil -convert binary1 "$i" 50 | elif [[ $cmd == ply ]]; then 51 | ply -c binary "$i" 52 | else 53 | plistutil -i "$i" -f bin -o "$i" 54 | fi 55 | fi 56 | done 57 | -------------------------------------------------------------------------------- /bin/deb_build_num.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | GETONLY=0 3 | if [[ $1 == "-g" ]]; then 4 | GETONLY=1 5 | shift 6 | fi 7 | 8 | if [[ $# -lt 2 ]]; then 9 | echo "Syntax: $0 [-g] packagename versionname" >&2 10 | exit 1 11 | fi 12 | 13 | if [[ ! -d $TOP_DIR/.debmake ]]; then 14 | mkdir $TOP_DIR/.debmake 15 | fi 16 | 17 | PACKAGE=$1 18 | VERSION=$2 19 | INFOFILE=$TOP_DIR/.debmake/$PACKAGE-$VERSION 20 | if [[ ! -e $INFOFILE ]]; then 21 | echo -n 1 > $INFOFILE 22 | echo -n 1 23 | exit 0 24 | else 25 | CURNUM=$(cat $INFOFILE) 26 | if [[ $GETONLY -eq 0 ]]; then 27 | let CURNUM++ 28 | echo -n $CURNUM > $INFOFILE 29 | fi 30 | echo $CURNUM 31 | fi 32 | -------------------------------------------------------------------------------- /bin/denicify.pl: -------------------------------------------------------------------------------- 1 | ../vendor/nic/bin/denicify.pl -------------------------------------------------------------------------------- /bin/dm.pl: -------------------------------------------------------------------------------- 1 | ../vendor/dm.pl/dm.pl -------------------------------------------------------------------------------- /bin/fakeroot.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | required=0 3 | persistence=/tmp/dhbxxx 4 | 5 | while getopts ":p:rc" flag; do 6 | case "$flag" in 7 | :) echo "$0: Option -$OPTARG requires an argument." 1>&2 8 | exit 1 9 | ;; 10 | \?) echo "$0: Option -$OPTARG unrecognized." 1>&2 11 | exit 1 12 | ;; 13 | p) persistence="$OPTARG" ;; 14 | r) required=1 ;; 15 | c) delpersistence=1 ;; 16 | esac 17 | done 18 | shift $((OPTIND-1)) 19 | cmd=$* 20 | 21 | mkdir -p $(dirname $persistence) 22 | touch $persistence 23 | 24 | if [[ $delpersistence -eq 1 ]]; then 25 | rm -f $persistence 26 | exit 0 27 | fi 28 | 29 | if [[ "$USER" == "root" ]]; then 30 | fakeroot="" 31 | elif type fauxsu &> /dev/null; then 32 | fakeroot="fauxsu -p $persistence -- " 33 | elif type fakeroot-ng &> /dev/null; then 34 | fakeroot="fakeroot-ng -p $persistence -- " 35 | elif type fakeroot &> /dev/null; then 36 | fakeroot="fakeroot -i $persistence -s $persistence -- " 37 | else 38 | if [[ $required -eq 1 ]]; then 39 | fakeroot="" 40 | else 41 | fakeroot=": " 42 | fi 43 | fi 44 | 45 | #echo $fakeroot $cmd 46 | $fakeroot $cmd 47 | -------------------------------------------------------------------------------- /bin/gen-commands.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use JSON::PP; 3 | use Fcntl ':flock'; 4 | 5 | $filename = shift; 6 | $dir = shift; 7 | $kind = shift; 8 | @files = (); 9 | while (true) { 10 | $curr_file = shift; 11 | if ($curr_file eq "--") { 12 | last; 13 | } else { 14 | push(@files, ($curr_file)); 15 | } 16 | } 17 | 18 | # read out existing compile_commands and clear the file 19 | if (-e $filename) { 20 | open(FH, '+<', $filename) or die "Could not open '$filename' - $!"; 21 | flock(FH, LOCK_EX) or die "Could not lock '$filename' - $!"; 22 | @commands = @{decode_json()}; 23 | seek(FH, 0, 0); 24 | } else { 25 | open(FH, '>', $filename) or die "Could not open '$filename' - $!"; 26 | flock(FH, LOCK_EX) or die "Could not lock '$filename' - $!"; 27 | @commands = (); 28 | } 29 | 30 | foreach (@files) { 31 | push(@commands, { 32 | directory => "$dir", 33 | file => "$_", 34 | command => join(" ", @ARGV) 35 | }); 36 | } 37 | 38 | print FH encode_json(\@commands); 39 | truncate(FH, tell(FH)); 40 | close(FH) or die "Could not write '$filename' - $!"; 41 | 42 | exec @ARGV; 43 | -------------------------------------------------------------------------------- /bin/install-theos: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Error codes + association: 4 | # 1 - Running as root 5 | # 2 - Unsupported platform 6 | # 3 - Dependency issue 7 | # 4 - Unsupported shell 8 | # 5 - Setting $THEOS failed 9 | # 6 - Theos clone failed 10 | # 7 - Toolchain install failed 11 | # 8 - SDK install failed 12 | # 9 - Checkra1n '/opt' setup failed 13 | # 10 - WSL1 fakeroot->fakeroot-tcp failed 14 | # 11 - Enabling Linux binary compat on FreeBSD failed 15 | 16 | set -e 17 | 18 | # Pretty print 19 | special() { 20 | printf "\e[0;34m==> \e[1;34mTheos Installer:\e[m %s\n" "$1" 21 | } 22 | 23 | update() { 24 | printf "\n\e[0;36m==> \e[1;36m%s\e[m\n" "$1" 25 | } 26 | 27 | common() { 28 | printf "\n\e[0;37m==> \e[1;37m%s\e[m\n" "$1" 29 | } 30 | 31 | error() { 32 | printf "\e[0;31m==> \e[1;31m%s\e[m\n" "$1" 33 | } 34 | 35 | 36 | # Root is no bueno 37 | if [[ $EUID -eq 0 ]]; then 38 | error "Theos should NOT be installed with or run as root (su/sudo)!" 39 | error " - Please re-run the installer as a non-root user." 40 | exit 1 41 | fi 42 | 43 | 44 | # Common vars 45 | PLATFORM=$(uname) 46 | CSHELL="${SHELL##*/}" 47 | SHELL_ENV="unknown" 48 | if [[ $CSHELL == sh || $CSHELL == bash || $CSHELL == dash ]]; then 49 | # Bash prioritizes bashrc > bash_profile > profile 50 | if [[ -f $HOME/.bashrc ]]; then 51 | SHELL_ENV="$HOME/.bashrc" 52 | elif [[ -f $HOME/.bash_profile ]]; then 53 | SHELL_ENV="$HOME/.bash_profile" 54 | else 55 | SHELL_ENV="$HOME/.profile" 56 | fi 57 | elif [[ $CSHELL == zsh ]]; then 58 | # Zsh prioritizes zshenv > zprofile > zshrc 59 | if [[ -f $HOME/.zshenv ]]; then 60 | SHELL_ENV="$HOME/.zshenv" 61 | elif [[ -f $HOME/.zprofile ]]; then 62 | SHELL_ENV="$HOME/.zprofile" 63 | else 64 | SHELL_ENV="$HOME/.zshrc" 65 | fi 66 | # TODO 67 | # elif [[ $CSHELL == csh ]]; then 68 | # SHELL_ENV="$HOME/.cshrc" 69 | fi 70 | 71 | 72 | # The work 73 | theos_bool() { 74 | AFFIRMATIVE=(Y y YES yes TRUE true) 75 | if [[ ${AFFIRMATIVE[*]} =~ $1 ]]; then 76 | return 0 77 | else 78 | return 1 79 | fi 80 | } 81 | 82 | set_theos() { 83 | # Check for $THEOS env var 84 | update "Checking for \$THEOS environment variable..." 85 | if ! [[ -z $THEOS ]]; then 86 | update "\$THEOS is already set to '$THEOS'. Nothing to do here." 87 | else 88 | update "\$THEOS has not been set. Setting now..." 89 | 90 | if [[ $SHELL_ENV == unknown ]]; then 91 | error "Current shell ($CSHELL) is unsupported by this installer. Please set the THEOS environment variable to '~/theos' manually before proceeding." 92 | exit 4 93 | fi 94 | 95 | # Set $THEOS 96 | if [[ $PLATFORM == Darwin && ! -x $(command -v xcode-select) && -f /.bootstrapped ]]; then 97 | # checkra1n has no exec in var, so need to set 98 | # up '/opt' for use with Theos as mobile user 99 | echo "export THEOS=/opt/theos" >> "$SHELL_ENV" 100 | export THEOS=/opt/theos 101 | if [[ -d /opt ]]; then 102 | update "'/opt' already exists. Checking its ownership..." 103 | # Check that '/opt' isn't owned by root 104 | OWNER="$(stat -c '%U' /opt)" 105 | if [[ $OWNER == root ]]; then 106 | update "Owner of '/opt' is root. Attempting to switch owner to mobile..." 107 | sudo chown mobile /opt \ 108 | && update "Owner of '/opt' successfully transfered to mobile from root!" \ 109 | || (error "Failed to transfer ownership of '/opt' to mobile from root. Please see the log above."; exit 9) 110 | else 111 | update "Owner of '/opt' is not root. We should be good to go!" 112 | fi 113 | else 114 | update "Creating a special directory to house Theos..." 115 | sudo install -d -o mobile -g mobile /opt \ 116 | && update "Special directory for Theos created successfully!" \ 117 | || (error "Special directory create command seems to have encountered an error. Please see the log above."; exit 9) 118 | fi 119 | else 120 | echo "export THEOS=~/theos" >> "$SHELL_ENV" 121 | export THEOS=~/theos 122 | fi 123 | fi 124 | } 125 | 126 | get_theos() { 127 | # Get Theos 128 | update "Checking for Theos install..." 129 | if [[ -d $THEOS && $(ls -A "$THEOS") ]]; then 130 | update "Theos appears to already be installed. Checking for updates..." 131 | $THEOS/bin/update-theos 132 | else 133 | update "Theos does not appear to be installed. Cloning now..." 134 | git clone --recursive https://github.com/theos/theos.git $THEOS \ 135 | && update "Git clone of Theos was successful!" \ 136 | || (error "Theos git clone command seems to have encountered an error. Please see the log above."; exit 6) 137 | fi 138 | } 139 | 140 | get_sdks() { 141 | # Get patched sdks 142 | update "Checking for patched SDKs..." 143 | if [[ -d $THEOS/sdks/ && $(ls -A "$THEOS/sdks/" | grep sdk) ]]; then 144 | update "SDKs appear to already be installed." 145 | else 146 | update "SDKs do not appear to be installed. Installing now..." 147 | # Grab latest for provided platforms 148 | urls=$(curl https://api.github.com/repos/theos/sdks/releases/latest | grep download_url | sed 's/.*: "\(.*\)"/\1/') 149 | ios_url=$(echo "$urls" | grep 'iPhoneOS' | sort -V | tail -n1) 150 | tvos_url=$(echo "$urls" | grep 'AppleTVOS' | sort -V | tail -n1) 151 | curl -L "$ios_url" | tar -xJv -C "$THEOS/sdks" 152 | curl -L "$tvos_url" | tar -xJv -C "$THEOS/sdks" 153 | 154 | if [[ -d $THEOS/sdks/ && $(ls -A "$THEOS/sdks/" | grep sdk) ]]; then 155 | update "SDKs successfully installed!" 156 | else 157 | error "Something appears to have gone wrong. Please try again." 158 | exit 8 159 | fi 160 | fi 161 | } 162 | 163 | darwin() { 164 | # Check for Xcode 165 | XCODE="$(xcode-select -p)" 166 | if [[ $XCODE == /Library/Developer/CommandLineTools && ! -d /Applications/Xcode.app/Contents/Developer/ ]]; then 167 | error "Xcode, not just the Command Line Tools, is required for Theos to function properly. Please install Xcode before continuing with the installation." 168 | common "We recommend that you install Xcode from https://developer.apple.com/download/applications/ instead of from the Mac App Store as it's much faster." 169 | exit 3 170 | elif [[ $XCODE == /Library/Developer/CommandLineTools && -d /Applications/Xcode.app/Contents/Developer/ ]]; then 171 | common "Xcode developer directory is currently $XCODE; switching to /Applications/Xcode.app/Contents/Developer/..." 172 | sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/ 173 | elif [[ $XCODE != *.app/Contents/Developer ]]; then 174 | error "Xcode is required for Theos to function properly. Please install Xcode before continuing with the installation." 175 | common "We recommend that you install Xcode from https://developer.apple.com/download/applications/ instead of from the Mac App Store as it's much faster." 176 | common "If you already have Xcode installed, check the output of 'xcode-select -p'; you may need to change your developer directory via 'sudo xcode-select -s '." 177 | exit 3 178 | fi 179 | 180 | # Dependencies 181 | update "Preparing to install dependencies..." 182 | if [[ -x $(command -v apt) && -f /opt/procursus/.procursus_strapped ]]; then 183 | sudo apt update || true 184 | sudo apt install -y ldid xz-utils \ 185 | && update "Dependencies have been successfully installed!" \ 186 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 187 | elif [[ -x $(command -v port) ]]; then 188 | sudo port selfupdate || true 189 | yes | sudo port install ldid xz \ 190 | && update "Dependencies have been successfully installed!" \ 191 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 192 | elif [[ -x $(command -v brew) ]]; then 193 | brew update || true 194 | brew install ldid xz \ 195 | && update "Dependencies have been successfully installed!" \ 196 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 197 | else 198 | read -p "Homebrew, which provides tools Theos depends on, is not installed. Would you like to have it installed for you? [y/n]" hbrew 199 | if theos_bool $hbrew; then 200 | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \ 201 | && update "Homebrew has been successfully installed!" \ 202 | || (error "Homebrew install command seems to have encountered an error. Please see the log above."; exit 3) 203 | brew install ldid xz \ 204 | && update "Dependencies have been successfully installed!" \ 205 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 206 | else 207 | error "Homebrew provides tools Theos depends on and thus is mandatory. Please install Homebrew before proceeding with the installation." 208 | exit 3 209 | fi 210 | fi 211 | 212 | set_theos 213 | get_theos 214 | get_sdks 215 | } 216 | 217 | darwin_mobile() { 218 | # Categorize iOS version 219 | # Earlier than iOS 12 is old! 220 | # https://www.theiphonewiki.com/wiki/Kernel 221 | LEGACY=0 222 | KERNEL_VER=$(sysctl kern.osrelease | sed 's/[^0-9]*//g') 223 | if [[ $KERNEL_VER < 1800 ]]; then 224 | LEGACY=1 225 | fi 226 | 227 | # Check for sudo (not installed by default on some jbs) 228 | if ! [[ -x $(command -v sudo) ]]; then 229 | error "Please install 'sudo' in your package manager before proceeding with the installation." 230 | exit 3 231 | fi 232 | 233 | # Compatbility check 234 | APTVER="$(apt-get --version | head -n1 | cut -d' ' -f2)" 235 | if dpkg --compare-versions $APTVER ge 1.1; then 236 | uFLAGS=(--allow-insecure-repositories) 237 | iFLAGS=(--allow-unauthenticated --allow-downgrades) 238 | elif dpkg --compare-versions $APTVER ge 0.6.8; then 239 | uFLAGS=() 240 | iFLAGS=(--allow-unauthenticated) 241 | else 242 | uFLAGS=() 243 | iFLAGS=() 244 | fi 245 | 246 | # Dependencies 247 | update "Preparing to install dependencies. Please enter your password if prompted:" 248 | if [[ $LEGACY -eq 1 ]]; then 249 | read -p "Do you have 'https://coolstar.org/publicrepo/', 'https://repo.bingner.com/', and 'http://apt.thebigboss.org/repofiles/cydia/' installed in the sources of your jailbreak's primary package manager? [y/n]" ready 250 | if theos_bool $ready; then 251 | sudo apt-get update "${uFLAGS[@]}" || true 252 | sudo apt-get install -y "${iFLAGS[@]}" org.theos.dependencies \ 253 | && update "Dependencies have been successfully installed!" \ 254 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 255 | else 256 | error "Please install the repos mentioned above before proceeding." 257 | exit 3 258 | fi 259 | else 260 | # Up-to-date dependencies pkg is exclusive to Procursus, so need to cater install accordingly 261 | if [[ -f /.procursus_strapped || -f /var/jb/.procursus_strapped ]]; then 262 | read -p "Do you have 'https://apt.procurs.us' installed in the sources of your jailbreak's primary package manager? [y/n]" ready 263 | if theos_bool $ready; then 264 | sudo apt update "${uFLAGS[@]}" || true 265 | sudo apt install -y "${iFLAGS[@]}" theos-dependencies \ 266 | && update "Dependencies have been successfully installed!" \ 267 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 268 | else 269 | error "Please install the repo mentioned above before proceeding." 270 | exit 3 271 | fi 272 | else 273 | read -p "Do you have 'https://apt.bingner.com' installed in the sources of your jailbreak's primary package manager? [y/n]" ready 274 | if theos_bool $ready; then 275 | sudo apt update "${uFLAGS[@]}" || true 276 | sudo apt install -y "${iFLAGS[@]}" ca-certificates clang coreutils curl dpkg git grep ldid make odcctools perl com.bingner.plutil rsync xz \ 277 | && update "Dependencies have been successfully installed!" \ 278 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 279 | else 280 | error "Please install the repo mentioned above before proceeding." 281 | exit 3 282 | fi 283 | fi 284 | fi 285 | 286 | # Check desire for Swift support 287 | update "Checking desire for Swift support..." 288 | read -p "Would you like to be able to work with Swift? If so, an additional package will need to be installed. [y/n]" confirm 289 | if theos_bool $confirm; then 290 | if [[ -f /.procursus_strapped || -f /var/jb/.procursus_strapped ]]; then 291 | sudo apt install -y "${iFLAGS[@]}" swift \ 292 | && update "Additional Swift package installation successful!" \ 293 | || (error "Additional Swift package install command seems to have encountered an error. Please see the log above."; exit 3) 294 | else 295 | sudo apt install -y "${iFLAGS[@]}" com.kabiroberai.swift-toolchain \ 296 | && update "Additional Swift package installation successful!" \ 297 | || (error "Additional Swift package install command seems to have encountered an error. Please see the log above."; exit 3) 298 | fi 299 | else 300 | update "Skipping Swift support." 301 | common "Note: if you end up wanting to use Swift in the future, just install the 'swift' (Procursus ONLY) or 'swift-toolchain' (all other bootstraps) packages from within your package manager." 302 | fi 303 | 304 | set_theos 305 | get_theos 306 | get_sdks 307 | } 308 | 309 | linux() { 310 | # Determine distro 311 | DISTRO="unknown" 312 | if [[ -x $(command -v apt) ]]; then 313 | DISTRO="debian" 314 | elif [[ -x $(command -v pacman) ]]; then 315 | DISTRO="arch" 316 | elif [[ -x $(command -v dnf) ]]; then 317 | DISTRO="redhat" 318 | elif [[ -x $(command -v zypper) ]]; then 319 | DISTRO="suse" 320 | fi 321 | 322 | # Check for sudo (not installed by default on some distros) 323 | if ! [[ -x $(command -v sudo) ]]; then 324 | error "Please install 'sudo' before proceeding with the installation." 325 | exit 3 326 | fi 327 | 328 | # Dependencies 329 | update "Preparing to install dependencies. Please enter your password if prompted:" 330 | case $DISTRO in 331 | debian) 332 | sudo apt update || true 333 | sudo apt install -y build-essential fakeroot rsync curl perl zip git libxml2 \ 334 | && update "Dependencies have been successfully installed!" \ 335 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 336 | ;; 337 | arch) 338 | sudo pacman -Syu || true 339 | sudo pacman -S --needed --noconfirm base-devel libbsd fakeroot openssl rsync curl perl zip git libxml2 \ 340 | && update "Dependencies have been successfully installed!" \ 341 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 342 | ;; 343 | redhat) 344 | sudo dnf --refresh || true 345 | sudo dnf group install -y "C Development Tools and Libraries" \ 346 | && update "Dependencies have been successfully installed!" \ 347 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 348 | sudo dnf install -y fakeroot lzma libbsd rsync curl perl zip git libxml2 \ 349 | && update "Other dependencies have been successfully installed!" \ 350 | || (error "Other dependency install command seems to have encountered an error. Please see the log above."; exit 3) 351 | ;; 352 | suse) 353 | sudo zypper refresh || true 354 | sudo zypper install -y -t pattern devel_basis \ 355 | && update "Dependencies have been successfully installed!" \ 356 | || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 357 | sudo zypper install -y fakeroot libbsd0 rsync curl perl zip git libxml2 \ 358 | && update "Other dependencies have been successfully installed!" \ 359 | || (error "Other dependency install command seems to have encountered an error. Please see the log above."; exit 3) 360 | ;; 361 | *) 362 | error "The dependencies for your distro are unknown to this installer. Note that they will need to be determined before Theos can be installed and/or function properly." 363 | common "On Debian-based distros, the necessary dependencies are: build-essential fakeroot rsync curl perl git libxml2 and libtinfo5 (non-swift toolchain) or libz3-dev (swift toolchain)." 364 | common "Additional dependencies may also be required depending on what your distro provides." 365 | ;; 366 | esac 367 | 368 | # Check for WSL 369 | update "Checking for WSL..." 370 | if [[ $(uname -r | sed -n 's/.*\( *Microsoft *\).*/\L\1/ip') == microsoft ]]; then 371 | VERSION=$(uname -r | sed 's/.*\([[:digit:]]\)[[:space:]]*/\1/') 372 | if [[ $VERSION -eq 1 ]]; then 373 | update "WSL1! Need to fix fakeroot..." 374 | sudo update-alternatives --set fakeroot /usr/bin/fakeroot-tcp \ 375 | && update "fakeroot fixed!" \ 376 | || (error "fakeroot fix seems to have encountered an error. Please see the log above."; exit 10) 377 | else 378 | update "WSL2! Nothing to do here." 379 | fi 380 | else 381 | update "Seems you're not using WSL. Moving on..." 382 | fi 383 | 384 | set_theos 385 | get_theos 386 | 387 | # Get a toolchain 388 | update "Checking for iOS toolchain..." 389 | if [[ -d $THEOS/toolchain/linux/iphone/ && $(ls -A "$THEOS/toolchain/linux/iphone") ]]; then 390 | update "A toolchain appears to already be installed." 391 | else 392 | update "A toolchain does not appear to be installed." 393 | stoolchain="n" 394 | if [[ -z $CI ]]; then 395 | read -p "Would you like your toolchain to support Swift (larger toolchain size) or not (smaller toolchain size)? [y/n]" stoolchain 396 | fi 397 | if theos_bool $stoolchain; then 398 | case $DISTRO in 399 | debian) 400 | sudo apt install -y libz3-dev zstd 401 | ;; 402 | arch) 403 | sudo pacman -S --needed --noconfirm libedit z3 zstd 404 | # libz3-dev equivalent is z3 and we need to create lib version queried 405 | LATEST_LIBZ3="$(ls -v /usr/lib/ | grep libz3 | tail -n 1)" 406 | sudo ln -sf /usr/lib/$LATEST_LIBZ3 /usr/lib/libz3.so.4 407 | # toolchain looks for a specific libedit 408 | LATEST_LIBEDIT="$(ls -v /usr/lib/ | grep libedit | tail -n 1)" 409 | sudo ln -sf /usr/lib/$LATEST_LIBEDIT /usr/lib/libedit.so.2 410 | ;; 411 | redhat) 412 | sudo dnf install -y z3-libs zstd 413 | # libz3-dev equivalent is z3-libs and ... 414 | LATEST_LIBZ3="$(ls -v /usr/lib64/ | grep libz3 | tail -n 1)" 415 | sudo ln -sf /usr/lib64/$LATEST_LIBZ3 /usr/lib64/libz3.so.4 416 | # toolchain looks for a specific libedit 417 | LATEST_LIBEDIT="$(ls -v /usr/lib64/ | grep libedit | tail -n 1)" 418 | sudo ln -sf /usr/lib64/$LATEST_LIBEDIT /usr/lib64/libedit.so.2 419 | ;; 420 | suse) 421 | sudo zypper install -y $(zypper search libz3 | tail -n 1 | cut -d "|" -f2) zstd 422 | # libz3-dev equivalent is libz3-* and ... 423 | LATEST_LIBZ3="$(ls -v /usr/lib64/ | grep libz3 | tail -n 1)" 424 | sudo ln -sf /usr/lib64/$LATEST_LIBZ3 /usr/lib64/libz3.so.4 425 | # toolchain looks for a specific libedit 426 | LATEST_LIBEDIT="$(ls -v /usr/lib64/ | grep libedit | tail -n 1)" 427 | sudo ln -sf /usr/lib64/$LATEST_LIBEDIT /usr/lib64/libedit.so.2 428 | ;; 429 | esac 430 | curl -LO https://github.com/CRKatri/llvm-project/releases/download/swift-5.3.2-RELEASE/swift-5.3.2-RELEASE-ubuntu20.04.tar.zst 431 | TMP=$(mktemp -d) 432 | tar -xvf swift-5.3.2-RELEASE-ubuntu20.04.tar.zst -C $TMP 433 | mkdir -p $THEOS/toolchain/linux/iphone $THEOS/toolchain/swift 434 | mv $TMP/swift-5.3.2-RELEASE-ubuntu20.04/* $THEOS/toolchain/linux/iphone/ 435 | ln -s $THEOS/toolchain/linux/iphone $THEOS/toolchain/swift 436 | rm -r swift-5.3.2-RELEASE-ubuntu20.04.tar.zst $TMP 437 | curl -L https://github.com/ProcursusTeam/ldid/releases/latest/download/ldid_linux_x86_64 -o $THEOS/toolchain/linux/iphone/bin/ldid 438 | else 439 | case $DISTRO in 440 | debian) 441 | sudo apt install -y libtinfo5 442 | ;; 443 | arch) 444 | # get source for libtinfo5 equivalent from AUR and build 445 | if ! pacman -Qs ncurses5-compat-libs > /dev/null; then 446 | git clone https://aur.archlinux.org/ncurses5-compat-libs.git 447 | cd ncurses5-compat-libs 448 | gpg --recv-keys "$(cat PKGBUILD | grep validpgp | grep -oP "(?<=').*(?=')")" 449 | MAKEFLAGS="-j$(nproc --all)" makepkg -sir --noconfirm \ 450 | && cd .. \ 451 | && rm -rf ncurses5-compat-libs 452 | fi 453 | ;; 454 | redhat) 455 | sudo dnf install -y ncurses-compat-libs 456 | ;; 457 | suse) 458 | sudo zypper install -y libncurses5 459 | ;; 460 | esac 461 | curl -LO https://github.com/L1ghtmann/llvm-project/releases/latest/download/iOSToolchain.tar.xz 462 | tar -xvf iOSToolchain.tar.xz -C $THEOS/toolchain/ 463 | rm iOSToolchain.tar.xz 464 | fi 465 | 466 | # Confirm that toolchain is usable 467 | if [[ -x $THEOS/toolchain/linux/iphone/bin/clang ]]; then 468 | update "Successfully installed the toolchain!" 469 | else 470 | error "Something appears to have gone wrong -- the toolchain is not accessible. Please try again." 471 | exit 7 472 | fi 473 | fi 474 | 475 | get_sdks 476 | } 477 | 478 | # TODO 479 | # freebsd() { 480 | # # Check for sudo (not installed by default) 481 | # if ! [[ -x $(command -v sudo) ]]; then 482 | # error "Please install 'sudo' before proceeding with the installation." 483 | # exit 3 484 | # fi 485 | 486 | # # Dependencies 487 | # update "Preparing to install dependencies. Please enter your password if prompted:" 488 | # sudo pkg update || true 489 | # sudo pkg install -y bash curl gmake ncurses fakeroot git rsync curl zip \ 490 | # && update "Dependencies have been successfully installed!" \ 491 | # || (error "Dependency install command seems to have encountered an error. Please see the log above."; exit 3) 492 | 493 | # # Enable linux binary compatibility 494 | # update "Enabling Linux binary compatibility..." 495 | # sudo sysrc linux_enable=YES 496 | # sudo service linux start 497 | # sudo pkg install -y linux_base-c7 \ 498 | # && update "Linux binary compatibility successfully enabled!" \ 499 | # || (error "Linux binary compatibility command seems to have encountered an error. Please see the log above."; exit 11) 500 | 501 | # # Compatibility with common Theos commands 502 | # # TODO: Should we be doing this? 503 | # echo "alias make=gmake" >> "$SHELL_ENV" 504 | 505 | # set_theos 506 | # get_theos 507 | 508 | # # Get a toolchain 509 | # update "Checking for iOS toolchain..." 510 | # # TODO: FreeBSD unique toolchain path != /linux/ ? 511 | # if [[ -d $THEOS/toolchain/linux/iphone/ && $(ls -A "$THEOS/toolchain/linux/iphone") ]]; then 512 | # update "A toolchain appears to already be installed." 513 | # else 514 | # update "A toolchain does not appear to be installed." 515 | # stoolchain="n" 516 | # if [[ -z $CI ]]; then 517 | # read -p "Would you like your toolchain to support Swift (larger toolchain size) or not (smaller toolchain size)? [y/n]" stoolchain 518 | # fi 519 | # if theos_bool $stoolchain; then 520 | # sudo pkg install -y zstd 521 | # curl -LO https://github.com/CRKatri/llvm-project/releases/download/swift-5.3.2-RELEASE/swift-5.3.2-RELEASE-ubuntu20.04.tar.zst 522 | # TMP=$(mktemp -d) 523 | # tar -xvf swift-5.3.2-RELEASE-ubuntu20.04.tar.zst -C $TMP 524 | # mkdir -p $THEOS/toolchain/linux/iphone $THEOS/toolchain/swift 525 | # mv $TMP/swift-5.3.2-RELEASE-ubuntu20.04/* $THEOS/toolchain/linux/iphone/ 526 | # ln -s $THEOS/toolchain/linux/iphone $THEOS/toolchain/swift 527 | # rm -r swift-5.3.2-RELEASE-ubuntu20.04.tar.zst $TMP 528 | # else 529 | # curl -LO https://github.com/L1ghtmann/llvm-project/releases/latest/download/iOSToolchain.tar.xz 530 | # tar -xvf iOSToolchain.tar.xz -C $THEOS/toolchain/ 531 | # rm iOSToolchain.tar.xz 532 | # fi 533 | 534 | # # Confirm that toolchain is usable 535 | # if [[ -x $THEOS/toolchain/linux/iphone/bin/clang ]]; then 536 | # update "Successfully installed the toolchain!" 537 | # else 538 | # error "Something appears to have gone wrong -- the toolchain is not accessible. Please try again." 539 | # exit 7 540 | # fi 541 | # fi 542 | 543 | # get_sdks 544 | # } 545 | 546 | 547 | # Determine platform and start work 548 | special "Starting install..." 549 | common "Platform: $PLATFORM" 550 | if [[ $PLATFORM == Darwin ]]; then 551 | if [[ -x $(command -v xcode-select) ]]; then 552 | darwin 553 | else 554 | darwin_mobile 555 | fi 556 | elif [[ ${PLATFORM,,} == linux ]]; then 557 | linux 558 | # elif [[ ${PLATFORM,,} == freebsd ]]; then 559 | # freebsd 560 | else 561 | error "'$PLATFORM' is currently unsupported by this installer and/or Theos." 562 | exit 2 563 | fi 564 | special "Theos has been successfully installed! Restart your shell and then run \$THEOS/bin/nic.pl to get started." 565 | -------------------------------------------------------------------------------- /bin/install.copyFile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [[ $TARGET_INSTALL_REMOTE -eq 1 ]]; then 3 | scp -P $THEOS_DEVICE_PORT "$1" $THEOS_DEVICE_USER@$THEOS_DEVICE_IP:$2 4 | else 5 | cp "$1" "$2" 6 | fi 7 | -------------------------------------------------------------------------------- /bin/install.exec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [[ $TARGET_INSTALL_REMOTE == 1 ]]; then 3 | args=(ssh) 4 | 5 | if [[ ! -z "$THEOS_DEVICE_PORT" ]]; then 6 | args+=(-p "$THEOS_DEVICE_PORT") 7 | fi 8 | 9 | if [[ ! -z "$THEOS_DEVICE_USER" ]]; then 10 | args+=(-l "$THEOS_DEVICE_USER") 11 | fi 12 | 13 | args+=($THEOS_DEVICE_IP) 14 | args+=("$@") 15 | 16 | exec ${args[@]} 17 | else 18 | exec su root -c "$@" 19 | fi 20 | -------------------------------------------------------------------------------- /bin/install.mergeDir: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cd "$1" 3 | # Use fakeroot.sh to ensure that permissions are preserved, and install.exec to ensure that we are running tar -x on the right system. 4 | fakeroot.sh -r tar -c . | install.exec "tar -x -C \"$2\"" 5 | -------------------------------------------------------------------------------- /bin/logify.pl: -------------------------------------------------------------------------------- 1 | ../vendor/logos/bin/logify.pl -------------------------------------------------------------------------------- /bin/logos.pl: -------------------------------------------------------------------------------- 1 | ../vendor/logos/bin/logos.pl -------------------------------------------------------------------------------- /bin/nic.pl: -------------------------------------------------------------------------------- 1 | ../vendor/nic/bin/nic.pl -------------------------------------------------------------------------------- /bin/nicify.pl: -------------------------------------------------------------------------------- 1 | ../vendor/nic/bin/nicify.pl -------------------------------------------------------------------------------- /bin/package_version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function build_num_from_file { 4 | version=$(< "$1") 5 | version=${version##*-} 6 | version=${version%%+*} 7 | version=${version%%~*} 8 | echo -n "$version" 9 | } 10 | 11 | while getopts ":N:V:" flag; do 12 | case "$flag" in 13 | :) echo "$0: Option -$OPTARG requires an argument." 1>&2 14 | exit 1 15 | ;; 16 | \?) echo "$0: What're you talking about?" 1>&2 17 | exit 1 18 | ;; 19 | N) package="$OPTARG" ;; 20 | V) version="$OPTARG" ;; 21 | esac 22 | done 23 | 24 | if [[ ! -d "${_THEOS_LOCAL_DATA_DIR}/packages" ]]; then 25 | if [[ -d "${THEOS_PROJECT_DIR}/.debmake" ]]; then 26 | mkdir -p "${_THEOS_LOCAL_DATA_DIR}" 27 | mv "${THEOS_PROJECT_DIR}/.debmake" "${_THEOS_LOCAL_DATA_DIR}/packages" 28 | else 29 | mkdir -p "${_THEOS_LOCAL_DATA_DIR}/packages" 30 | fi 31 | fi 32 | 33 | versionfile="${_THEOS_LOCAL_DATA_DIR}/packages/$package-$version" 34 | build_number=0 35 | 36 | if [[ ! -e "$versionfile" ]]; then 37 | build_number=1 38 | else 39 | build_number=$(build_num_from_file "$versionfile") 40 | let build_number++ 41 | fi 42 | 43 | echo -n "$build_number" > "$versionfile" 44 | echo "$build_number" 45 | -------------------------------------------------------------------------------- /bin/post-update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | # Ensure $THEOS is set and is a directory. 5 | if [[ -z "$THEOS" || ! -d "$THEOS" ]]; then 6 | echo "\$THEOS must be set to the location of Theos to use $(basename $0)." >&2 7 | exit 1 8 | fi 9 | 10 | cd "$THEOS" 11 | 12 | printf "\n\e[0;36m==> \e[1;36mNotice:\e[m %s\n" \ 13 | "Visit https://github.com/theos/theos/commits/master to view recent changes." 14 | -------------------------------------------------------------------------------- /bin/swift-bootstrapper.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # This is a helper script which invokes a command to bootstrap Theos' Swift tools, 4 | # if and only if necessary. 5 | # 6 | # Usage: swift-bootstrapper.pl <...build command> 7 | # 8 | # If THEOS_NO_SWIFT_CACHE is set to 1, the cache is ignored. 9 | 10 | use strict; 11 | use warnings; 12 | use Fcntl qw(:flock); 13 | use File::Path qw(rmtree); 14 | use File::Basename; 15 | 16 | my $swift_command = shift; 17 | my $swift_version = `$swift_command --version 2>/dev/null`; 18 | chomp($swift_version); 19 | $swift_version =~ tr{\n}{ }; 20 | 21 | my $project_dir = shift; 22 | my $project_name = basename($project_dir); 23 | my $lockfile = "$project_dir/.theos_lock"; 24 | my $build_dir = "$project_dir/.theos_build"; 25 | my $marker = "$build_dir/theos_build_commit"; 26 | 27 | my $print_command = shift; 28 | 29 | my $hash = `git -C $project_dir rev-parse HEAD 2>/dev/null`; 30 | chomp($hash); 31 | if ($? != 0 || length($hash) != 40) { 32 | # Theos should be a git repo but if it isn't this works as a hacky fallback 33 | my $hash = `find $project_dir/Sources -type f -print0 | xargs -0 sha1sum | awk '{print \$1}' | sha1sum | head -c 40`; 34 | chomp($hash); 35 | } 36 | 37 | my $computed_marker_value = "$hash $swift_version"; 38 | 39 | my $cache_flag = $ENV{THEOS_NO_SWIFT_CACHE} // ''; 40 | if ($cache_flag eq '3') { 41 | exit; 42 | } 43 | my $no_cache = $cache_flag eq '1' || $cache_flag eq '2'; 44 | 45 | # The marker file indicates the last version of swift-support that was successfully built 46 | # (identified by its commit hash). If the last successful build corresponds to the current 47 | # commit of swift-support, there's no need to re-build, and we can exit early. 48 | sub check_marker() { 49 | if (!$no_cache && -e $marker) { 50 | open(my $marker_fh, '<', $marker) || die($!); 51 | my $marker_value = <$marker_fh>; 52 | if (defined $marker_value && $marker_value eq $computed_marker_value) { 53 | exit; 54 | } 55 | } 56 | } 57 | 58 | # Lockless (fast-path) check. Safe because concurrent reading is okay, and even 59 | # if there's currently a process writing to the marker, the worst-case is that 60 | # this check will end up erroneously failing, but that's fine because the check 61 | # after the lock will succeed. 62 | check_marker; 63 | 64 | # The file lock ensures only one `swift build` command runs at a time, because SwiftPM 65 | # doesn't accept parallel build invocations. This is required for both parallel make 66 | # invocations (-j#) as well as multiple Theos projects being built simultaneously. 67 | open(my $lockfile_fh, '>', $lockfile) || die($!); 68 | flock($lockfile_fh, LOCK_EX) || die($!); 69 | 70 | # Having acquired the lock, check the marker again in case another process beat us 71 | # to building swift-support. This can happen if the first check_marker was run while 72 | # another process had acquired the lock but hadn't yet finished building, or hadn't 73 | # finished writing to the marker. 74 | check_marker; 75 | 76 | if ($cache_flag ne '1' && -d $build_dir) { 77 | rmtree($build_dir); 78 | } 79 | 80 | # The marker file doesn't exist, and we hold the build lock. Let's run the build command. 81 | my $build_command = "SPM_THEOS_BUILD=1 $swift_command build -c release --package-path $project_dir --build-path $project_dir/.theos_build"; 82 | system($print_command); 83 | system($build_command) == 0 || die("Failed to build $project_name: command failed: $build_command\n"); 84 | 85 | # Create the marker file with the commit hash to indicate that we're done. 86 | open(my $marker_fh, '>', $marker); 87 | $marker_fh->print($computed_marker_value); 88 | -------------------------------------------------------------------------------- /bin/update-git-repo: -------------------------------------------------------------------------------- 1 | update-theos -------------------------------------------------------------------------------- /bin/update-theos: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | has() { 5 | type "$1" >/dev/null 2>&1 6 | } 7 | 8 | # Root is no bueno 9 | if [[ $EUID -eq 0 ]]; then 10 | echo "Theos should NOT be installed with or run as root (su/sudo)!" >&2 11 | echo " - If you've installed Theos as root, please remove the install and" >&2 12 | echo " reinstall as a non-root user." >&2 13 | echo " - If you're using root because you don't have write permission for Theos'" >&2 14 | echo " parent directory, please either install Theos to a different directory where" >&2 15 | echo " you do have write permission, or if you're trying to install to /opt, change" >&2 16 | echo " the directory's ownership using chown before attempting to install Theos as" >&2 17 | echo " a non-root user." >&2 18 | exit 1 19 | fi 20 | 21 | # Ensure $THEOS is set and is a directory. 22 | if [[ -z "$THEOS" || ! -d "$THEOS" ]]; then 23 | echo "\$THEOS must be set to the location of Theos to use $(basename $0)." >&2 24 | exit 2 25 | fi 26 | 27 | # Ensure $THEOS is a Git repo. 28 | if [[ ! -d "$THEOS/.git" ]]; then 29 | echo "$THEOS is not a Git repository. Theos relies on Git to update itself. For more information, refer to: https://theos.dev/install#updating" >&2 30 | exit 3 31 | fi 32 | 33 | # Ensure the user has Git. 34 | if ! has git; then 35 | echo "Git is not installed. Theos relies on Git to update itself. For more information, refer to: https://theos.dev/install" >&2 36 | exit 3 37 | fi 38 | 39 | cd "$THEOS" 40 | 41 | # Set conflig flag so multiple git fetch jobs run simultaneously. 42 | git config submodule.fetchJobs 4 43 | 44 | # Update Theos itself, then submodules. 45 | git pull --all --rebase=false 46 | git submodule update --init --recursive 47 | 48 | # The Theos update may need to do some extra stuff, so run the post-update script here. 49 | exec bin/post-update 50 | -------------------------------------------------------------------------------- /extras/ci/common.sh: -------------------------------------------------------------------------------- 1 | # status display function 2 | status() { 3 | echo 4 | echo "===" 5 | echo "$1…" 6 | } 7 | -------------------------------------------------------------------------------- /extras/ci/cygwin-install.cmd: -------------------------------------------------------------------------------- 1 | @:: download cygwin setup.exe and perform an update 2 | @:: mostly inspired by https://github.com/ocaml/opam/blob/master/appveyor.yml 3 | appveyor DownloadFile https://cygwin.com/setup-x86_64.exe -FileName cygwinsetup.exe 4 | cygwinsetup -q -R %CYG_ROOT% -s %CYG_MIRROR% -l %CYG_CACHE% >nul 5 | exit /b %ERRORLEVEL% 6 | -------------------------------------------------------------------------------- /extras/ci/cygwin-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # exit if anything fails 3 | set -e 4 | 5 | # source our common script 6 | source "$(dirname "$0")"/common.sh 7 | 8 | # ensure this is only used in appveyor 9 | if [[ -z $CI || -z $APPVEYOR ]]; then 10 | echo "This script is for use in an AppVeyor CI environment." >&2 11 | exit 1 12 | fi 13 | 14 | # check our arguments are there 15 | if [[ -z $THEOS ]]; then 16 | echo "The Theos env var is missing." >&2 17 | exit 1 18 | fi 19 | 20 | # install dependencies 21 | status "Installing dependencies" 22 | PERL_MM_USE_DEFAULT=1 cpan IO::Compress::Lzma 23 | 24 | # ensure we’re in $THEOS 25 | cd $THEOS 26 | 27 | # grab submodules 28 | status "Cloning submodules" 29 | git submodule update --init --recursive 30 | 31 | # grab the toolchain 32 | status "Installing toolchain" 33 | mkdir -p toolchain/windows/iphone 34 | cd toolchain/windows/iphone 35 | curl -fsSL https://github.com/coolstar/iOSToolchain4Win/tarball/x86_64 | tar -xz --strip-components=1 36 | 37 | # grab the sdk 38 | status "Installing SDK" 39 | cd - 40 | cd sdks 41 | curl -fsSL https://github.com/theos/sdks/tarball/master | tar -xz --strip-components=1 42 | 43 | # we should be ready now 44 | cd - 45 | echo 46 | echo Done 47 | -------------------------------------------------------------------------------- /extras/ci/macos-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # exit if anything fails 3 | set -e 4 | 5 | # source our common script 6 | source "$(dirname "$0")"/common.sh 7 | 8 | # ensure this is only used in appveyor 9 | if [[ -z $CI || -z $TRAVIS ]]; then 10 | echo "This script is for use in a Travis CI environment." >&2 11 | exit 1 12 | fi 13 | 14 | # check our arguments are there 15 | if [[ -z $THEOS ]]; then 16 | echo "The Theos env var is missing." >&2 17 | exit 1 18 | fi 19 | 20 | # update homebrew 21 | status "Updating Homebrew" 22 | brew update 23 | 24 | # install dependencies 25 | status "Installing dependencies" 26 | brew install ldid xz perl 27 | hash -r 28 | PERL_MM_USE_DEFAULT=1 cpan IO::Compress::Lzma 29 | 30 | # ensure we’re in $THEOS 31 | cd $THEOS 32 | 33 | # grab the sdk 34 | status "Installing SDK" 35 | cd sdks 36 | curl -fsSL https://github.com/theos/sdks/tarball/master | tar -xz --strip-components=1 37 | 38 | # we should be ready now 39 | cd - 40 | echo 41 | echo Done 42 | -------------------------------------------------------------------------------- /extras/ci/test-github-projects.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # exit if anything fails 3 | set -e 4 | 5 | # ensure this is only used in CI 6 | if [[ -z $CI ]]; then 7 | echo "This script is for use in a CI environment." >&2 8 | exit 1 9 | fi 10 | 11 | # check our vars are there 12 | if [[ -z $THEOS ]]; then 13 | echo "The Theos env var is missing." >&2 14 | exit 1 15 | fi 16 | 17 | for i in hbang/libcephei hbang/TypeStatus thomasfinch/PriorityHub; do 18 | # create a directory 19 | TEMP_DIR=$(mktemp -d) 20 | cd $TEMP_DIR 21 | 22 | # download and extract the repo 23 | curl -fsSL https://github.com/$i/tarball/master | tar -xz --strip-components=1 24 | 25 | # some of the test repos still use a theos symlink 26 | ln -s $THEOS theos 27 | 28 | # build! 29 | make package messages=yes 30 | 31 | # go up to the parent dir and remove this test dir 32 | cd .. 33 | rm -rf $(basename $TEMP_DIR) 34 | done 35 | -------------------------------------------------------------------------------- /include/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opa334/theos/acb68177c6413676b0298bb42f5c421cc008aead/include/.keep -------------------------------------------------------------------------------- /lib/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opa334/theos/acb68177c6413676b0298bb42f5c421cc008aead/lib/.keep -------------------------------------------------------------------------------- /makefiles/aggregate.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_AGGREGATE_MK_LOADED),) 2 | _THEOS_AGGREGATE_MK_LOADED := 1 3 | 4 | ifeq ($(THEOS_CURRENT_INSTANCE),) 5 | include $(THEOS_MAKE_PATH)/master/aggregate.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/appex.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/appex.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),appex) 5 | include $(THEOS_MAKE_PATH)/instance/appex.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/application.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/application.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),application) 5 | include $(THEOS_MAKE_PATH)/instance/application.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/bundle.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/bundle.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),bundle) 5 | include $(THEOS_MAKE_PATH)/instance/bundle.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/common.mk: -------------------------------------------------------------------------------- 1 | all:: 2 | 3 | # common.mk should only be included once. Throw an error if already included in this makefile. 4 | ifneq ($(__THEOS_COMMON_MK_VERSION),) 5 | $(error common.mk has been included multiple times. Please check your makefiles) 6 | endif 7 | 8 | # Block sudo. This is a common way users create more permissions problems than they already had. 9 | ifeq ($(notdir $(firstword $(SUDO_COMMAND))),make) 10 | $(error Do not use 'sudo make') 11 | endif 12 | 13 | # We use bash for all subshells. Force SHELL to bash if it’s currently set to sh. 14 | ifeq ($(SHELL),/bin/sh) 15 | export SHELL = bash 16 | endif 17 | 18 | ifeq ($(THEOS_PROJECT_DIR),) 19 | THEOS_PROJECT_DIR := $(shell pwd) 20 | endif 21 | _THEOS_RELATIVE_DATA_DIR ?= .theos 22 | _THEOS_LOCAL_DATA_DIR ?= $(THEOS_PROJECT_DIR)/$(_THEOS_RELATIVE_DATA_DIR) 23 | _THEOS_BUILD_SESSION_FILE = $(_THEOS_LOCAL_DATA_DIR)/build_session 24 | _THEOS_SPM_CONFIG_FILE := $(_THEOS_LOCAL_DATA_DIR)/spm_config 25 | _THEOS_COMPILE_COMMANDS_FILE := $(THEOS_PROJECT_DIR)/compile_commands.json 26 | _THEOS_TMP_COMPILE_COMMANDS_FILE := $(_THEOS_LOCAL_DATA_DIR)/compile_commands.json.tmp 27 | 28 | ### Functions 29 | # Function for getting a clean absolute path from cd. 30 | __clean_pwd = $(shell (unset CDPATH; cd "$(1)"; pwd)) 31 | # Truthiness 32 | _THEOS_TRUE := 1 33 | _THEOS_FALSE := 34 | __theos_bool = $(if $(filter Y y YES yes TRUE true 1,$(1)),$(_THEOS_TRUE),$(_THEOS_FALSE)) 35 | # Existence 36 | __exists = $(if $(wildcard $(1)),$(_THEOS_TRUE),$(_THEOS_FALSE)) 37 | __executable = $(if $(shell PATH="$(THEOS_BIN_PATH):$$PATH" type "$(1)" > /dev/null 2>&1 && echo 1),$(_THEOS_TRUE),$(_THEOS_FALSE)) 38 | # Static redefinition 39 | __simplify = $(2)$(eval $(1):=$(2)) 40 | ### 41 | 42 | __THEOS_COMMON_MK_VERSION := 1k 43 | 44 | ifneq ($(words $(THEOS_PROJECT_DIR)),1) 45 | $(error Your project is located at “$(THEOS_PROJECT_DIR)”, which contains spaces. Spaces are not supported in the project path) 46 | endif 47 | 48 | ifeq ($(_THEOS_PROJECT_MAKEFILE_NAME),) 49 | _THEOS_STATIC_MAKEFILE_LIST := $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) 50 | export _THEOS_PROJECT_MAKEFILE_NAME := $(notdir $(lastword $(_THEOS_STATIC_MAKEFILE_LIST))) 51 | endif 52 | 53 | ifeq ($(_THEOS_INTERNAL_TRUE_PATH),) 54 | _THEOS_RELATIVE_MAKE_PATH := $(dir $(lastword $(MAKEFILE_LIST))) 55 | _THEOS_INTERNAL_TRUE_PATH := $(call __clean_pwd,$(_THEOS_RELATIVE_MAKE_PATH)/..) 56 | ifneq ($(words $(_THEOS_INTERNAL_TRUE_PATH)),1) # It’s a hack, but it works. 57 | $(shell unlink /tmp/theos &> /dev/null; ln -Ffs "$(_THEOS_INTERNAL_TRUE_PATH)" /tmp/theos) 58 | _THEOS_INTERNAL_TRUE_PATH := /tmp/theos 59 | endif 60 | override THEOS := $(_THEOS_INTERNAL_TRUE_PATH) 61 | export _THEOS_INTERNAL_TRUE_PATH 62 | endif 63 | THEOS_MAKE_PATH := $(THEOS)/makefiles 64 | THEOS_BIN_PATH := $(THEOS)/bin 65 | THEOS_LIBRARY_PATH := $(THEOS)/lib 66 | THEOS_VENDOR_LIBRARY_PATH := $(THEOS)/vendor/lib 67 | THEOS_INCLUDE_PATH := $(THEOS)/include 68 | THEOS_VENDOR_INCLUDE_PATH := $(THEOS)/vendor/include 69 | THEOS_FALLBACK_INCLUDE_PATH := $(THEOS)/include/_fallback 70 | THEOS_VENDOR_SWIFT_SUPPORT_PATH := $(THEOS)/vendor/swift-support 71 | THEOS_VENDOR_ORION_PATH := $(THEOS)/vendor/orion 72 | THEOS_MODULE_PATH := $(THEOS)/mod 73 | THEOS_VENDOR_MODULE_PATH := $(THEOS)/vendor/mod 74 | THEOS_SDKS_PATH := $(THEOS)/sdks 75 | export THEOS THEOS_BIN_PATH THEOS_MAKE_PATH THEOS_LIBRARY_PATH THEOS_VENDOR_LIBRARY_PATH THEOS_INCLUDE_PATH THEOS_VENDOR_INCLUDE_PATH THEOS_FALLBACK_INCLUDE_PATH 76 | export THEOS_PROJECT_DIR 77 | 78 | export PATH := $(THEOS_BIN_PATH):$(PATH) 79 | 80 | ifeq ($(call __exists,$(HOME)/.theosrc),$(_THEOS_TRUE)) 81 | -include $(HOME)/.theosrc 82 | endif 83 | 84 | _THEOS_FINAL_PACKAGE := $(_THEOS_FALSE) 85 | 86 | ifeq ($(call __theos_bool,$(or $(FOR_RELEASE),$(FINALPACKAGE))),$(_THEOS_TRUE)) 87 | _THEOS_FINAL_PACKAGE := $(_THEOS_TRUE) 88 | endif 89 | 90 | ifeq ($(THEOS_SCHEMA),) 91 | _THEOS_SCHEMA := $(shell echo "$(strip $(schema) $(SCHEMA))" | tr 'a-z' 'A-Z') 92 | _THEOS_ON_SCHEMA := DEFAULT $(filter-out -%,$(_THEOS_SCHEMA)) 93 | ifeq ($(or $(debug),$(DEBUG))$(_THEOS_FINAL_PACKAGE),$(_THEOS_FALSE)) 94 | DEBUG := 1 95 | endif 96 | ifeq ($(call __theos_bool,$(or $(debug),$(DEBUG))),$(_THEOS_TRUE)) 97 | _THEOS_ON_SCHEMA += DEBUG 98 | endif 99 | _THEOS_OFF_SCHEMA := $(patsubst -%,%,$(filter -%,$(_THEOS_SCHEMA))) 100 | override THEOS_SCHEMA := $(strip $(filter-out $(_THEOS_OFF_SCHEMA),$(_THEOS_ON_SCHEMA))) 101 | override _THEOS_CLEANED_SCHEMA_SET := $(shell echo "$(filter-out DEFAULT,$(THEOS_SCHEMA))" | tr -Cd ' A-Z' | tr ' A-Z' '_a-z') 102 | export THEOS_SCHEMA _THEOS_CLEANED_SCHEMA_SET 103 | endif 104 | 105 | ### 106 | # __schema_defined_var_names bears explanation: 107 | # For each schema'd variable gathered from __schema_all_var_names, we generate a list of 108 | # "origin:name" pairs, and then filter out all pairs where the origin is "undefined". 109 | # We then substitute " " for ":" and take the last word, so we end up with only the entries from 110 | # __schema_all_var_names that are defined. 111 | __schema_all_var_names = $(foreach sch,$(THEOS_SCHEMA),$(subst DEFAULT.,,$(sch).)$(1)$(2)) 112 | __schema_defined_var_names = $(foreach tuple,$(filter-out undefined:%,$(foreach schvar,$(call __schema_all_var_names,$(1),$(2)),$(origin $(schvar)):$(schvar))),$(lastword $(subst :, ,$(tuple)))) 113 | __schema_var_all = $(strip $(foreach sch,$(call __schema_all_var_names,$(1),$(2)),$($(sch)))) 114 | __schema_var_name_last = $(strip $(lastword $(call __schema_defined_var_names,$(1),$(2)))) 115 | __schema_var_last = $(strip $($(lastword $(call __schema_defined_var_names,$(1),$(2))))) 116 | 117 | include $(THEOS_MAKE_PATH)/vercmp.mk 118 | include $(THEOS_MAKE_PATH)/target.mk 119 | 120 | THEOS_LAYOUT_DIR_NAME ?= layout 121 | THEOS_LAYOUT_DIR ?= $(THEOS_PROJECT_DIR)/$(THEOS_LAYOUT_DIR_NAME) 122 | ifeq ($(_THEOS_HAS_STAGING_LAYOUT),) 123 | _THEOS_HAS_STAGING_LAYOUT := $(call __exists,$(THEOS_LAYOUT_DIR)) 124 | endif 125 | 126 | _THEOS_LOAD_MODULES := $(sort $(call __schema_var_all,,MODULES) $(THEOS_AUTOLOAD_MODULES)) 127 | ifneq ($(THEOS_PACKAGE_SCHEME),) 128 | _THEOS_LOAD_MODULES += $(THEOS_PACKAGE_SCHEME) 129 | endif 130 | __mod = -include $$(foreach mod,$$(_THEOS_LOAD_MODULES),$$(or $$(wildcard $$(THEOS_VENDOR_MODULE_PATH)/$$(mod)/$(1)),$$(wildcard $$(THEOS_MODULE_PATH)/$$(mod)/$(1)))) 131 | 132 | include $(THEOS_MAKE_PATH)/legacy.mk 133 | 134 | ifneq ($(_THEOS_PLATFORM_CALCULATED),$(_THEOS_TRUE)) 135 | uname_s := $(shell uname -s) 136 | uname_o := $(shell uname -o 2>/dev/null) 137 | 138 | export _THEOS_PLATFORM = $(uname_s) 139 | export _THEOS_OS = $(if $(uname_o),$(uname_o),$(uname_s)) 140 | export _THEOS_PLATFORM_CALCULATED := 1 141 | endif 142 | 143 | -include $(THEOS_MAKE_PATH)/platform/$(_THEOS_PLATFORM).mk 144 | -include $(THEOS_MAKE_PATH)/platform/$(_THEOS_OS).mk 145 | $(eval $(call __mod,platform/$(_THEOS_PLATFORM).mk)) 146 | $(eval $(call __mod,platform/$(_THEOS_OS).mk)) 147 | 148 | ifneq ($(_THEOS_TARGET_CALCULATED),$(_THEOS_TRUE)) 149 | $(call __eval_target,$(target),$(call __schema_var_last,,TARGET),$(_THEOS_PLATFORM_DEFAULT_TARGET)) 150 | export _THEOS_TARGET := $(__THEOS_TARGET_ARG_0) 151 | ifeq ($(_THEOS_TARGET),) 152 | $(error You did not specify a target, and the "$(THEOS_PLATFORM_NAME)" platform does not define a default target) 153 | endif 154 | _THEOS_TARGET_CALCULATED := 1 155 | endif 156 | 157 | -include $(THEOS_MAKE_PATH)/targets/$(_THEOS_PLATFORM)/$(_THEOS_TARGET).mk 158 | -include $(THEOS_MAKE_PATH)/targets/$(_THEOS_OS)/$(_THEOS_TARGET).mk 159 | -include $(THEOS_MAKE_PATH)/targets/$(_THEOS_TARGET).mk 160 | $(eval $(call __mod,targets/$(_THEOS_PLATFORM)/$(_THEOS_TARGET).mk)) 161 | $(eval $(call __mod,targets/$(_THEOS_OS)/$(_THEOS_TARGET).mk)) 162 | $(eval $(call __mod,targets/$(_THEOS_TARGET).mk)) 163 | 164 | ifneq ($(_THEOS_TARGET_LOADED),$(_THEOS_TRUE)) 165 | $(error The "$(_THEOS_TARGET)" target is not supported on the "$(THEOS_PLATFORM_NAME)" platform) 166 | endif 167 | 168 | _THEOS_TARGET_NAME_DEFINE := $(shell echo "$(THEOS_TARGET_NAME)" | tr 'a-z' 'A-Z') 169 | 170 | export TARGET_CC TARGET_CXX TARGET_LD TARGET_STRIP TARGET_CODESIGN_ALLOCATE TARGET_CODESIGN TARGET_CODESIGN_FLAGS 171 | 172 | THEOS_TARGET_INCLUDE_PATH := $(THEOS_INCLUDE_PATH)/$(THEOS_TARGET_NAME) 173 | THEOS_TARGET_LIBRARY_PATH := $(THEOS_LIBRARY_PATH)/$(THEOS_TARGET_NAME) 174 | 175 | # Package Format requires Target default and falls back to `none'. 176 | _THEOS_PACKAGE_FORMAT := $(or $(call __schema_var_last,,$(_THEOS_TARGET_NAME_DEFINE)_PACKAGE_FORMAT),$(call __schema_var_last,,PACKAGE_FORMAT),$(_THEOS_TARGET_DEFAULT_PACKAGE_FORMAT),none) 177 | _THEOS_PACKAGE_LAST_FILENAME = $(call __simplify,_THEOS_PACKAGE_LAST_FILENAME,$(shell cat "$(_THEOS_LOCAL_DATA_DIR)/last_package" 2>/dev/null)) 178 | 179 | _THEOS_INTERNAL_SEARCHPATHS := 180 | ifeq ($(THEOS_PACKAGE_SCHEME),) 181 | _THEOS_INTERNAL_SEARCHPATHS += \ 182 | $(THEOS_VENDOR_LIBRARY_PATH) \ 183 | $(THEOS_LIBRARY_PATH) \ 184 | $(THEOS_TARGET_LIBRARY_PATH) 185 | endif 186 | _THEOS_INTERNAL_SEARCHPATHS += \ 187 | $(TARGET_PRIVATE_FRAMEWORK_PATH) \ 188 | $(THEOS_VENDOR_LIBRARY_PATH)/$(THEOS_TARGET_NAME)/$(or $(THEOS_PACKAGE_SCHEME),rootful) \ 189 | $(THEOS_LIBRARY_PATH)/$(THEOS_TARGET_NAME)/$(or $(THEOS_PACKAGE_SCHEME),rootful) 190 | _THEOS_INTERNAL_LDFLAGS = $(foreach path,$(_THEOS_INTERNAL_SEARCHPATHS),$(if $(call __exists,$(path)),-L$(path) -F$(path))) $(DEBUGFLAG) 191 | 192 | DEBUGFLAG ?= -ggdb 193 | SWIFT_DEBUGFLAG ?= -g 194 | DEBUG.CFLAGS = -DDEBUG -O0 195 | DEBUG.SWIFTFLAGS = -DDEBUG -Onone -incremental 196 | DEBUG.LDFLAGS = -O0 197 | 198 | _THEOS_SHOULD_STRIP_DEFAULT := $(_THEOS_TRUE) 199 | 200 | ifneq ($(findstring DEBUG,$(THEOS_SCHEMA)),) 201 | _THEOS_SHOULD_STRIP_DEFAULT := $(_THEOS_FALSE) 202 | PACKAGE_BUILDNAME ?= debug 203 | endif 204 | 205 | SHOULD_STRIP := $(call __theos_bool,$(or $(strip),$(STRIP),$(_THEOS_SHOULD_STRIP_DEFAULT))) 206 | 207 | ifeq ($(SHOULD_STRIP),$(_THEOS_TRUE)) 208 | OPTFLAG ?= -Os 209 | SWIFT_OPTFLAG ?= -O -whole-module-optimization -num-threads 1 210 | else 211 | TARGET_STRIP = : 212 | OPTFLAG ?= -O0 213 | endif 214 | 215 | THEOS_INCLUDE_PROJECT_DIR ?= yes 216 | 217 | _THEOS_INTERNAL_CFLAGS = -DTARGET_$(_THEOS_TARGET_NAME_DEFINE)=1 $(OPTFLAG) -Wall $(DEBUGFLAG) -Wno-unused-command-line-argument -Qunused-arguments 218 | _THEOS_INTERNAL_OBJCFLAGS = $(foreach path,$(_THEOS_INTERNAL_SEARCHPATHS),-F$(path)) 219 | _THEOS_INTERNAL_SWIFTFLAGS = -DTHEOS_SWIFT -DTARGET_$(_THEOS_TARGET_NAME_DEFINE) $(SWIFT_OPTFLAG) -module-name $(THEOS_CURRENT_INSTANCE) $(SWIFT_DEBUGFLAG) $(foreach path,$(_THEOS_INTERNAL_SEARCHPATHS),-F$(path)) 220 | _THEOS_INTERNAL_IFLAGS_BASE = -I$(THEOS_TARGET_INCLUDE_PATH) -I$(THEOS_INCLUDE_PATH) -I$(THEOS_VENDOR_INCLUDE_PATH) -I$(THEOS_FALLBACK_INCLUDE_PATH) 221 | _THEOS_INTERNAL_IFLAGS_C = $(_THEOS_INTERNAL_IFLAGS_BASE) -include $(THEOS)/Prefix.pch $(if $(call __theos_bool,$(THEOS_INCLUDE_PROJECT_DIR)),-iquote $(THEOS_PROJECT_DIR)) 222 | _THEOS_INTERNAL_IFLAGS_SWIFT = $(_THEOS_INTERNAL_IFLAGS_BASE) 223 | 224 | ifneq ($(GO_EASY_ON_ME),$(_THEOS_TRUE)) 225 | _THEOS_INTERNAL_LOGOSFLAGS += -c warnings=error 226 | _THEOS_INTERNAL_CFLAGS += -Werror 227 | endif 228 | 229 | # If COLOR hasn’t already been set, set it to enabled. We need to do this because output is buffered 230 | # by make when running rules in parallel, so clang doesn’t see stderr as a tty. We can’t test this 231 | # using [ -t 2 ] because it runs in a sub-shell and will always return 1 (false). 232 | COLOR ?= $(_THEOS_TRUE) 233 | 234 | ifeq ($(call __theos_bool,$(or $(COLOR),$(FORCE_COLOR))),$(_THEOS_TRUE)) 235 | COLOR := $(_THEOS_TRUE) 236 | _THEOS_INTERNAL_COLORFLAGS += -fcolor-diagnostics 237 | _THEOS_INTERNAL_SWIFTCOLORFLAGS += -Xfrontend -color-diagnostics 238 | endif 239 | 240 | THEOS_BUILD_DIR ?= . 241 | 242 | ifneq ($(_THEOS_CLEANED_SCHEMA_SET),) 243 | _THEOS_OBJ_DIR_EXTENSION = /$(_THEOS_CLEANED_SCHEMA_SET) 244 | endif 245 | ifneq ($(THEOS_TARGET_NAME),$(_THEOS_PLATFORM_DEFAULT_TARGET)) 246 | THEOS_OBJ_DIR_NAME ?= obj/$(THEOS_TARGET_NAME)$(_THEOS_OBJ_DIR_EXTENSION) 247 | else 248 | THEOS_OBJ_DIR_NAME ?= obj$(_THEOS_OBJ_DIR_EXTENSION) 249 | endif 250 | ifeq ($(THEOS_CURRENT_ARCH),) 251 | THEOS_OBJ_DIR = $(_THEOS_LOCAL_DATA_DIR)/$(THEOS_OBJ_DIR_NAME) 252 | else 253 | THEOS_OBJ_DIR = $(_THEOS_LOCAL_DATA_DIR)/$(THEOS_OBJ_DIR_NAME)/$(THEOS_CURRENT_ARCH) 254 | endif 255 | 256 | THEOS_STAGING_DIR_NAME ?= _ 257 | THEOS_STAGING_DIR ?= $(_THEOS_LOCAL_DATA_DIR)/$(THEOS_STAGING_DIR_NAME) 258 | _THEOS_STAGING_TMP = $(THEOS_STAGING_DIR)tmp 259 | _THEOS_SCHEME_STAGE = $(_THEOS_STAGING_TMP)$(THEOS_PACKAGE_INSTALL_PREFIX) 260 | _SPACE := $(subst x,,x x) 261 | _COMMA := , 262 | 263 | THEOS_PACKAGE_DIR_NAME ?= packages 264 | THEOS_PACKAGE_DIR ?= $(THEOS_BUILD_DIR)/$(THEOS_PACKAGE_DIR_NAME) 265 | 266 | THEOS_SUBPROJECT_PRODUCT = subproject.a 267 | 268 | include $(THEOS_MAKE_PATH)/messages.mk 269 | 270 | _THEOS_MAKEFLAGS := --no-keep-going COLOR=$(COLOR) 271 | 272 | ifeq ($(_THEOS_VERBOSE),$(_THEOS_FALSE)) 273 | _THEOS_MAKEFLAGS += --no-print-directory 274 | endif 275 | MAKEFLAGS += $(_THEOS_MAKEFLAGS) 276 | 277 | unexport THEOS_CURRENT_INSTANCE _THEOS_CURRENT_TYPE 278 | 279 | THEOS_RSYNC_EXCLUDES ?= _MTN .git .svn .DS_Store ._* 280 | _THEOS_RSYNC_EXCLUDE_COMMANDLINE := $(foreach exclude,$(THEOS_RSYNC_EXCLUDES),--exclude "$(exclude)") 281 | 282 | FAKEROOT := $(THEOS_BIN_PATH)/fakeroot.sh -p "$(_THEOS_LOCAL_DATA_DIR)/fakeroot" 283 | export FAKEROOT 284 | 285 | _THEOS_MAKE_PARALLEL_BUILDING ?= yes 286 | 287 | ifeq ($(THEOS_CURRENT_INSTANCE),) 288 | include $(THEOS_MAKE_PATH)/stage.mk 289 | include $(THEOS_MAKE_PATH)/package.mk 290 | endif 291 | 292 | THEOS_LINKAGE_TYPE ?= dynamic 293 | 294 | $(eval $(call __mod,common.mk)) 295 | -------------------------------------------------------------------------------- /makefiles/framework.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/framework.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),framework) 5 | include $(THEOS_MAKE_PATH)/instance/framework.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/install/deb_local.mk: -------------------------------------------------------------------------------- 1 | internal-install:: internal-install-check 2 | $(ECHO_INSTALLING)install.exec "$(_THEOS_SUDO_COMMAND) dpkg -i \"$(_THEOS_PACKAGE_LAST_FILENAME)\""$(ECHO_END) 3 | 4 | internal-uninstall:: 5 | $(ECHO_NOTHING)install.exec "$(_THEOS_SUDO_COMMAND) dpkg -r \"$(THEOS_PACKAGE_NAME)\""$(ECHO_END) 6 | -------------------------------------------------------------------------------- /makefiles/install/deb_remote.mk: -------------------------------------------------------------------------------- 1 | internal-install:: internal-install-check 2 | $(ECHO_INSTALLING)install.exec "cat > /tmp/_theos_install.deb; $(_THEOS_SUDO_COMMAND) dpkg -i /tmp/_theos_install.deb && rm /tmp/_theos_install.deb" < "$(_THEOS_PACKAGE_LAST_FILENAME)"$(ECHO_END) 3 | 4 | internal-uninstall:: 5 | $(ECHO_NOTHING)install.exec "$(_THEOS_SUDO_COMMAND) dpkg -r \"$(THEOS_PACKAGE_NAME)\""$(ECHO_END) 6 | -------------------------------------------------------------------------------- /makefiles/install/none_local.mk: -------------------------------------------------------------------------------- 1 | internal-install:: stage 2 | $(ECHO_INSTALLING)install.mergeDir "$(THEOS_STAGING_DIR)" "/"$(ECHO_END) 3 | 4 | internal-uninstall:: 5 | $(ERROR_BEGIN)"$(MAKE) uninstall is not supported when packaging is disabled"$(ERROR_END) 6 | -------------------------------------------------------------------------------- /makefiles/install/none_remote.mk: -------------------------------------------------------------------------------- 1 | none_local.mk -------------------------------------------------------------------------------- /makefiles/install/pkg_local.mk: -------------------------------------------------------------------------------- 1 | internal-install:: internal-install-check 2 | $(ECHO_INSTALLING)install.exec "$(_THEOS_SUDO_COMMAND) installer -pkg \"$(_THEOS_PACKAGE_LAST_FILENAME)\" -target /"$(ECHO_END) 3 | 4 | internal-uninstall:: 5 | $(ECHO_NOTHING)install.exec "pkgutil --files \"$(THEOS_PACKAGE_NAME)\" | tail -r | sed 's/^/\//' | $(_THEOS_SUDO_COMMAND) xargs rm -d; $(_THEOS_SUDO_COMMAND) pkgutil --forget \"$(THEOS_PACKAGE_NAME)\""$(ECHO_END) 6 | -------------------------------------------------------------------------------- /makefiles/install/pkg_remote.mk: -------------------------------------------------------------------------------- 1 | internal-install:: internal-install-check 2 | $(ECHO_INSTALLING)install.exec "cat > /tmp/_theos_install.pkg; $(_THEOS_SUDO_COMMAND) installer -pkg /tmp/_theos_install.pkg && rm /tmp/_theos_install.pkg" < "$(_THEOS_PACKAGE_LAST_FILENAME)"$(ECHO_END) 3 | 4 | internal-uninstall:: 5 | $(ECHO_NOTHING)install.exec "pkgutil --files \"$(THEOS_PACKAGE_NAME)\" | tail -r | sed 's/^/\//' | sudo xargs rm -d; $(_THEOS_SUDO_COMMAND) pkgutil --forget \"$(THEOS_PACKAGE_NAME)\""$(ECHO_END) 6 | -------------------------------------------------------------------------------- /makefiles/install/rpm_local.mk: -------------------------------------------------------------------------------- 1 | internal-install:: internal-install-check 2 | $(ECHO_INSTALLING)install.exec "$(_THEOS_SUDO_COMMAND) rpm -U --replacepkgs --oldpackage \"$(_THEOS_PACKAGE_LAST_FILENAME)\""$(ECHO_END) 3 | 4 | internal-uninstall:: 5 | $(ECHO_NOTHING)install.exec "rpm -e \"$(THEOS_PACKAGE_NAME)\""$(ECHO_END) 6 | -------------------------------------------------------------------------------- /makefiles/install/rpm_remote.mk: -------------------------------------------------------------------------------- 1 | internal-install:: internal-install-check 2 | $(ECHO_INSTALLING)install.exec "cat > /tmp/_theos_install.rpm; $(_THEOS_SUDO_COMMAND) rpm -U --replacepkgs --oldpackage /tmp/_theos_install.rpm && rm /tmp/_theos_install.rpm" < "$(_THEOS_PACKAGE_LAST_FILENAME)"$(ECHO_END) 3 | 4 | internal-uninstall:: 5 | $(ECHO_NOTHING)install.exec "$(_THEOS_SUDO_COMMAND) rpm -e \"$(THEOS_PACKAGE_NAME)\""$(ECHO_END) 6 | -------------------------------------------------------------------------------- /makefiles/instance/appex.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-appex-all_ internal-appex-stage_ internal-appex-compile 6 | 7 | 8 | # Bundle Setup 9 | LOCAL_INSTALL_PATH = $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)) 10 | LOCAL_BUNDLE_NAME = $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME),$($(THEOS_CURRENT_INSTANCE)_APPEX_NAME),$(THEOS_CURRENT_INSTANCE)) 11 | 12 | _LOCAL_BUNDLE_FULL_NAME = $(LOCAL_BUNDLE_NAME).appex 13 | _THEOS_SHARED_BUNDLE_BUILD_PATH = $(THEOS_OBJ_DIR)/$(_LOCAL_BUNDLE_FULL_NAME) 14 | _THEOS_SHARED_BUNDLE_STAGE_PATH = $(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/$(_LOCAL_BUNDLE_FULL_NAME) 15 | _LOCAL_INSTANCE_TARGET := $(_LOCAL_BUNDLE_FULL_NAME)$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY)/$(THEOS_CURRENT_INSTANCE) 16 | _LOCAL_APP_EXTENSION_SAFE := $(_THEOS_TRUE) 17 | _LOCAL_APP_EXTENSION_SAFE_API := $(_THEOS_TRUE) 18 | 19 | include $(THEOS_MAKE_PATH)/instance/shared/bundle.mk 20 | # End Bundle Setup 21 | 22 | _THEOS_INTERNAL_LDFLAGS += -e _NSExtensionMain 23 | 24 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 25 | internal-appex-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 26 | else 27 | internal-appex-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all 28 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 29 | internal-appex-compile \ 30 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 31 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 32 | 33 | internal-appex-compile: $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 34 | endif 35 | 36 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(_LOCAL_INSTANCE_TARGET))) 37 | 38 | internal-appex-stage_:: shared-instance-bundle-stage 39 | 40 | $(eval $(call __mod,instance/appex.mk)) 41 | -------------------------------------------------------------------------------- /makefiles/instance/application.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-application-all_ internal-application-stage_ internal-application-compile 6 | 7 | ifeq ($(MODULESFLAGS),) 8 | ifeq ($(findstring UIKit,$($(THEOS_CURRENT_INSTANCE)_FRAMEWORKS))$(findstring AppKit,$($(THEOS_CURRENT_INSTANCE)_FRAMEWORKS)),) 9 | _THEOS_INTERNAL_LDFLAGS += -framework UIKit 10 | ifeq ($(_THEOS_APPLICATION_WARNED_IMPLICIT_UIKIT_$(THEOS_CURRENT_INSTANCE)),) 11 | internal-application-all_:: 12 | @$(PRINT_FORMAT_WARNING) "$(THEOS_CURRENT_INSTANCE): warning: Implicit UIKit linkage for application instances is deprecated. Please add \"UIKit\" to $(THEOS_CURRENT_INSTANCE)_FRAMEWORKS." >&2 13 | export _THEOS_APPLICATION_WARNED_IMPLICIT_UIKIT_$(THEOS_CURRENT_INSTANCE) = 1 14 | endif 15 | endif 16 | endif 17 | 18 | # Bundle Setup 19 | LOCAL_INSTALL_PATH ?= $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)) 20 | ifeq ($(LOCAL_INSTALL_PATH),) 21 | LOCAL_INSTALL_PATH = /Applications 22 | endif 23 | 24 | ifeq ($($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME),) 25 | LOCAL_BUNDLE_NAME = $(THEOS_CURRENT_INSTANCE) 26 | else 27 | LOCAL_BUNDLE_NAME = $($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME) 28 | endif 29 | 30 | _LOCAL_BUNDLE_FULL_NAME = $(LOCAL_BUNDLE_NAME).app 31 | _THEOS_SHARED_BUNDLE_BUILD_PATH = $(THEOS_OBJ_DIR)/$(_LOCAL_BUNDLE_FULL_NAME) 32 | _THEOS_SHARED_BUNDLE_STAGE_PATH = $(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/$(_LOCAL_BUNDLE_FULL_NAME) 33 | _LOCAL_INSTANCE_TARGET := $(_LOCAL_BUNDLE_FULL_NAME)$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY)/$(THEOS_CURRENT_INSTANCE)$(TARGET_EXE_EXT) 34 | include $(THEOS_MAKE_PATH)/instance/shared/bundle.mk 35 | # End Bundle Setup 36 | 37 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 38 | internal-application-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 39 | else 40 | internal-application-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all 41 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 42 | internal-application-compile \ 43 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 44 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 45 | 46 | internal-application-compile: $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 47 | endif 48 | 49 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(_LOCAL_INSTANCE_TARGET))) 50 | 51 | internal-application-stage_:: shared-instance-bundle-stage 52 | 53 | $(eval $(call __mod,instance/application.mk)) 54 | -------------------------------------------------------------------------------- /makefiles/instance/bundle.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-bundle-all_ internal-bundle-stage_ internal-bundle-compile 6 | 7 | ifeq ($(call __theos_bool,$(or $($(THEOS_CURRENT_INSTANCE)_DYNAMIC_LIBRARY),$(_THEOS_TRUE))),$(_THEOS_TRUE)) 8 | _THEOS_INTERNAL_LDFLAGS += -dynamiclib 9 | endif 10 | 11 | # Bundle Setup 12 | LOCAL_BUNDLE_NAME = $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME),$(THEOS_CURRENT_INSTANCE)) 13 | LOCAL_BUNDLE_EXTENSION = $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_EXTENSION),bundle) 14 | 15 | _LOCAL_BUNDLE_FULL_NAME = $(LOCAL_BUNDLE_NAME).$(LOCAL_BUNDLE_EXTENSION) 16 | _THEOS_SHARED_BUNDLE_BUILD_PATH = $(THEOS_OBJ_DIR)/$(_LOCAL_BUNDLE_FULL_NAME) 17 | _THEOS_SHARED_BUNDLE_STAGE_PATH = $(THEOS_STAGING_DIR)$($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)/$(_LOCAL_BUNDLE_FULL_NAME) 18 | _LOCAL_INSTANCE_TARGET := $(_LOCAL_BUNDLE_FULL_NAME)$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY)/$(THEOS_CURRENT_INSTANCE)$(TARGET_EXE_EXT) 19 | include $(THEOS_MAKE_PATH)/instance/shared/bundle.mk 20 | # End Bundle Setup 21 | 22 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 23 | internal-bundle-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 24 | else 25 | internal-bundle-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all 26 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 27 | internal-bundle-compile \ 28 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 29 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 30 | 31 | internal-bundle-compile: $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 32 | endif 33 | 34 | ifneq ($(OBJ_FILES_TO_LINK),) 35 | 36 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(_LOCAL_INSTANCE_TARGET),nowarn)) 37 | 38 | else # OBJ_FILES_TO_LINK == "" 39 | 40 | $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET): 41 | $(NOTICE_EMPTY_LINKING) 42 | 43 | endif # OBJ_FILES_TO_LINK 44 | 45 | internal-bundle-stage_:: shared-instance-bundle-stage 46 | 47 | $(eval $(call __mod,instance/bundle.mk)) 48 | -------------------------------------------------------------------------------- /makefiles/instance/framework.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-framework-all_ internal-framework-stage_ internal-framework-compile 6 | 7 | 8 | # Bundle Setup 9 | LOCAL_INSTALL_PATH ?= $(or $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)),/Library/Frameworks) 10 | LOCAL_BUNDLE_NAME = $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME),$($(THEOS_CURRENT_INSTANCE)_FRAMEWORK_NAME),$(THEOS_CURRENT_INSTANCE)) 11 | 12 | _LOCAL_BUNDLE_FULL_NAME = $(LOCAL_BUNDLE_NAME).framework 13 | _THEOS_SHARED_BUNDLE_BUILD_PATH = $(THEOS_OBJ_DIR)/$(_LOCAL_BUNDLE_FULL_NAME) 14 | _THEOS_SHARED_BUNDLE_STAGE_PATH = $(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/$(_LOCAL_BUNDLE_FULL_NAME) 15 | _LOCAL_INSTANCE_TARGET := $(_LOCAL_BUNDLE_FULL_NAME)$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY)/$(THEOS_CURRENT_INSTANCE) 16 | _LOCAL_APP_EXTENSION_SAFE := $(_THEOS_TRUE) 17 | 18 | include $(THEOS_MAKE_PATH)/instance/shared/bundle.mk 19 | # End Bundle Setup 20 | 21 | _THEOS_INTERNAL_LDFLAGS += -dynamiclib -install_name "$(LOCAL_INSTALL_PATH)/$(_LOCAL_INSTANCE_TARGET)" 22 | 23 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 24 | internal-framework-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 25 | else 26 | internal-framework-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all 27 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 28 | internal-framework-compile \ 29 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 30 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 31 | 32 | internal-framework-compile: $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 33 | endif 34 | 35 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(_LOCAL_INSTANCE_TARGET))) 36 | 37 | internal-framework-stage_:: shared-instance-bundle-stage 38 | ifeq ($(THEOS_PACKAGE_SCHEME),) 39 | $(ECHO_COPYING_FRAMEWORK)rsync -ra "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)" "$(THEOS_LIBRARY_PATH)"$(ECHO_END) 40 | else 41 | $(ECHO_COPYING_FRAMEWORK)rsync -ra "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)" "$(THEOS_LIBRARY_PATH)/$(THEOS_TARGET_NAME)/$(or $(THEOS_PACKAGE_SCHEME),rootful)"$(ECHO_END) 42 | endif 43 | 44 | $(eval $(call __mod,instance/framework.mk)) 45 | -------------------------------------------------------------------------------- /makefiles/instance/library.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-library-all_ internal-library-stage_ internal-library-compile 6 | 7 | LOCAL_INSTALL_PATH ?= $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)) 8 | ifeq ($(LOCAL_INSTALL_PATH),) 9 | LOCAL_INSTALL_PATH = /usr/lib 10 | endif 11 | 12 | _LOCAL_LIBRARY_EXTENSION = $(or $($(THEOS_CURRENT_INSTANCE)_LIBRARY_EXTENSION),$(TARGET_LIB_EXT)) 13 | ifeq ($(_LOCAL_LIBRARY_EXTENSION),-) 14 | _LOCAL_LIBRARY_EXTENSION = 15 | endif 16 | 17 | _LOCAL_ARCHIVE_EXTENSION = $(or $($(THEOS_CURRENT_INSTANCE)_ARCHIVE_EXTENSION),$(TARGET_AR_EXT)) 18 | ifeq ($(_LOCAL_ARCHIVE_EXTENSION),-) 19 | _LOCAL_ARCHIVE_EXTENSION = 20 | endif 21 | 22 | _LOCAL_LINKAGE_TYPE = $(or $($(THEOS_CURRENT_INSTANCE)_LINKAGE_TYPE),$(THEOS_LINKAGE_TYPE)) 23 | 24 | _THEOS_INTERNAL_LDFLAGS += $(call TARGET_LDFLAGS_DYNAMICLIB,$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION)) 25 | _THEOS_INTERNAL_CFLAGS += $(TARGET_CFLAGS_DYNAMICLIB) 26 | 27 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 28 | ifeq ($(_LOCAL_LINKAGE_TYPE),static) 29 | internal-library-all_:: $(_OBJ_DIR_STAMPS) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_ARCHIVE_EXTENSION) 30 | else ifeq ($(_LOCAL_LINKAGE_TYPE),both) 31 | internal-library-all_:: $(_OBJ_DIR_STAMPS) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_ARCHIVE_EXTENSION) 32 | else 33 | internal-library-all_:: $(_OBJ_DIR_STAMPS) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION) 34 | endif 35 | else 36 | internal-library-all_:: $(_OBJ_DIR_STAMPS) 37 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 38 | internal-library-compile \ 39 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 40 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 41 | 42 | ifeq ($(_LOCAL_LINKAGE_TYPE),static) 43 | internal-library-compile: $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_ARCHIVE_EXTENSION) 44 | else ifeq ($(_LOCAL_LINKAGE_TYPE),both) 45 | internal-library-compile: $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_ARCHIVE_EXTENSION) 46 | else 47 | internal-library-compile: $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION) 48 | endif 49 | endif 50 | 51 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION))) 52 | $(eval $(call _THEOS_TEMPLATE_ARCHIVE_LINKING_RULE,$(THEOS_CURRENT_INSTANCE)$(_LOCAL_ARCHIVE_EXTENSION))) 53 | 54 | ifneq ($($(THEOS_CURRENT_INSTANCE)_INSTALL),0) 55 | internal-library-stage_:: 56 | $(ECHO_NOTHING)mkdir -p "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/"$(ECHO_END) 57 | ifneq (static,$(_LOCAL_LINKAGE_TYPE)) 58 | $(ECHO_NOTHING)cp $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION) "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/"$(ECHO_END) 59 | endif 60 | ifneq (,$(filter static both,$(_LOCAL_LINKAGE_TYPE))) 61 | $(ECHO_NOTHING)cp $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_ARCHIVE_EXTENSION) "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/"$(ECHO_END) 62 | endif 63 | endif 64 | 65 | $(eval $(call __mod,instance/library.mk)) 66 | -------------------------------------------------------------------------------- /makefiles/instance/null.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-null-all_ internal-null-stage_ 6 | 7 | internal-null-all_:: 8 | 9 | internal-null-stage_:: 10 | 11 | $(eval $(call __mod,instance/null.mk)) 12 | -------------------------------------------------------------------------------- /makefiles/instance/shared/bundle.mk: -------------------------------------------------------------------------------- 1 | # Input Variables 2 | # THEOS_SHARED_BUNDLE_INSTALL_NAME: bundle name and extension 3 | # THEOS_SHARED_BUNDLE_INSTALL_PATH: bundle install path 4 | # _THEOS_SHARED_BUNDLE_STAGE_PATH: bundle resource path (typically just INSTALL_PATH/INSTALL_NAME) 5 | # 6 | # Instance Variables: 7 | # xxx_RESOURCE_FILES: list of resource files to install (why would you use this in favour of xxx_RESOURCE_DIRS? eh.) 8 | # xxx_RESOURCE_DIRS: folders to copy resources from 9 | # note a deviation from gnustep-make's xxx_RESOURCE_DIRS which simply specifies resource subdirectories to create 10 | # defaults to Resources/ if it exists. 11 | 12 | .PHONY: shared-instance-bundle-stage 13 | 14 | ifeq ($(_LOCAL_APP_EXTENSION_SAFE_API),) 15 | _LOCAL_APP_EXTENSION_SAFE_API := $(call __theos_bool,$(or $($(THEOS_CURRENT_INSTANCE)_APP_EXTENSION_SAFE_API),$(_THEOS_FALSE))) 16 | endif 17 | 18 | ifeq ($(_LOCAL_APP_EXTENSION_SAFE),) 19 | _LOCAL_APP_EXTENSION_SAFE := $(call __theos_bool,$(or $($(THEOS_CURRENT_INSTANCE)_APP_EXTENSION_SAFE),$(_THEOS_FALSE))) 20 | endif 21 | 22 | ifeq ($(_LOCAL_APP_EXTENSION_SAFE_API),$(_THEOS_TRUE)) 23 | _THEOS_INTERNAL_CFLAGS += -fapplication-extension 24 | _THEOS_INTERNAL_SWIFTFLAGS += -application-extension 25 | endif 26 | 27 | ifeq ($(_LOCAL_APP_EXTENSION_SAFE),$(_THEOS_TRUE)) 28 | _THEOS_INTERNAL_LDFLAGS += -fapplication-extension 29 | endif 30 | 31 | ifeq ($(_THEOS_CURRENT_OPERATION),stage) 32 | THEOS_SHARED_BUNDLE_BINARY_PATH = $(_THEOS_SHARED_BUNDLE_STAGE_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY) 33 | THEOS_SHARED_BUNDLE_RESOURCE_PATH = $(_THEOS_SHARED_BUNDLE_STAGE_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY) 34 | THEOS_SHARED_BUNDLE_HEADERS_PATH = $(_THEOS_SHARED_BUNDLE_STAGE_PATH)/$(_THEOS_TARGET_BUNDLE_HEADERS_SUBDIRECTORY) 35 | else 36 | THEOS_SHARED_BUNDLE_BINARY_PATH = $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY) 37 | THEOS_SHARED_BUNDLE_RESOURCE_PATH = $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY) 38 | THEOS_SHARED_BUNDLE_HEADERS_PATH = $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_HEADERS_SUBDIRECTORY) 39 | endif 40 | 41 | $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY):: 42 | $(ECHO_NOTHING)mkdir -p "$@"$(ECHO_END) 43 | 44 | _RESOURCE_FILES := $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_RESOURCES),$($(THEOS_CURRENT_INSTANCE)_RESOURCE_FILES)) 45 | _RESOURCE_DIRS := $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_RESOURCE_DIRS),$($(THEOS_CURRENT_INSTANCE)_RESOURCE_DIRS)) 46 | _PUBLIC_HEADERS := $($(THEOS_CURRENT_INSTANCE)_PUBLIC_HEADERS) 47 | ifeq ($(_RESOURCE_DIRS),) 48 | ifeq ($(call __exists,Resources),$(_THEOS_TRUE)) 49 | _RESOURCE_DIRS := Resources 50 | else 51 | _RESOURCE_DIRS := 52 | endif 53 | endif 54 | 55 | shared-instance-bundle-all:: $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY) $(_THEOS_SHARED_BUNDLE_BUILD_PATH)/$(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY) 56 | ifneq ($(_RESOURCE_FILES),) 57 | $(ECHO_COPYING_RESOURCE_FILES)for f in $(_RESOURCE_FILES); do \ 58 | if [[ -f "$$f" || -d "$$f" ]]; then \ 59 | rsync -a "$$f" "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE); \ 60 | else \ 61 | $(PRINT_FORMAT_WARNING) "Ignoring missing bundle resource $$f." >&2; \ 62 | fi; \ 63 | done$(ECHO_END) 64 | endif 65 | ifneq ($(_RESOURCE_DIRS),) 66 | $(ECHO_COPYING_RESOURCE_DIRS)for d in $(_RESOURCE_DIRS); do \ 67 | if [[ -d "$$d" ]]; then \ 68 | rsync -a "$$d/" "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE); \ 69 | else \ 70 | $(PRINT_FORMAT_WARNING) "Ignoring missing bundle resource directory $$d." >&2; \ 71 | fi; \ 72 | done$(ECHO_END) 73 | endif 74 | ifneq ($(_PUBLIC_HEADERS),) 75 | $(ECHO_COPYING_PUBLIC_HEADERS)for f in $(_PUBLIC_HEADERS); do \ 76 | if [[ -f "$$f" || -d "$$f" ]]; then \ 77 | rsync -a "$$f" "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_HEADERS_SUBDIRECTORY)/" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE); \ 78 | else \ 79 | $(PRINT_FORMAT_WARNING) "Ignoring missing public header $$f." >&2; \ 80 | fi; \ 81 | done$(ECHO_END) 82 | endif 83 | ifneq ($(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY),$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)) 84 | ifeq ($(call __exists,$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/Info.plist),$(_THEOS_TRUE)) 85 | $(ECHO_NOTHING)mv "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY)/Info.plist" "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)$(_THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY)/Info.plist"$(ECHO_END) 86 | endif 87 | endif 88 | 89 | shared-instance-bundle-stage:: 90 | ifneq ($($(THEOS_CURRENT_INSTANCE)_INSTALL),0) 91 | $(ECHO_NOTHING)mkdir -p "$(_THEOS_SHARED_BUNDLE_STAGE_PATH)"$(ECHO_END) 92 | $(ECHO_NOTHING)rsync -a "$(_THEOS_SHARED_BUNDLE_BUILD_PATH)/" "$(_THEOS_SHARED_BUNDLE_STAGE_PATH)"$(ECHO_END) 93 | endif 94 | -------------------------------------------------------------------------------- /makefiles/instance/simbltweak.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-simbltweak-all_ internal-simbltweak-stage_ internal-simbltweak-compile 6 | 7 | _THEOS_INTERNAL_LDFLAGS += -dynamiclib 8 | 9 | # Bundle Setup 10 | LOCAL_INSTALL_PATH ?= $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)) 11 | ifeq ($(LOCAL_INSTALL_PATH),) 12 | LOCAL_INSTALL_PATH = /Library/Application Support/SIMBL/Plugins 13 | endif 14 | 15 | ifeq ($($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME),) 16 | LOCAL_BUNDLE_NAME = $(THEOS_CURRENT_INSTANCE) 17 | else 18 | LOCAL_BUNDLE_NAME = $($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME) 19 | endif 20 | 21 | _LOCAL_BUNDLE_FULL_NAME = $(LOCAL_BUNDLE_NAME).bundle 22 | _THEOS_SHARED_BUNDLE_BUILD_PATH = $(THEOS_OBJ_DIR)/$(_LOCAL_BUNDLE_FULL_NAME) 23 | _THEOS_SHARED_BUNDLE_STAGE_PATH = $(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/$(_LOCAL_BUNDLE_FULL_NAME) 24 | _LOCAL_INSTANCE_TARGET := $(_LOCAL_BUNDLE_FULL_NAME)$(_THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY)/$(THEOS_CURRENT_INSTANCE)$(TARGET_EXE_EXT) 25 | include $(THEOS_MAKE_PATH)/instance/shared/bundle.mk 26 | # End Bundle Setup 27 | 28 | _THEOS_INTERNAL_LOGOSFLAGS += -c generator=internal 29 | _THEOS_INTERNAL_ORIONFLAGS += --backend Internal 30 | 31 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 32 | internal-simbltweak-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 33 | else 34 | internal-simbltweak-all_:: $(_OBJ_DIR_STAMPS) shared-instance-bundle-all 35 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 36 | internal-simbltweak-compile \ 37 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 38 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 39 | 40 | internal-simbltweak-compile: $(THEOS_OBJ_DIR)/$(_LOCAL_INSTANCE_TARGET) 41 | endif 42 | 43 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(_LOCAL_INSTANCE_TARGET))) 44 | 45 | internal-simbltweak-stage_:: shared-instance-bundle-stage 46 | 47 | $(eval $(call __mod,instance/simbltweak.mk)) 48 | -------------------------------------------------------------------------------- /makefiles/instance/subproject.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | # Unset codesign command line. No codesigning is involved here. 6 | _THEOS_CODESIGN_COMMANDLINE = 7 | 8 | .PHONY: internal-subproject-all_ internal-subproject-stage_ internal-subproject-compile 9 | 10 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 11 | internal-subproject-all_:: $(_OBJ_DIR_STAMPS) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE).$(THEOS_SUBPROJECT_PRODUCT) 12 | else 13 | internal-subproject-all_:: $(_OBJ_DIR_STAMPS) 14 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 15 | internal-subproject-compile \ 16 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 17 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 18 | 19 | internal-subproject-compile: $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE).$(THEOS_SUBPROJECT_PRODUCT) 20 | endif 21 | 22 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(THEOS_CURRENT_INSTANCE).$(THEOS_SUBPROJECT_PRODUCT))) 23 | 24 | $(eval $(call __mod,instance/subproject.mk)) 25 | -------------------------------------------------------------------------------- /makefiles/instance/tool.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-tool-all_ internal-tool-stage_ internal-tool-compile 6 | 7 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 8 | internal-tool-all_:: $(_OBJ_DIR_STAMPS) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(TARGET_EXE_EXT) 9 | else 10 | internal-tool-all_:: $(_OBJ_DIR_STAMPS) 11 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 12 | internal-tool-compile \ 13 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 14 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 15 | 16 | internal-tool-compile: $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(TARGET_EXE_EXT) 17 | endif 18 | 19 | $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(THEOS_CURRENT_INSTANCE)$(TARGET_EXE_EXT))) 20 | 21 | LOCAL_INSTALL_PATH = $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)) 22 | ifeq ($(LOCAL_INSTALL_PATH),) 23 | LOCAL_INSTALL_PATH = $($(THEOS_CURRENT_INSTANCE)_PACKAGE_TARGET_DIR) 24 | ifeq ($(LOCAL_INSTALL_PATH),) 25 | LOCAL_INSTALL_PATH = /usr/bin 26 | endif 27 | endif 28 | 29 | ifneq ($($(THEOS_CURRENT_INSTANCE)_INSTALL),0) 30 | internal-tool-stage_:: 31 | $(ECHO_NOTHING)mkdir -p "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)"$(ECHO_END) 32 | $(ECHO_NOTHING)cp $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(TARGET_EXE_EXT) "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)"$(ECHO_END) 33 | endif 34 | 35 | $(eval $(call __mod,instance/tool.mk)) 36 | -------------------------------------------------------------------------------- /makefiles/instance/tweak.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-tweak-all_ internal-tweak-stage_ 6 | 7 | LOCAL_INSTALL_PATH ?= $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH)) 8 | ifeq ($(LOCAL_INSTALL_PATH),) 9 | LOCAL_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries 10 | endif 11 | 12 | _LOCAL_LOGOS_DEFAULT_GENERATOR = $(or $($(THEOS_CURRENT_INSTANCE)_LOGOS_DEFAULT_GENERATOR),$(LOGOS_DEFAULT_GENERATOR),$(_THEOS_TARGET_LOGOS_DEFAULT_GENERATOR),MobileSubstrate) 13 | _THEOS_INTERNAL_LOGOSFLAGS += -c generator=$(_LOCAL_LOGOS_DEFAULT_GENERATOR) 14 | 15 | _LOCAL_ORION_DEFAULT_BACKEND = $(or $($(THEOS_CURRENT_INSTANCE)_ORION_DEFAULT_BACKEND),$(ORION_DEFAULT_BACKEND),$(_THEOS_TARGET_ORION_DEFAULT_BACKEND),Substrate) 16 | _THEOS_INTERNAL_ORIONFLAGS += --backend $(_LOCAL_ORION_DEFAULT_BACKEND) 17 | 18 | include $(THEOS_MAKE_PATH)/instance/library.mk 19 | 20 | internal-tweak-all_:: internal-library-all_ 21 | 22 | internal-tweak-compile: internal-library-compile 23 | 24 | ifneq ($(strip $($(THEOS_CURRENT_INSTANCE)_BUNDLE_RESOURCE_DIRS) $($(THEOS_CURRENT_INSTANCE)_BUNDLE_RESOURCE_FILES)),) 25 | _LOCAL_BUNDLE_INSTALL_PATH = $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_INSTALL_PATH),/Library/Application Support/$(THEOS_CURRENT_INSTANCE)) 26 | _LOCAL_BUNDLE_NAME = $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_NAME),$(THEOS_CURRENT_INSTANCE)) 27 | _LOCAL_BUNDLE_EXTENSION = $(or $($(THEOS_CURRENT_INSTANCE)_BUNDLE_EXTENSION),bundle) 28 | 29 | _THEOS_SHARED_BUNDLE_BUILD_PATH = $(THEOS_OBJ_DIR)/$(_LOCAL_BUNDLE_NAME).$(_LOCAL_BUNDLE_EXTENSION) 30 | _THEOS_SHARED_BUNDLE_STAGE_PATH = $(THEOS_STAGING_DIR)$(_LOCAL_BUNDLE_INSTALL_PATH)/$(_LOCAL_BUNDLE_NAME).$(_LOCAL_BUNDLE_EXTENSION) 31 | include $(THEOS_MAKE_PATH)/instance/shared/bundle.mk 32 | 33 | internal-tweak-all_:: shared-instance-bundle-all 34 | internal-tweak-stage_:: shared-instance-bundle-stage 35 | endif 36 | 37 | ifneq ($($(THEOS_CURRENT_INSTANCE)_INSTALL),0) 38 | internal-tweak-stage_:: $(_EXTRA_TARGET) internal-library-stage_ 39 | ifeq ($(call __exists,$(THEOS_CURRENT_INSTANCE).plist),$(_THEOS_TRUE)) 40 | $(ECHO_NOTHING)cp "$(THEOS_CURRENT_INSTANCE).plist" "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/$(THEOS_CURRENT_INSTANCE).plist"$(ECHO_END) 41 | else ifeq ($(call __exists,Filter.plist),$(_THEOS_TRUE)) 42 | $(ECHO_NOTHING)cp "Filter.plist" "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/$(THEOS_CURRENT_INSTANCE).plist"$(ECHO_END) 43 | else 44 | $(ERROR_BEGIN)"You are missing a filter property list. Make sure it’s named \"$(THEOS_CURRENT_INSTANCE).plist\" or \"Filter.plist\". Refer to http://iphonedevwiki.net/index.php/Cydia_Substrate#MobileLoader."$(ERROR_END) 45 | endif 46 | endif 47 | 48 | $(eval $(call __mod,instance/tweak.mk)) 49 | -------------------------------------------------------------------------------- /makefiles/instance/xcodeproj.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | .PHONY: internal-xcodeproj-all_ internal-xcodeproj-stage_ internal-xcodeproj-compile internal-xcodeproj-clean 6 | 7 | ifeq ($(_THEOS_INTERNAL_USE_PARALLEL_BUILDING),$(_THEOS_TRUE)) 8 | # Don't synchronize xcodeproj output, because doing so results in Make buffering 9 | # the output and outputting it all at once once the build is finished. It's okay 10 | # not to synchronize, because the entire compile phase is just one single rule 11 | # which runs only once. 12 | MAKEFLAGS += -Onone 13 | endif 14 | 15 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 16 | internal-xcodeproj-all_:: internal-xcodeproj-compile 17 | internal-clean:: internal-xcodeproj-clean 18 | else 19 | internal-xcodeproj-all_:: 20 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 21 | internal-xcodeproj-compile \ 22 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 23 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 24 | 25 | internal-clean:: 26 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 27 | internal-xcodeproj-clean \ 28 | _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \ 29 | THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes 30 | endif 31 | 32 | ALL_XCODEFLAGS = $(_THEOS_INTERNAL_XCODEFLAGS) $(ADDITIONAL_XCODEFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,XCODEFLAGS) $(call __schema_var_all,,XCODEFLAGS) 33 | ALL_XCODEOPTS = $(_THEOS_INTERNAL_XCODEOPTS) $(ADDITIONAL_XCODEOPTS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,XCODEOPTS) $(call __schema_var_all,,XCODEOPTS) 34 | 35 | _THEOS_INTERNAL_XCODEOPTS = -sdk $(_THEOS_TARGET_PLATFORM_NAME) 36 | 37 | # Xcode strips even debug builds, which is an issue when using lldb because it's unable to 38 | # locate the local unstripped copy since it isn't aware of our custom derivedDataPath. While 39 | # that underlying issue still needs to be resolved to allow debugging release builds, the 40 | # following is a more immediate solution until we get around to solving that – which we could 41 | # do by, for example, writing a DBGShellCommands script or using DBGFileMappedPaths. 42 | _THEOS_INTERNAL_XCODEFLAGS += STRIP_INSTALLED_PRODUCT=$(if $(SHOULD_STRIP),YES,NO) ARCHS="$(ARCHS)" 43 | 44 | ifneq ($(TARGET_XCPRETTY),) 45 | ifneq ($(_THEOS_VERBOSE),$(_THEOS_TRUE)) 46 | _THEOS_XCODE_XCPRETTY = | $(TARGET_XCPRETTY) 47 | endif 48 | endif 49 | 50 | _THEOS_XCODE_BUILD_CONFIG = $(if $(findstring DEBUG,$(THEOS_SCHEMA)),Debug,Release) 51 | _THEOS_XCODE_BUILD_COMMAND := $(if $(_THEOS_FINAL_PACKAGE),archive,build install) 52 | _THEOS_XCODE_INSTALL_DIR_BASE := $(THEOS_OBJ_DIR)/install_$(THEOS_CURRENT_INSTANCE)$(if $(_THEOS_FINAL_PACKAGE),.xcarchive) 53 | _THEOS_XCODE_INSTALL_DIR := $(_THEOS_XCODE_INSTALL_DIR_BASE)$(if $(_THEOS_FINAL_PACKAGE),/Products) 54 | 55 | # Try a workspace or project the user has already specified, falling back to figuring out the 56 | # workspace or project ourselves based on the instance name. 57 | ifneq ($($(THEOS_CURRENT_INSTANCE)_XCODE_WORKSPACE),) 58 | _THEOS_XCODEBUILD_PROJECT_FLAG := -workspace $($(THEOS_CURRENT_INSTANCE)_XCODE_WORKSPACE) 59 | else ifneq ($($(THEOS_CURRENT_INSTANCE)_XCODE_PROJECT),) 60 | _THEOS_XCODEBUILD_PROJECT_FLAG := -project $($(THEOS_CURRENT_INSTANCE)_XCODE_PROJECT) 61 | else ifeq ($(call __exists,$(THEOS_CURRENT_INSTANCE).xcworkspace),$(_THEOS_TRUE)) 62 | _THEOS_XCODEBUILD_PROJECT_FLAG := -workspace $(THEOS_CURRENT_INSTANCE).xcworkspace 63 | else 64 | _THEOS_XCODEBUILD_PROJECT_FLAG := -project $(THEOS_CURRENT_INSTANCE).xcodeproj 65 | endif 66 | 67 | _THEOS_XCODEBUILD_BEGIN = $(ECHO_NOTHING)set -eo pipefail; $(TARGET_XCODEBUILD) \ 68 | $(_THEOS_XCODEBUILD_PROJECT_FLAG) \ 69 | -scheme '$(or $($(THEOS_CURRENT_INSTANCE)_XCODE_SCHEME),$(THEOS_CURRENT_INSTANCE))' \ 70 | -destination '$(or $($(THEOS_CURRENT_INSTANCE)_DESTINATION),generic/platform=iOS)' \ 71 | -configuration $(_THEOS_XCODE_BUILD_CONFIG) 72 | _THEOS_XCODEBUILD_END = CODE_SIGNING_ALLOWED=NO \ 73 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO \ 74 | ENABLE_BITCODE=$(or $($(THEOS_CURRENT_INSTANCE)_ENABLE_BITCODE),NO) \ 75 | $(if $(_THEOS_FINAL_PACKAGE),-archivePath $(_THEOS_XCODE_INSTALL_DIR_BASE),DSTROOT=$(_THEOS_XCODE_INSTALL_DIR)) \ 76 | $(_THEOS_XCODE_XCPRETTY)$(ECHO_END) 77 | export EXPANDED_CODE_SIGN_IDENTITY = 78 | export EXPANDED_CODE_SIGN_IDENTITY_NAME = 79 | 80 | __theos_find_and_execute = find $(1) -print0 | xargs -I{} -0 bash -c '$(2) "$$@"' _ {}; 81 | 82 | _THEOS_SIGNABLE_BUNDLE_EXTENSIONS = bundle app framework appex 83 | _THEOS_SIGNABLE_FILE_EXTENSIONS = dylib 84 | 85 | internal-xcodeproj-compile: 86 | ifneq ($(_THEOS_PLATFORM_HAS_XCODE),$(_THEOS_TRUE)) 87 | @$(PRINT_FORMAT_ERROR) "The $(THEOS_CURRENT_INSTANCE) target requires Xcode, but the $(THEOS_PLATFORM_NAME) platform does not support Xcode." >&2; \ 88 | exit 1 89 | endif 90 | $(_THEOS_XCODEBUILD_BEGIN) \ 91 | $(ALL_XCODEOPTS) \ 92 | $(_THEOS_XCODE_BUILD_COMMAND) \ 93 | $(ALL_XCODEFLAGS) \ 94 | $(_THEOS_XCODEBUILD_END) || exit 1 95 | ifeq ($(_THEOS_PACKAGE_FORMAT),deb) 96 | $(ECHO_NOTHING)find $(_THEOS_XCODE_INSTALL_DIR) -name 'libswift*.dylib' -delete$(ECHO_END) 97 | endif 98 | ifneq ($(_THEOS_CODESIGN_COMMANDLINE),) 99 | $(ECHO_SIGNING)function process_exec { \ 100 | $(_THEOS_CODESIGN_COMMANDLINE) $$1; \ 101 | }; \ 102 | function process_dir { \ 103 | $(call __theos_find_and_execute,"$$1" -mindepth 1 -maxdepth 1 -type d,process_dir) \ 104 | $(foreach ext,$(_THEOS_SIGNABLE_FILE_EXTENSIONS),$(call __theos_find_and_execute,"$$1" -mindepth 1 -maxdepth 1 -name '*.$(ext)',process_exec)) \ 105 | full_dir_name="$$(basename "$$(cd "$$1" && pwd -P)")"; \ 106 | full_dir_ext="$${full_dir_name##*.}"; \ 107 | [[ "$${full_dir_name}" = "$${full_dir_ext}" ]] && full_dir_ext=; \ 108 | for ext in $(_THEOS_SIGNABLE_BUNDLE_EXTENSIONS); do \ 109 | if [[ "$${full_dir_ext}" == "$${ext}" ]]; then \ 110 | process_exec "$$1/$$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" $$1/Info.plist)"; \ 111 | return; \ 112 | fi; \ 113 | done; \ 114 | }; \ 115 | export -f process_exec process_dir; \ 116 | process_dir $(_THEOS_XCODE_INSTALL_DIR); \ 117 | $(ECHO_END) 118 | endif 119 | 120 | internal-xcodeproj-clean:: 121 | $(_THEOS_XCODEBUILD_BEGIN) \ 122 | $(ALL_XCODEOPTS) \ 123 | clean \ 124 | $(ALL_XCODEFLAGS) \ 125 | $(_THEOS_XCODEBUILD_END) 126 | 127 | ifneq ($($(THEOS_CURRENT_INSTANCE)_INSTALL),0) 128 | internal-xcodeproj-stage_:: 129 | $(ECHO_NOTHING)mkdir -p "$(THEOS_STAGING_DIR)"$(ECHO_END) 130 | $(ECHO_NOTHING)rsync -a $(_THEOS_XCODE_INSTALL_DIR)/ "$(THEOS_STAGING_DIR)" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE)$(ECHO_END) 131 | endif 132 | 133 | $(eval $(call __mod,instance/xcodeproj.mk)) 134 | -------------------------------------------------------------------------------- /makefiles/legacy.mk: -------------------------------------------------------------------------------- 1 | FRAMEWORKDIR = $(THEOS) 2 | FW_BINDIR = $(THEOS_BIN_PATH) 3 | FW_MAKEDIR = $(THEOS_MAKE_PATH) 4 | FW_INCDIR = $(THEOS_INCLUDE_PATH) 5 | FW_LIBDIR = $(THEOS_LIBRARY_PATH) 6 | FW_MODDIR = $(THEOS_MODULE_PATH) 7 | 8 | FW_PROJECT_DIR = $(THEOS_PROJECT_DIR) 9 | 10 | export FRAMEWORKDIR FW_BINDIR FW_MAKEDIR FW_INCDIR FW_LIBDIR FW_MODDIR 11 | export FW_PROJECT_DIR 12 | 13 | # $(warning ...) expands to the empty string, so the contents of these variables are not damaged. 14 | FW_PLATFORM_NAME = $(THEOS_PLATFORM_NAME)$(warning FW_PLATFORM_NAME is deprecated. Please migrate to THEOS_PLATFORM_NAME.) 15 | FW_TARGET_NAME = $(THEOS_TARGET_NAME)$(warning FW_TARGET_NAME is deprecated. Please migrate to THEOS_TARGET_NAME.) 16 | 17 | FW_STAGING_DIR = $(THEOS_STAGING_DIR)$(warning FW_STAGING_DIR is deprecated. Please migrate to THEOS_STAGING_DIR.) 18 | 19 | ifneq ($(FW_BUILD_DIR),) 20 | $(warning FW_BUILD_DIR is deprecated. Please migrate to THEOS_BUILD_DIR.) 21 | THEOS_BUILD_DIR ?= $(FW_BUILD_DIR) 22 | else 23 | FW_BUILD_DIR = $(THEOS_BUILD_DIR)$(warning FW_BUILD_DIR is deprecated. Please migrate to THEOS_BUILD_DIR.) 24 | endif 25 | 26 | ifneq ($(FW_OBJ_DIR_NAME),) 27 | $(warning FW_OBJ_DIR_NAME is deprecated. Please migrate to THEOS_OBJ_DIR_NAME.) 28 | THEOS_OBJ_DIR_NAME ?= $(FW_OBJ_DIR_NAME) 29 | endif 30 | 31 | FW_OBJ_DIR = $(THEOS_OBJ_DIR)$(warning FW_OBJ_DIR is deprecated. Please migrate to THEOS_OBJ_DIR.) 32 | 33 | ifneq ($(FW_SUBPROJECT_PRODUCT),) 34 | $(warning FW_SUBPROJECT_PRODUCT is deprecated. Please migrate to THEOS_SUBPROJECT_PRODUCT.) 35 | THEOS_SUBPROJECT_PRODUCT ?= $(FW_SUBPROJECT_PRODUCT) 36 | else 37 | FW_SUBPROJECT_PRODUCT = $(THEOS_SUBPROJECT_PRODUCT)$(warning FW_SUBPROJECT_PRODUCT is deprecated. Please migrate to THEOS_SUBPROJECT_PRODUCT.) 38 | endif 39 | 40 | FW_INSTANCE = $(THEOS_CURRENT_INSTANCE)$(warning FW_INSTANCE is deprecated. Please migrate to THEOS_CURRENT_INSTANCE.) 41 | 42 | FW_SHARED_BUNDLE_RESOURCE_PATH = $(THEOS_SHARED_BUNDLE_RESOURCE_PATH)$(warning FW_SHARED_BUNDLE_RESOURCE_PATH is deprecated. Please migrate to THEOS_SHARED_BUNDLE_RESOURCE_PATH.) 43 | FW_PACKAGE_NAME = $(THEOS_PACKAGE_NAME)$(warning FW_PACKAGE_NAME is deprecated. Please migrate to THEOS_PACKAGE_NAME.) 44 | FW_PACKAGE_ARCH = $(THEOS_PACKAGE_ARCH)$(warning FW_PACKAGE_ARCH is deprecated. Please migrate to THEOS_PACKAGE_ARCH.) 45 | FW_PACKAGE_VERSION = $(THEOS_PACKAGE_BASE_VERSION)$(warning FW_PACKAGE_VERSION is deprecated. Please migrate to THEOS_PACKAGE_BASE_VERSION.) 46 | FW_PACKAGE_DEBVERSION = $(call __simplify,FW_PACKAGE_DEBVERSION,$(THEOS_PACKAGE_BASE_VERSION))$(warning FW_PACKAGE_DEBVERSION is deprecated. Please migrate to THEOS_PACKAGE_BASE_VERSION.) 47 | FW_PACKAGE_FILENAME = $(THEOS_PACKAGE_FILENAME)$(warning FW_PACKAGE_FILENAME is deprecated. Please migrate to THEOS_PACKAGE_FILENAME.) 48 | FW_PACKAGE_STAGING_DIR = $(THEOS_STAGING_DIR)$(warning FW_PACKAGE_STAGING_DIR is deprecated. Please migrate to THEOS_STAGING_DIR.) 49 | 50 | ifdef FW_DEVICE_TUNNEL 51 | $(warning FW_DEVICE_TUNNEL is deprecated. Please migrate to THEOS_DEVICE_IP and THEOS_DEVICE_PORT.) 52 | FW_DEVICE_PORT = 2222 53 | FW_DEVICE_IP = 127.0.0.1 54 | endif 55 | 56 | ifneq ($(FW_DEVICE_IP),) 57 | $(warning FW_DEVICE_IP is deprecated. Please migrate to THEOS_DEVICE_IP.) 58 | THEOS_DEVICE_IP ?= $(FW_DEVICE_IP) 59 | endif 60 | 61 | ifneq ($(FW_DEVICE_PORT),) 62 | $(warning FW_DEVICE_PORT is deprecated. Please migrate to THEOS_DEVICE_PORT.) 63 | THEOS_DEVICE_PORT ?= $(FW_DEVICE_PORT) 64 | endif 65 | 66 | THEOS_PACKAGE_VERSION = $(call __simplify,THEOS_PACKAGE_VERSION,$(THEOS_PACKAGE_BASE_VERSION))$(warning THEOS_PACKAGE_VERSION is deprecated. Please migrate to THEOS_PACKAGE_BASE_VERSION.) 67 | 68 | ifeq ($(call __exists,$(THEOS_BUILD_DIR)/debs),$(_THEOS_TRUE)) 69 | ifneq ($(call __exists,$(THEOS_BUILD_DIR)/packages),$(_THEOS_TRUE)) 70 | $(warning The "debs" directory has been renamed to "packages." Moving it.) 71 | $(shell mv "$(THEOS_BUILD_DIR)/debs" "$(THEOS_BUILD_DIR)/packages") 72 | endif 73 | endif 74 | 75 | ifneq ($(ADDITIONAL_CPPFLAGS),) 76 | $(warning ADDITIONAL_CPPFLAGS is deprecated. Please migrate to ADDITIONAL_CCFLAGS.) 77 | ADDITIONAL_CCFLAGS += $(ADDITIONAL_CPPFLAGS) 78 | endif 79 | -------------------------------------------------------------------------------- /makefiles/library.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/library.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),library) 5 | include $(THEOS_MAKE_PATH)/instance/library.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/master/aggregate.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 2 | include $(THEOS_MAKE_PATH)/rules.mk 3 | endif 4 | 5 | SUBPROJECTS := $(strip $(call __schema_var_all,,SUBPROJECTS)) 6 | ifneq ($(SUBPROJECTS),) 7 | internal-all internal-clean:: _OPERATION = $(subst internal-,,$@) 8 | internal-stage internal-after-install internal-after-uninstall:: _OPERATION = $@ 9 | internal-all internal-clean internal-stage internal-after-install internal-after-uninstall:: _OPERATION_NAME = $(subst internal-,,$@) 10 | 11 | internal-all internal-clean internal-stage internal-after-install internal-after-uninstall:: 12 | +@abs_build_dir=$(_THEOS_ABSOLUTE_BUILD_DIR); \ 13 | for d in $(SUBPROJECTS); do \ 14 | $(PRINT_FORMAT_MAKING) "Making $(_OPERATION_NAME) in $$d"; \ 15 | if [[ "$${abs_build_dir}" = "." ]]; then \ 16 | lbuilddir="."; \ 17 | else \ 18 | lbuilddir="$${abs_build_dir}/$$d"; \ 19 | fi; \ 20 | if $(MAKE) -C $$d -f $(_THEOS_PROJECT_MAKEFILE_NAME) --no-keep-going $(_OPERATION) \ 21 | THEOS_BUILD_DIR="$$lbuilddir" \ 22 | ; then\ 23 | :; \ 24 | else exit $$?; \ 25 | fi; \ 26 | done; 27 | endif 28 | 29 | $(eval $(call __mod,master/aggregate.mk)) 30 | -------------------------------------------------------------------------------- /makefiles/master/appex.mk: -------------------------------------------------------------------------------- 1 | APPEX_NAME := $(strip $(APPEX_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(APPEX_NAME:=.all.appex.variables); 8 | 9 | internal-stage:: $(APPEX_NAME:=.stage.appex.variables); 10 | 11 | APPEXS_WITH_SUBPROJECTS = $(strip $(foreach appex,$(APPEX_NAME),$(patsubst %,$(appex),$(call __schema_var_all,$(appex)_,SUBPROJECTS)))) 12 | ifneq ($(APPEXS_WITH_SUBPROJECTS),) 13 | internal-clean:: $(APPEXS_WITH_SUBPROJECTS:=.clean.appex.subprojects) 14 | endif 15 | 16 | $(APPEX_NAME): 17 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.appex.variables 18 | 19 | $(eval $(call __mod,master/appex.mk)) 20 | -------------------------------------------------------------------------------- /makefiles/master/application.mk: -------------------------------------------------------------------------------- 1 | APPLICATION_NAME := $(strip $(APPLICATION_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(APPLICATION_NAME:=.all.application.variables); 8 | 9 | internal-stage:: $(APPLICATION_NAME:=.stage.application.variables); 10 | 11 | # Maybe, disabled for further discussion 12 | # install.exec "uicache" 13 | internal-after-install:: 14 | 15 | APPLICATIONS_WITH_SUBPROJECTS = $(strip $(foreach application,$(APPLICATION_NAME),$(patsubst %,$(application),$(call __schema_var_all,$(application)_,SUBPROJECTS)))) 16 | ifneq ($(APPLICATIONS_WITH_SUBPROJECTS),) 17 | internal-clean:: $(APPLICATIONS_WITH_SUBPROJECTS:=.clean.application.subprojects) 18 | endif 19 | 20 | $(APPLICATION_NAME): 21 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.application.variables 22 | 23 | $(eval $(call __mod,master/application.mk)) 24 | -------------------------------------------------------------------------------- /makefiles/master/bundle.mk: -------------------------------------------------------------------------------- 1 | BUNDLE_NAME := $(strip $(BUNDLE_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(BUNDLE_NAME:=.all.bundle.variables); 8 | 9 | internal-stage:: $(BUNDLE_NAME:=.stage.bundle.variables); 10 | 11 | BUNDLES_WITH_SUBPROJECTS = $(strip $(foreach bundle,$(BUNDLE_NAME),$(patsubst %,$(bundle),$(call __schema_var_all,$(bundle)_,SUBPROJECTS)))) 12 | ifneq ($(BUNDLES_WITH_SUBPROJECTS),) 13 | internal-clean:: $(BUNDLES_WITH_SUBPROJECTS:=.clean.bundle.subprojects) 14 | endif 15 | 16 | $(BUNDLE_NAME): 17 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.bundle.variables 18 | 19 | $(eval $(call __mod,master/bundle.mk)) 20 | -------------------------------------------------------------------------------- /makefiles/master/framework.mk: -------------------------------------------------------------------------------- 1 | FRAMEWORK_NAME := $(strip $(FRAMEWORK_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(FRAMEWORK_NAME:=.all.framework.variables); 8 | 9 | internal-stage:: $(FRAMEWORK_NAME:=.stage.framework.variables); 10 | 11 | FRAMEWORKS_WITH_SUBPROJECTS = $(strip $(foreach framework,$(FRAMEWORK_NAME),$(patsubst %,$(framework),$(call __schema_var_all,$(framework)_,SUBPROJECTS)))) 12 | ifneq ($(FRAMEWORKS_WITH_SUBPROJECTS),) 13 | internal-clean:: $(FRAMEWORKS_WITH_SUBPROJECTS:=.clean.framework.subprojects) 14 | endif 15 | 16 | $(FRAMEWORK_NAME): 17 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.framework.variables 18 | 19 | $(eval $(call __mod,master/framework.mk)) 20 | -------------------------------------------------------------------------------- /makefiles/master/library.mk: -------------------------------------------------------------------------------- 1 | LIBRARY_NAME := $(strip $(LIBRARY_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(LIBRARY_NAME:=.all.library.variables); 8 | 9 | internal-stage:: $(LIBRARY_NAME:=.stage.library.variables); 10 | 11 | LIBRARYS_WITH_SUBPROJECTS = $(strip $(foreach library,$(LIBRARY_NAME),$(patsubst %,$(library),$(call __schema_var_all,$(library)_,SUBPROJECTS)))) 12 | ifneq ($(LIBRARYS_WITH_SUBPROJECTS),) 13 | internal-clean:: $(LIBRARYS_WITH_SUBPROJECTS:=.clean.library.subprojects) 14 | endif 15 | 16 | $(LIBRARY_NAME): 17 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.library.variables 18 | 19 | $(eval $(call __mod,master/library.mk)) 20 | -------------------------------------------------------------------------------- /makefiles/master/null.mk: -------------------------------------------------------------------------------- 1 | NULL_NAME := $(strip $(NULL_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(NULL_NAME:=.all.null.variables); 8 | 9 | internal-stage:: $(NULL_NAME:=.stage.null.variables); 10 | 11 | NULLS_WITH_SUBPROJECTS = $(strip $(foreach null,$(NULL_NAME),$(patsubst %,$(null),$(call __schema_var_all,$(null)_,SUBPROJECTS)))) 12 | ifneq ($(NULLS_WITH_SUBPROJECTS),) 13 | internal-clean:: $(NULLS_WITH_SUBPROJECTS:=.clean.null.subprojects) 14 | endif 15 | 16 | $(NULL_NAME): 17 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.null.variables 18 | 19 | $(eval $(call __mod,master/null.mk)) 20 | -------------------------------------------------------------------------------- /makefiles/master/rules.mk: -------------------------------------------------------------------------------- 1 | __THEOS_RULES_MK_VERSION := 1k 2 | ifneq ($(__THEOS_RULES_MK_VERSION),$(__THEOS_COMMON_MK_VERSION)) 3 | all:: 4 | @echo "Theos version mismatch! common.mk [version $(or $(__THEOS_COMMON_MK_VERSION),0)] loaded in tandem with rules.mk [version $(or $(__THEOS_RULES_MK_VERSION),0)] Check that \$$\(THEOS\) is set properly!" >&2; exit 1 5 | endif 6 | 7 | # Determine whether we are on a modern enough version of make for us to enable parallel building. 8 | # --output-sync was added in make 4.0; output is hard to read without it. Xcode includes make 3.81. 9 | ifeq ($(_THEOS_IS_MAKE_GT_4_0),) 10 | _THEOS_IS_MAKE_GT_4_0 := $(call __vercmp,$(MAKE_VERSION),gt,4.0) 11 | endif 12 | 13 | ifeq ($(THEOS_USE_PARALLEL_BUILDING),) 14 | ifeq ($(_THEOS_IS_MAKE_GT_4_0)$(THEOS_IGNORE_PARALLEL_BUILDING_NOTICE),) 15 | ifneq ($(shell $(or $(_THEOS_PLATFORM_GET_LOGICAL_CORES),:)),1) 16 | all:: 17 | @$(PRINT_FORMAT) "Build may be slow as Theos isn’t using all available CPU cores on this computer. Consider upgrading GNU Make: https://theos.dev/docs/parallel-building" 18 | endif 19 | endif 20 | THEOS_USE_PARALLEL_BUILDING := $(_THEOS_IS_MAKE_GT_4_0) 21 | endif 22 | export THEOS_USE_PARALLEL_BUILDING 23 | 24 | # This is effectively THEOS_USE_PARALLEL_BUILDING canonicalized 25 | ifeq ($(_THEOS_INTERNAL_USE_PARALLEL_BUILDING),) 26 | _THEOS_INTERNAL_USE_PARALLEL_BUILDING := $(call __theos_bool,$(THEOS_USE_PARALLEL_BUILDING)) 27 | endif 28 | export _THEOS_INTERNAL_USE_PARALLEL_BUILDING 29 | 30 | # certain conditions need to execute, semantically, when we're 31 | # running the first `all`. This is usually when MAKELEVEL == 0 32 | # but is in fact MAKELEVEL == 1 if we're running `troubleshoot` 33 | _THEOS_TOP_ALL_MAKELEVEL := $(if $(THEOS_IS_TROUBLESHOOTING),1,0) 34 | ifeq ($(MAKELEVEL),$(_THEOS_TOP_ALL_MAKELEVEL)) 35 | _THEOS_IS_TOP_ALL := $(_THEOS_TRUE) 36 | endif 37 | 38 | ifeq ($(MAKELEVEL)$(_THEOS_INTERNAL_USE_PARALLEL_BUILDING),0$(_THEOS_TRUE)) 39 | # If jobs haven’t already been specified, and we know how to get the number of logical cores on this 40 | # platform, set jobs to the logical core count (CPU cores multiplied by threads per core). 41 | ifneq ($(_THEOS_PLATFORM_GET_LOGICAL_CORES),) 42 | MAKEFLAGS += -j$(shell $(_THEOS_PLATFORM_GET_LOGICAL_CORES)) -Otarget 43 | endif 44 | endif 45 | 46 | _THEOS_SWIFT_AUXILIARY_DIR = $(_THEOS_LOCAL_DATA_DIR)/swift 47 | _THEOS_SWIFT_MUTEX_FILE = $(_THEOS_SWIFT_AUXILIARY_DIR)/output.lock 48 | export _THEOS_SWIFT_MARKERS_DIR = $(_THEOS_SWIFT_AUXILIARY_DIR)/markers 49 | 50 | ifeq ($(_THEOS_INTERNAL_USE_PARALLEL_BUILDING),$(_THEOS_TRUE)) 51 | export _THEOS_SWIFT_MUTEX = $(_THEOS_SWIFT_MUTEX_FILE) 52 | else 53 | export _THEOS_SWIFT_MUTEX = - 54 | endif 55 | 56 | .PHONY: all before-all internal-all after-all \ 57 | clean before-clean internal-clean after-clean \ 58 | clean-packages before-clean-packages internal-clean-packages after-clean-packages \ 59 | before-commands commands \ 60 | update-theos spm 61 | ifeq ($(THEOS_BUILD_DIR),.) 62 | all:: $(_THEOS_BUILD_SESSION_FILE) before-all internal-all after-all 63 | else 64 | all:: $(THEOS_BUILD_DIR) $(_THEOS_BUILD_SESSION_FILE) before-all internal-all after-all 65 | endif 66 | 67 | clean:: before-clean internal-clean after-clean 68 | 69 | do:: all package install 70 | 71 | before-all:: 72 | # If the chosen sdk doesn’t exist, the sysroot will be blank, bail out. 73 | ifeq ($(SYSROOT),) 74 | $(ERROR_BEGIN) "Your chosen SDK, “$(_THEOS_TARGET_PLATFORM_SDK_NAME)$(_THEOS_TARGET_SDK_VERSION).sdk”, does not appear to exist." $(ERROR_END) 75 | else 76 | # If the SYSROOT is set but doesn’t exist, bail out. 77 | ifneq ($(call __exists,$(SYSROOT)),$(_THEOS_TRUE)) 78 | $(ERROR_BEGIN) "Your chosen SYSROOT, “$(SYSROOT)”, does not appear to exist." $(ERROR_END) 79 | endif 80 | endif 81 | 82 | # If a vendored path is missing, bail out. 83 | ifneq ($(call __exists,$(THEOS_VENDOR_INCLUDE_PATH)/.git)$(call __exists,$(THEOS_VENDOR_LIBRARY_PATH)/.git),$(_THEOS_TRUE)$(_THEOS_TRUE)) 84 | $(ERROR_BEGIN) "The vendor/include and/or vendor/lib directories are missing. Please run \`$(THEOS)/bin/update-theos\`. More information: https://theos.dev/install" $(ERROR_END) 85 | endif 86 | 87 | ifeq ($(_THEOS_IS_TOP_ALL),$(_THEOS_TRUE)) 88 | $(ECHO_NOTHING)rm -rf $(_THEOS_SWIFT_AUXILIARY_DIR)$(ECHO_END) 89 | $(ECHO_NOTHING)mkdir -p $(_THEOS_SWIFT_AUXILIARY_DIR) $(_THEOS_SWIFT_MARKERS_DIR)$(ECHO_END) 90 | endif 91 | 92 | internal-all:: 93 | 94 | after-all:: 95 | 96 | before-clean:: 97 | 98 | internal-clean:: 99 | $(ECHO_CLEANING)rm -rf "$(subst $(_THEOS_OBJ_DIR_EXTENSION),,$(THEOS_OBJ_DIR))"$(ECHO_END) 100 | 101 | ifeq ($(call __exists,$(_THEOS_BUILD_SESSION_FILE)),$(_THEOS_TRUE)) 102 | $(ECHO_NOTHING)rm "$(_THEOS_BUILD_SESSION_FILE)"$(ECHO_END) 103 | $(ECHO_NOTHING)touch "$(_THEOS_BUILD_SESSION_FILE)"$(ECHO_END) 104 | endif 105 | 106 | ifeq ($(MAKELEVEL),0) 107 | $(ECHO_NOTHING)rm -rf "$(THEOS_STAGING_DIR)" "$(_THEOS_STAGING_TMP)" "$(_THEOS_SWIFT_AUXILIARY_DIR)" "$(_THEOS_TMP_COMPILE_COMMANDS_FILE)"$(ECHO_END) 108 | endif 109 | 110 | after-clean:: 111 | 112 | ifeq ($(MAKELEVEL),0) 113 | ifneq ($(THEOS_BUILD_DIR),.) 114 | _THEOS_ABSOLUTE_BUILD_DIR = $(call __clean_pwd,$(THEOS_BUILD_DIR)) 115 | else 116 | _THEOS_ABSOLUTE_BUILD_DIR = . 117 | endif 118 | else 119 | _THEOS_ABSOLUTE_BUILD_DIR = $(strip $(THEOS_BUILD_DIR)) 120 | endif 121 | 122 | clean-packages:: before-clean-packages internal-clean-packages after-clean-packages 123 | 124 | before-clean-packages:: 125 | 126 | internal-clean-packages:: 127 | $(ECHO_NOTHING)rm -rf $(THEOS_PACKAGE_DIR)/$(THEOS_PACKAGE_NAME)_*-*_$(THEOS_PACKAGE_ARCH).deb$(ECHO_END) 128 | $(ECHO_NOTHING)rm -rf $(THEOS_PACKAGE_DIR)/$(THEOS_PACKAGE_NAME)-*-*.$(THEOS_PACKAGE_ARCH).rpm$(ECHO_END) 129 | 130 | after-clean-packages:: 131 | 132 | $(_THEOS_BUILD_SESSION_FILE): 133 | @mkdir -p $(_THEOS_LOCAL_DATA_DIR) 134 | 135 | ifeq ($(call __exists,$(_THEOS_BUILD_SESSION_FILE)),$(_THEOS_FALSE)) 136 | @touch $(_THEOS_BUILD_SESSION_FILE) 137 | endif 138 | 139 | .PRECIOUS: %.variables %.subprojects 140 | 141 | %.variables: _INSTANCE = $(basename $(basename $*)) 142 | %.variables: _OPERATION = $(subst .,,$(suffix $(basename $*))) 143 | %.variables: _TYPE = $(subst -,_,$(subst .,,$(suffix $*))) 144 | %.variables: __SUBPROJECTS = $(strip $(call __schema_var_all,$(_INSTANCE)_,SUBPROJECTS)) 145 | %.variables: 146 | +@ \ 147 | abs_build_dir=$(_THEOS_ABSOLUTE_BUILD_DIR); \ 148 | if [[ "$(__SUBPROJECTS)" != "" ]]; then \ 149 | $(PRINT_FORMAT_MAKING) "Making $(_OPERATION) in subprojects of $(_TYPE) $(_INSTANCE)"; \ 150 | for d in $(__SUBPROJECTS); do \ 151 | d="$${d%:*}"; \ 152 | if [[ "$${abs_build_dir}" = "." ]]; then \ 153 | lbuilddir="."; \ 154 | else \ 155 | lbuilddir="$${abs_build_dir}/$$d"; \ 156 | fi; \ 157 | if $(MAKE) -C $$d -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $(_OPERATION) \ 158 | THEOS_BUILD_DIR="$$lbuilddir" \ 159 | ; then\ 160 | :; \ 161 | else exit $$?; \ 162 | fi; \ 163 | done; \ 164 | fi; \ 165 | $(PRINT_FORMAT_MAKING) "Making $(_OPERATION) for $(_TYPE) $(_INSTANCE)"; \ 166 | $(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) \ 167 | internal-$(_TYPE)-$(_OPERATION) \ 168 | _THEOS_CURRENT_TYPE="$(_TYPE)" \ 169 | THEOS_CURRENT_INSTANCE="$(_INSTANCE)" \ 170 | _THEOS_CURRENT_OPERATION="$(_OPERATION)" \ 171 | THEOS_BUILD_DIR="$(_THEOS_ABSOLUTE_BUILD_DIR)" 172 | 173 | %.subprojects: _INSTANCE = $(basename $(basename $*)) 174 | %.subprojects: _OPERATION = $(subst .,,$(suffix $(basename $*))) 175 | %.subprojects: _TYPE = $(subst -,_,$(subst .,,$(suffix $*))) 176 | %.subprojects: __SUBPROJECTS = $(strip $(call __schema_var_all,$(_INSTANCE)_,SUBPROJECTS)) 177 | %.subprojects: 178 | +@ \ 179 | abs_build_dir=$(_THEOS_ABSOLUTE_BUILD_DIR); \ 180 | if [[ "$(__SUBPROJECTS)" != "" ]]; then \ 181 | $(PRINT_FORMAT_MAKING) "Making $(_OPERATION) in subprojects of $(_TYPE) $(_INSTANCE)"; \ 182 | for d in $(__SUBPROJECTS); do \ 183 | d="$${d%:*}"; \ 184 | if [[ "$${abs_build_dir}" = "." ]]; then \ 185 | lbuilddir="."; \ 186 | else \ 187 | lbuilddir="$${abs_build_dir}/$$d"; \ 188 | fi; \ 189 | if $(MAKE) -C $$d -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $(_OPERATION) \ 190 | THEOS_BUILD_DIR="$$lbuilddir" \ 191 | ; then\ 192 | :; \ 193 | else exit $$?; \ 194 | fi; \ 195 | done; \ 196 | fi 197 | 198 | update-theos:: 199 | @$(PRINT_FORMAT_MAKING) "Updating Theos" 200 | $(ECHO_NOTHING)$(THEOS_BIN_PATH)/update-theos$(ECHO_END) 201 | 202 | troubleshoot:: 203 | @$(PRINT_FORMAT) "Be sure to check the troubleshooting page at https://theos.dev/docs/troubleshooting first." 204 | @$(PRINT_FORMAT) "For support with build errors, ask on Discord: https://theos.dev/discord. If you think you've found a bug in Theos, check the issue tracker at: https://github.com/theos/theos/issues" 205 | @echo 206 | 207 | ifeq ($(call __executable,gh),$(_THEOS_TRUE)) 208 | @$(PRINT_FORMAT) "Creating a Gist containing the output of \`make clean all messages=yes\`…" 209 | +$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) --no-print-directory --no-keep-going clean all messages=yes COLOR=no THEOS_IS_TROUBLESHOOTING=1 2>&1 | tee /dev/tty | gh gist create - -d "Theos troubleshoot output" 210 | else 211 | $(ERROR_BEGIN) "You don't have the GitHub CLI installed. For more information, refer to: https://cli.github.com/" $(ERROR_END) 212 | endif 213 | 214 | # The SPM config is a simple key-value file used to pass build settings to Package.swift. 215 | # Each line is either empty or starts with a (unique) key, followed by an equals sign, 216 | # followed by the key's value. 217 | spm:: 218 | @$(PRINT_FORMAT_MAKING) "Creating SPM config" 219 | @mkdir -p $(_THEOS_LOCAL_DATA_DIR) 220 | $(ECHO_NOTHING)rm -f $(_THEOS_SPM_CONFIG_FILE)$(ECHO_END) 221 | $(ECHO_NOTHING)echo "theos=$(THEOS)" >> $(_THEOS_SPM_CONFIG_FILE)$(ECHO_END) 222 | $(ECHO_NOTHING)echo "sdk=$(SYSROOT)" >> $(_THEOS_SPM_CONFIG_FILE)$(ECHO_END) 223 | $(ECHO_NOTHING)echo "deploymentTarget=$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION)" >> $(_THEOS_SPM_CONFIG_FILE)$(ECHO_END) 224 | $(ECHO_NOTHING)echo "swiftResourceDir=$(_THEOS_TARGET_SWIFT_RESOURCE_DIR)" >> $(_THEOS_SPM_CONFIG_FILE)$(ECHO_END) 225 | 226 | before-commands:: 227 | @: $(eval export THEOS_GEN_COMPILE_COMMANDS=$(_THEOS_TRUE)) 228 | 229 | commands:: before-commands clean all 230 | @$(PRINT_FORMAT_MAKING) "Writing $(notdir $(_THEOS_COMPILE_COMMANDS_FILE))" 231 | $(ECHO_NOTHING)mv -f $(_THEOS_TMP_COMPILE_COMMANDS_FILE) $(_THEOS_COMPILE_COMMANDS_FILE)$(ECHO_END) 232 | 233 | $(eval $(call __mod,master/rules.mk)) 234 | 235 | ifeq ($(_THEOS_TOP_INVOCATION_DONE),$(_THEOS_FALSE)) 236 | export _THEOS_TOP_INVOCATION_DONE = 1 237 | endif 238 | -------------------------------------------------------------------------------- /makefiles/master/simbltweak.mk: -------------------------------------------------------------------------------- 1 | SIMBLTWEAK_NAME := $(strip $(SIMBLTWEAK_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(SIMBLTWEAK_NAME:=.all.simbltweak.variables); 8 | 9 | internal-stage:: $(SIMBLTWEAK_NAME:=.stage.simbltweak.variables); 10 | 11 | internal-after-install:: 12 | 13 | SIMBLTWEAKS_WITH_SUBPROJECTS = $(strip $(foreach simbltweak,$(SIMBLTWEAK_NAME),$(patsubst %,$(simbltweak),$(call __schema_var_all,$(simbltweak)_,SUBPROJECTS)))) 14 | ifneq ($(SIMBLTWEAKS_WITH_SUBPROJECTS),) 15 | internal-clean:: $(SIMBLTWEAKS_WITH_SUBPROJECTS:=.clean.simbltweak.subprojects) 16 | endif 17 | 18 | $(SIMBLTWEAK_NAME): 19 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.simbltweak.variables 20 | 21 | $(eval $(call __mod,master/simbltweak.mk)) 22 | -------------------------------------------------------------------------------- /makefiles/master/subproject.mk: -------------------------------------------------------------------------------- 1 | SUBPROJECT_NAME := $(strip $(SUBPROJECT_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(SUBPROJECT_NAME:=.all.subproject.variables); 8 | 9 | internal-stage:: $(SUBPROJECT_NAME:=.stage.subproject.variables); 10 | 11 | SUBPROJECTS_WITH_SUBPROJECTS = $(strip $(foreach subproject,$(SUBPROJECT_NAME),$(patsubst %,$(subproject),$(call __schema_var_all,$(subproject)_,SUBPROJECTS)))) 12 | ifneq ($(SUBPROJECTS_WITH_SUBPROJECTS),) 13 | internal-clean:: $(SUBPROJECTS_WITH_SUBPROJECTS:=.clean.subproject.subprojects) 14 | endif 15 | 16 | $(SUBPROJECT_NAME): 17 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.subproject.variables 18 | 19 | $(eval $(call __mod,master/subproject.mk)) 20 | -------------------------------------------------------------------------------- /makefiles/master/tool.mk: -------------------------------------------------------------------------------- 1 | TOOL_NAME := $(strip $(TOOL_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(TOOL_NAME:=.all.tool.variables); 8 | 9 | internal-stage:: $(TOOL_NAME:=.stage.tool.variables); 10 | 11 | TOOLS_WITH_SUBPROJECTS = $(strip $(foreach tool,$(TOOL_NAME),$(patsubst %,$(tool),$(call __schema_var_all,$(tool)_,SUBPROJECTS)))) 12 | ifneq ($(TOOLS_WITH_SUBPROJECTS),) 13 | internal-clean:: $(TOOLS_WITH_SUBPROJECTS:=.clean.tool.subprojects) 14 | endif 15 | 16 | $(TOOL_NAME): 17 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.tool.variables 18 | 19 | $(eval $(call __mod,master/tool.mk)) 20 | -------------------------------------------------------------------------------- /makefiles/master/tweak.mk: -------------------------------------------------------------------------------- 1 | TWEAK_NAME := $(strip $(TWEAK_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(TWEAK_NAME:=.all.tweak.variables); 8 | 9 | internal-stage:: $(TWEAK_NAME:=.stage.tweak.variables); 10 | 11 | ifneq ($(TWEAK_TARGET_PROCESS),) 12 | INSTALL_TARGET_PROCESSES += $(TWEAK_TARGET_PROCESS) 13 | endif 14 | 15 | TWEAKS_WITH_SUBPROJECTS = $(strip $(foreach tweak,$(TWEAK_NAME),$(patsubst %,$(tweak),$(call __schema_var_all,$(tweak)_,SUBPROJECTS)))) 16 | ifneq ($(TWEAKS_WITH_SUBPROJECTS),) 17 | internal-clean:: $(TWEAKS_WITH_SUBPROJECTS:=.clean.tweak.subprojects) 18 | endif 19 | 20 | $(TWEAK_NAME): 21 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.tweak.variables 22 | 23 | $(eval $(call __mod,master/tweak.mk)) 24 | -------------------------------------------------------------------------------- /makefiles/master/xcodeproj.mk: -------------------------------------------------------------------------------- 1 | XCODEPROJ_NAME := $(strip $(XCODEPROJ_NAME)) 2 | 3 | ifeq ($(_THEOS_RULES_LOADED),) 4 | include $(THEOS_MAKE_PATH)/rules.mk 5 | endif 6 | 7 | internal-all:: $(XCODEPROJ_NAME:=.all.xcodeproj.variables); 8 | 9 | internal-stage:: $(XCODEPROJ_NAME:=.stage.xcodeproj.variables); 10 | 11 | internal-clean:: $(XCODEPROJ_NAME:=.clean.xcodeproj.variables); 12 | 13 | XCODEPROJ_WITH_SUBPROJECTS = $(strip $(foreach xcodeproj,$(XCODEPROJ_NAME),$(patsubst %,$(xcodeproj),$(call __schema_var_all,$(xcodeproj)_,SUBPROJECTS)))) 14 | ifneq ($(XCODEPROJ_WITH_SUBPROJECTS),) 15 | internal-clean:: $(XCODEPROJ_WITH_SUBPROJECTS:=.clean.xcodeproj.subprojects) 16 | endif 17 | 18 | $(XCODEPROJ_NAME): 19 | $(ECHO_MAKE)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) $(_THEOS_MAKEFLAGS) $@.all.xcodeproj.variables 20 | 21 | $(eval $(call __mod,master/xcodeproj.mk)) 22 | -------------------------------------------------------------------------------- /makefiles/messages.mk: -------------------------------------------------------------------------------- 1 | NULLSTRING := 2 | 3 | ECHO_PIPEFAIL := set -o pipefail; 4 | 5 | _THEOS_VERBOSE := $(call __theos_bool,$(or $(messages),$(MESSAGES))) 6 | 7 | ifeq ($(_THEOS_VERBOSE),$(_THEOS_TRUE)) 8 | ECHO_BEGIN = ( 9 | ECHO_NOTHING = $(ECHO_PIPEFAIL) ( 10 | ECHO_MAKE = + 11 | ECHO_END = ) 12 | 13 | ifeq ($(call __executable,unbuffer),$(_THEOS_TRUE)) 14 | ECHO_UNBUFFERED = unbuffer $(NULLSTRING) 15 | else 16 | ECHO_UNBUFFERED = 17 | endif 18 | 19 | STDERR_NULL_REDIRECT = 20 | STDOUT_NULL_REDIRECT = 21 | else 22 | ECHO_BEGIN = @( 23 | ECHO_NOTHING = @( 24 | ECHO_MAKE = +@ 25 | ECHO_UNBUFFERED = 26 | ECHO_END = ) 27 | 28 | STDERR_NULL_REDIRECT = 2> /dev/null 29 | STDOUT_NULL_REDIRECT = > /dev/null 30 | endif 31 | 32 | ifeq ($(call __theos_bool,$(COLOR)),$(_THEOS_TRUE)) 33 | PRINT_FORMAT = printf "\e[0;36m==> \e[1;36mNotice:\e[m %s\n" 34 | PRINT_FORMAT_MAKING = printf "\e[1;31m> \e[1;3;39m%s…\e[m\n" 35 | PRINT_FORMAT_STAGE = printf "\e[0;3%im==> \e[1;39m%s…\e[m\n" 36 | PRINT_FORMAT_RED = $(PRINT_FORMAT_STAGE) 1 37 | PRINT_FORMAT_GREEN = $(PRINT_FORMAT_STAGE) 2 38 | PRINT_FORMAT_YELLOW = $(PRINT_FORMAT_STAGE) 3 39 | PRINT_FORMAT_BLUE = $(PRINT_FORMAT_STAGE) 4 40 | PRINT_FORMAT_MAGENTA = $(PRINT_FORMAT_STAGE) 5 41 | PRINT_FORMAT_CYAN = $(PRINT_FORMAT_STAGE) 6 42 | PRINT_FORMAT_WARNING = printf "\e[0;33m==> \e[1;33mWarning:\e[m %s\n" 43 | PRINT_FORMAT_ERROR = printf "\e[0;31m==> \e[1;31mError:\e[m %s\n" 44 | else 45 | PRINT_FORMAT = printf "==> Notice: %s\n" 46 | PRINT_FORMAT_MAKING = printf "> %s...\n" 47 | PRINT_FORMAT_STAGE = printf "==> %s...\n" 48 | PRINT_FORMAT_RED = $(PRINT_FORMAT_STAGE) 49 | PRINT_FORMAT_GREEN = $(PRINT_FORMAT_STAGE) 50 | PRINT_FORMAT_YELLOW = $(PRINT_FORMAT_STAGE) 51 | PRINT_FORMAT_BLUE = $(PRINT_FORMAT_STAGE) 52 | PRINT_FORMAT_MAGENTA = $(PRINT_FORMAT_STAGE) 53 | PRINT_FORMAT_CYAN = $(PRINT_FORMAT_STAGE) 54 | PRINT_FORMAT_WARNING = printf "==> Warning: %s\n" 55 | PRINT_FORMAT_ERROR = printf "==> Error: %s\n" 56 | endif 57 | 58 | ECHO_PREPROCESSING = $(ECHO_BEGIN)$(PRINT_FORMAT_RED) "Preprocessing $<"$(ECHO_END); $(ECHO_PIPEFAIL) ( 59 | ECHO_PREPROCESSING_XSWIFT = $(ECHO_BEGIN)$(PRINT_FORMAT_RED) "Preprocessing $(subst $(_SPACE),$(_COMMA) ,$^)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 60 | 61 | ifneq ($(THEOS_CURRENT_ARCH),) 62 | ECHO_COMPILING = $(ECHO_BEGIN)$(PRINT_FORMAT_GREEN) "Compiling $< ($(THEOS_CURRENT_ARCH))"$(ECHO_END); $(ECHO_PIPEFAIL) ( 63 | ECHO_LINKING = $(ECHO_BEGIN)$(PRINT_FORMAT_YELLOW) "Linking $(_THEOS_CURRENT_TYPE) $(THEOS_CURRENT_INSTANCE) ($(THEOS_CURRENT_ARCH))"$(ECHO_END); $(ECHO_PIPEFAIL) ( 64 | ECHO_STATIC_LINKING = $(ECHO_BEGIN)$(PRINT_FORMAT_YELLOW) "Linking static $(_THEOS_CURRENT_TYPE) $(THEOS_CURRENT_INSTANCE) ($(THEOS_CURRENT_ARCH))"$(ECHO_END); $(ECHO_PIPEFAIL) ( 65 | ECHO_LINKING_WITH_STRIP = $(ECHO_BEGIN)$(PRINT_FORMAT_YELLOW) "Linking $(_THEOS_CURRENT_TYPE) $(THEOS_CURRENT_INSTANCE) (with strip, $(THEOS_CURRENT_ARCH))"$(ECHO_END); $(ECHO_PIPEFAIL) ( 66 | ECHO_STRIPPING = $(ECHO_BEGIN)$(PRINT_FORMAT_BLUE) "Stripping $(THEOS_CURRENT_INSTANCE) ($(THEOS_CURRENT_ARCH))"$(ECHO_END); $(ECHO_PIPEFAIL) ( 67 | else 68 | ECHO_COMPILING = $(ECHO_BEGIN)$(PRINT_FORMAT_GREEN) "Compiling $<"$(ECHO_END); $(ECHO_PIPEFAIL) ( 69 | ECHO_LINKING = $(ECHO_BEGIN)$(PRINT_FORMAT_YELLOW) "Linking $(_THEOS_CURRENT_TYPE) $(THEOS_CURRENT_INSTANCE)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 70 | ECHO_STATIC_LINKING = $(ECHO_BEGIN)$(PRINT_FORMAT_YELLOW) "Linking static $(_THEOS_CURRENT_TYPE) $(THEOS_CURRENT_INSTANCE)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 71 | ECHO_LINKING_WITH_STRIP = $(ECHO_BEGIN)$(PRINT_FORMAT_YELLOW) "Linking $(_THEOS_CURRENT_TYPE) $(THEOS_CURRENT_INSTANCE) (with strip)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 72 | ECHO_STRIPPING = $(ECHO_BEGIN)$(PRINT_FORMAT_BLUE) "Stripping $(THEOS_CURRENT_INSTANCE)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 73 | endif 74 | 75 | ECHO_MERGING = $(ECHO_BEGIN)$(PRINT_FORMAT_BLUE) "Merging $(_THEOS_CURRENT_TYPE) $(THEOS_CURRENT_INSTANCE)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 76 | ECHO_SIGNING = $(ECHO_BEGIN)$(PRINT_FORMAT_BLUE) "Signing $(THEOS_CURRENT_INSTANCE)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 77 | ECHO_DEBUG_SYMBOLS = $(ECHO_BEGIN)$(PRINT_FORMAT_BLUE) "Generating debug symbols for $(THEOS_CURRENT_INSTANCE)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 78 | ECHO_COPYING_RESOURCE_FILES = $(ECHO_BEGIN)$(PRINT_FORMAT_MAGENTA) "Copying resource files into the $(_THEOS_CURRENT_TYPE) wrapper"$(ECHO_END); $(ECHO_PIPEFAIL) ( 79 | ECHO_COPYING_RESOURCE_DIRS = $(ECHO_BEGIN)$(PRINT_FORMAT_MAGENTA) "Copying resource directories into the $(_THEOS_CURRENT_TYPE) wrapper"$(ECHO_END); $(ECHO_PIPEFAIL) ( 80 | ECHO_COPYING_PUBLIC_HEADERS = $(ECHO_BEGIN)$(PRINT_FORMAT_MAGENTA) "Copying public headers into the $(_THEOS_CURRENT_TYPE) wrapper"$(ECHO_END); $(ECHO_PIPEFAIL) ( 81 | ifeq ($(THEOS_PACKAGE_SCHEME),) 82 | ECHO_COPYING_FRAMEWORK = $(ECHO_BEGIN)$(PRINT_FORMAT_MAGENTA) "Installing $(_THEOS_CURRENT_TYPE) to $(THEOS_LIBRARY_PATH)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 83 | else 84 | ECHO_COPYING_FRAMEWORK = $(ECHO_BEGIN)$(PRINT_FORMAT_MAGENTA) "Installing $(_THEOS_CURRENT_TYPE) to $(THEOS_LIBRARY_PATH)/$(THEOS_TARGET_NAME)/$(or $(THEOS_PACKAGE_SCHEME),rootful)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 85 | endif 86 | ECHO_PRE_UNLOADING = $(ECHO_BEGIN)$(PRINT_FORMAT_CYAN) "Unloading $(PREINSTALL_TARGET_PROCESSES)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 87 | ECHO_INSTALLING = $(ECHO_BEGIN)$(PRINT_FORMAT_CYAN) "Installing"$(ECHO_END); $(ECHO_PIPEFAIL) ( 88 | ECHO_UNLOADING = $(ECHO_BEGIN)$(PRINT_FORMAT_CYAN) "Unloading $(INSTALL_TARGET_PROCESSES)"$(ECHO_END); $(ECHO_PIPEFAIL) ( 89 | ECHO_CLEANING = $(ECHO_BEGIN)$(PRINT_FORMAT_CYAN) "Cleaning"$(ECHO_END); $(ECHO_PIPEFAIL) ( 90 | 91 | ERROR_BEGIN = @$(PRINT_FORMAT_ERROR) $(NULLSTRING) 92 | ERROR_END = $(NULLSTRING) >&2; exit 1; 93 | 94 | WARNING_EMPTY_LINKING = @$(PRINT_FORMAT_WARNING) "No files to link. Please check your Makefile! Make sure you set $(THEOS_CURRENT_INSTANCE)_FILES (or similar variables)." 95 | 96 | # (bundle) 97 | NOTICE_EMPTY_LINKING = @$(PRINT_FORMAT_WARNING) "No files to link - creating a bundle containing only resources." 98 | 99 | $(eval $(call __mod,messages.mk)) 100 | -------------------------------------------------------------------------------- /makefiles/null.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/null.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),null) 5 | include $(THEOS_MAKE_PATH)/instance/null.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/package.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PACKAGE_RULES_LOADED),$(_THEOS_FALSE)) 2 | _THEOS_PACKAGE_RULES_LOADED := 1 3 | 4 | ## Packaging Core Rules 5 | .PHONY: package internal-package-check before-package internal-package after-package 6 | 7 | package:: internal-package-check stage before-package internal-package after-package 8 | before-package:: $(THEOS_PACKAGE_DIR) 9 | internal-package:: 10 | ifeq ($(_THEOS_FINAL_PACKAGE),$(_THEOS_TRUE)) 11 | $(ECHO_NOTHING)$(THEOS_BIN_PATH)/convert_xml_plist.sh -D $(THEOS_STAGING_DIR)$(ECHO_END) 12 | endif 13 | internal-package-check:: 14 | @: 15 | 16 | # __THEOS_LAST_PACKAGE_FILENAME is to be set by a rule variable in the package format makefile. 17 | after-package:: 18 | @echo "$(__THEOS_LAST_PACKAGE_FILENAME)" > "$(_THEOS_LOCAL_DATA_DIR)/last_package" 19 | 20 | THEOS_PACKAGE_NAME := 21 | THEOS_PACKAGE_ARCH := 22 | THEOS_PACKAGE_BASE_VERSION := 23 | 24 | export THEOS_PACKAGE_SCHEME THEOS_PACKAGE_INSTALL_PREFIX 25 | 26 | $(eval $(call __mod,package.mk)) 27 | -include $(THEOS_MAKE_PATH)/package/$(_THEOS_PACKAGE_FORMAT).mk 28 | $(eval $(call __mod,package/$(_THEOS_PACKAGE_FORMAT).mk)) 29 | 30 | ifeq ($(_THEOS_PACKAGE_FORMAT_LOADED),) 31 | $(error I simply cannot figure out how to create $(_THEOS_PACKAGE_FORMAT)-format packages.) 32 | endif 33 | 34 | export THEOS_PACKAGE_NAME THEOS_PACKAGE_ARCH THEOS_PACKAGE_BASE_VERSION 35 | 36 | # These are here to be used by the package makefile included above. 37 | # We want them after the package makefile so that we can use variables set within it. 38 | 39 | # eval PACKAGE_VERSION *now* (to clear out references to VERSION.*: they have no bearing on 40 | # the 'base' version we calculate.) 41 | VERSION.INC_BUILD_NUMBER := X 42 | VERSION.EXTRAVERSION := X 43 | __USERVER_FOR_BUILDNUM := $(PACKAGE_VERSION) 44 | __BASEVER_FOR_BUILDNUM = $(or $(__USERVER_FOR_BUILDNUM),$(THEOS_PACKAGE_BASE_VERSION)) 45 | 46 | 47 | # We simplify the version vars so that they are evaluated only when completely necessary. 48 | # This is because they can include things like incrementing build numbers. 49 | 50 | # I am committing a willful departure from the THEOS_ naming convention, because I believe 51 | # that offering these via an easy-to-use interface makes more sense than hiding them behind 52 | # a really stupidly long name. 53 | # VERSION.* are meant to be used in user PACKAGE_VERSIONs. 54 | VERSION.EXTRAVERSION = $(if $(PACKAGE_BUILDNAME),+$(PACKAGE_BUILDNAME)) 55 | 56 | ifeq ($(_THEOS_FINAL_PACKAGE),$(_THEOS_TRUE)) 57 | VERSION.EXTRAVERSION = $(if $(PACKAGE_BUILDNAME),+$(PACKAGE_BUILDNAME)) 58 | _THEOS_PACKAGE_DEFAULT_VERSION_FORMAT = $(THEOS_PACKAGE_BASE_VERSION)$(VERSION.EXTRAVERSION) 59 | else 60 | VERSION.INC_BUILD_NUMBER = $(shell THEOS_PROJECT_DIR="$(THEOS_PROJECT_DIR)" _THEOS_LOCAL_DATA_DIR="$(_THEOS_LOCAL_DATA_DIR)" "$(THEOS_BIN_PATH)/package_version.sh" -N "$(THEOS_PACKAGE_NAME)" -V "$(__BASEVER_FOR_BUILDNUM)") 61 | _THEOS_PACKAGE_DEFAULT_VERSION_FORMAT = $(THEOS_PACKAGE_BASE_VERSION)-$(VERSION.INC_BUILD_NUMBER)$(VERSION.EXTRAVERSION) 62 | endif 63 | 64 | # Copy the actual value of PACKAGE_VERSION to __PACKAGE_VERSION and replace PACKAGE_VERSION with 65 | # a mere reference (to a simplified copy.) 66 | # We're doing this to clean up the user's PACKAGE_VERSION and make it safe for reuse. 67 | # (otherwise, they might trigger build number increases without meaning to.) 68 | # Defer the simplification until __PACKAGE_VERSION is used - do not do it before the eval 69 | # However, we want to do the schema calculation and value stuff before the eval, so that 70 | # __PACKAGE_VERSION becomes an exact copy of the PACKAGE_VERSION variable we chose. 71 | $(eval __PACKAGE_VERSION = $$(call __simplify,__PACKAGE_VERSION,$(value $(call __schema_var_name_last,,PACKAGE_VERSION)))) 72 | override PACKAGE_VERSION = $(__PACKAGE_VERSION) 73 | 74 | _THEOS_INTERNAL_PACKAGE_VERSION = $(call __simplify,_THEOS_INTERNAL_PACKAGE_VERSION,$(or $(__PACKAGE_VERSION),$(_THEOS_PACKAGE_DEFAULT_VERSION_FORMAT),1)) 75 | 76 | ## Installation Core Rules 77 | install:: before-install internal-install after-install 78 | 79 | internal-install-check:: 80 | # Throw an error if we aren’t aware of any built package yet. 81 | @if [[ -z "$(_THEOS_PACKAGE_LAST_FILENAME)" ]]; then \ 82 | $(PRINT_FORMAT_ERROR) "$(MAKE) install and show require that you build a package before you try to install it." >&2; exit 1; \ 83 | fi 84 | 85 | # Throw an error if the package doesn’t exist. 86 | @if [[ ! -f "$(_THEOS_PACKAGE_LAST_FILENAME)" ]]; then \ 87 | $(PRINT_FORMAT_ERROR) "Could not find “$(_THEOS_PACKAGE_LAST_FILENAME)” to install. Aborting." >&2; exit 1; \ 88 | fi 89 | 90 | export TARGET_INSTALL_REMOTE 91 | _THEOS_INSTALL_TYPE := local 92 | ifneq ($(THEOS_DEVICE_IP),) 93 | TARGET_INSTALL_REMOTE = $(_THEOS_TRUE) 94 | endif # THEOS_DEVICE_IP != "" 95 | ifeq ($(TARGET_INSTALL_REMOTE),$(_THEOS_TRUE)) 96 | _THEOS_INSTALL_TYPE := remote 97 | ifeq ($(THEOS_DEVICE_IP),) 98 | internal-install:: 99 | @$(PRINT_FORMAT_ERROR) "$(MAKE) install requires that you set THEOS_DEVICE_IP in your environment." >&2 100 | @$(PRINT_FORMAT) "It is also recommended that you have public-key authentication set up for root over SSH, or you will be entering your password a lot." >&2 101 | @exit 1 102 | endif # THEOS_DEVICE_IP == "" 103 | THEOS_DEVICE_USER ?= root 104 | export THEOS_DEVICE_IP THEOS_DEVICE_PORT THEOS_DEVICE_USER 105 | endif # TARGET_INSTALL_REMOTE == true 106 | 107 | _THEOS_SUDO_COMMAND ?= $(THEOS_SUDO_COMMAND) 108 | 109 | ifeq ($(TARGET_INSTALL_REMOTE)$(THEOS_DEVICE_USER),$(_THEOS_TRUE)root) 110 | _THEOS_SUDO_COMMAND = 111 | endif 112 | 113 | after-install:: internal-after-install 114 | 115 | before-install:: 116 | ifeq ($(PREINSTALL_TARGET_PROCESSES),) 117 | @: 118 | else 119 | $(ECHO_PRE_UNLOADING)install.exec "killall $(PREINSTALL_TARGET_PROCESSES) 2>/dev/null || true"$(ECHO_END) 120 | endif 121 | 122 | internal-install:: 123 | @: 124 | 125 | internal-after-install:: 126 | ifeq ($(INSTALL_TARGET_PROCESSES),) 127 | @: 128 | else 129 | $(ECHO_UNLOADING)install.exec "killall $(INSTALL_TARGET_PROCESSES) 2>/dev/null || true"$(ECHO_END) 130 | endif 131 | 132 | ## Uninstallation Core Rules 133 | uninstall:: before-uninstall internal-uninstall after-uninstall 134 | 135 | after-uninstall:: internal-after-uninstall 136 | before-uninstall:: 137 | 138 | internal-uninstall:: 139 | @: 140 | 141 | internal-after-uninstall:: 142 | ifeq ($(INSTALL_TARGET_PROCESSES),) 143 | @: 144 | else 145 | $(ECHO_UNLOADING)install.exec "killall $(INSTALL_TARGET_PROCESSES) 2>/dev/null || true"$(ECHO_END) 146 | endif 147 | 148 | -include $(THEOS_MAKE_PATH)/install/$(_THEOS_PACKAGE_FORMAT)_$(_THEOS_INSTALL_TYPE).mk 149 | $(eval $(call __mod,install/$(_THEOS_PACKAGE_FORMAT)_$(_THEOS_INSTALL_TYPE).mk)) 150 | 151 | endif # _THEOS_PACKAGE_RULES_LOADED 152 | 153 | show:: internal-install-check 154 | ifeq ($(_THEOS_PLATFORM_SHOW_IN_FILE_MANAGER),) 155 | $(ERROR_BEGIN)"It is not known how to open the file manager on this platform."$(ERROR_END) 156 | endif 157 | 158 | # For Cygwin and WSL, call the path translator to ensure we get a Windows path. 159 | ifeq ($(_THEOS_PLATFORM_SHOW_IN_FILE_MANAGER_PATH_TRANSLATOR),) 160 | $(ECHO_NOTHING)$(_THEOS_PLATFORM_SHOW_IN_FILE_MANAGER) "$(shell cat "$(_THEOS_LOCAL_DATA_DIR)/last_package")"$(ECHO_END) 161 | else 162 | $(ECHO_NOTHING)$(_THEOS_PLATFORM_SHOW_IN_FILE_MANAGER) "$(shell $(_THEOS_PLATFORM_SHOW_IN_FILE_MANAGER_PATH_TRANSLATOR) $$(cat "$(_THEOS_LOCAL_DATA_DIR)/last_package"))"$(ECHO_END) 163 | endif 164 | -------------------------------------------------------------------------------- /makefiles/package/deb.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PACKAGE_FORMAT_LOADED),) 2 | _THEOS_PACKAGE_FORMAT_LOADED := 1 3 | 4 | _THEOS_PLATFORM_DPKG_DEB ?= dm.pl 5 | _THEOS_PLATFORM_DPKG_DEB_COMPRESSION ?= $(or $(THEOS_PLATFORM_DEB_COMPRESSION_TYPE),lzma) 6 | ifeq ($(_THEOS_FINAL_PACKAGE),$(_THEOS_TRUE)) 7 | THEOS_PLATFORM_DEB_COMPRESSION_LEVEL ?= 9 8 | else 9 | THEOS_PLATFORM_DEB_COMPRESSION_LEVEL ?= 1 10 | endif 11 | 12 | _THEOS_DEB_PACKAGE_CONTROL_PATH := $(or $(wildcard $(THEOS_PROJECT_DIR)/control),$(wildcard $(THEOS_LAYOUT_DIR)/DEBIAN/control)) 13 | _THEOS_DEB_CAN_PACKAGE := $(call __exists,$(_THEOS_DEB_PACKAGE_CONTROL_PATH)) 14 | _THEOS_PACKAGE_INC_VERSION_PREFIX := - 15 | _THEOS_PACKAGE_EXTRA_VERSION_PREFIX := + 16 | 17 | _THEOS_DEB_HAS_DPKG_DEB := $(call __executable,$(_THEOS_PLATFORM_DPKG_DEB)) 18 | 19 | ifneq ($(_THEOS_DEB_HAS_DPKG_DEB),$(_THEOS_TRUE)) 20 | internal-package-check:: 21 | $(ERROR_BEGIN)"$(MAKE) package requires $(_THEOS_PLATFORM_DPKG_DEB)."$(ERROR_END) 22 | endif 23 | 24 | ifeq ($(_THEOS_DEB_CAN_PACKAGE),$(_THEOS_TRUE)) # Control file found 25 | THEOS_PACKAGE_NAME := $(shell grep -i "^Package:" "$(_THEOS_DEB_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2-) 26 | THEOS_PACKAGE_ARCH := $(shell grep -i "^Architecture:" "$(_THEOS_DEB_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2-) 27 | THEOS_PACKAGE_BASE_VERSION := $(shell grep -i "^Version:" "$(_THEOS_DEB_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2-) 28 | 29 | $(THEOS_STAGING_DIR)/DEBIAN: 30 | $(ECHO_NOTHING)mkdir -p "$(THEOS_STAGING_DIR)/DEBIAN"$(ECHO_END) 31 | ifeq ($(_THEOS_HAS_STAGING_LAYOUT),1) # If we have a layout directory, copy layout/DEBIAN to the staging directory. 32 | $(ECHO_NOTHING)[ -d "$(THEOS_LAYOUT_DIR)/DEBIAN" ] && rsync -a "$(THEOS_LAYOUT_DIR)/DEBIAN/" "$(THEOS_STAGING_DIR)/DEBIAN" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE) || true$(ECHO_END) 33 | endif # _THEOS_HAS_STAGING_LAYOUT 34 | 35 | _TARGET_SWIFT_VERSION_GE_5_0 = $(call __simplify,_TARGET_SWIFT_VERSION_GE_5_0,$(call __vercmp,$(_THEOS_TARGET_SWIFT_VERSION),ge,5.0)) 36 | 37 | ifeq ($(_TARGET_SWIFT_VERSION_GE_5_0),) 38 | _THEOS_DEB_LIBSWIFT_PACKAGE := com.modmyi.libswift4 39 | _THEOS_DEB_LIBSWIFT_PACKAGE_VERSION := $(_THEOS_TARGET_SWIFT_VERSION) 40 | else 41 | _THEOS_DEB_LIBSWIFT_PACKAGE := org.swift.libswift 42 | # Note: This only needs to be changed if a newer package is released. 43 | # See how _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION is set for more info. 44 | _THEOS_DEB_LIBSWIFT_PACKAGE_VERSION := 5.0 45 | endif 46 | 47 | _THEOS_DEB_LIBSWIFT_DEPENDS := $(_THEOS_DEB_LIBSWIFT_PACKAGE) (>= $(_THEOS_DEB_LIBSWIFT_PACKAGE_VERSION)) 48 | 49 | _THEOS_DEB_ORION_DEPENDS := dev.theos.orion (>= 1.0.0) 50 | 51 | $(THEOS_STAGING_DIR)/DEBIAN/control: $(THEOS_STAGING_DIR)/DEBIAN 52 | $(ECHO_NOTHING)sed -e 's/\$${LIBSWIFT}/$(_THEOS_DEB_LIBSWIFT_DEPENDS)/g; s/\$${LIBSWIFT_VERSION}/$(_THEOS_DEB_LIBSWIFT_PACKAGE_VERSION)/g; s/\$${ORION}/$(_THEOS_DEB_ORION_DEPENDS)/g; /^[Vv]ersion:/d; /^[Aa]rchitecture:/d; /^$$/d; $$G; P; D' "$(_THEOS_DEB_PACKAGE_CONTROL_PATH)" > "$@"$(ECHO_END) 53 | $(ECHO_NOTHING)echo "Architecture: $(THEOS_PACKAGE_ARCH)" >> "$@"$(ECHO_END) 54 | $(ECHO_NOTHING)echo "Version: $(_THEOS_INTERNAL_PACKAGE_VERSION)" >> "$@"$(ECHO_END) 55 | $(ECHO_NOTHING)echo "Installed-Size: $(shell du $(_THEOS_PLATFORM_DU_EXCLUDE) DEBIAN -ks "$(THEOS_STAGING_DIR)" | cut -f 1)" >> "$@"$(ECHO_END) 56 | 57 | before-package:: $(THEOS_STAGING_DIR)/DEBIAN/control 58 | 59 | _THEOS_DEB_PACKAGE_FILENAME = $(THEOS_PACKAGE_DIR)/$(THEOS_PACKAGE_NAME)_$(_THEOS_INTERNAL_PACKAGE_VERSION)_$(THEOS_PACKAGE_ARCH).deb 60 | 61 | internal-package:: 62 | # Use additional tmp stage for package schemes 63 | # Iterate through staging dir and move top-level items to tmp stage if != "DEBIAN" 64 | # Move the parent directory (i.e., package install prefix), which now contains project files, back to the main stage 65 | ifneq ($(THEOS_PACKAGE_INSTALL_PREFIX),) 66 | $(eval _STAGE_CONTENTS := $(wildcard $(THEOS_STAGING_DIR)/*)) 67 | $(eval _STAGE_STATE := $(lastword $(subst /, ,$(_STAGE_CONTENTS)))$(words $(_STAGE_CONTENTS))) 68 | $(eval _DEBIAN_ONLY := $(if $(filter DEBIAN1,$(_STAGE_STATE)),$(_THEOS_TRUE),$(_THEOS_FALSE))) 69 | # Only bother with tmp stage if there are top-level items 70 | $(if $(_DEBIAN_ONLY),, \ 71 | $(foreach i,$(_STAGE_CONTENTS), \ 72 | $(if $(findstring DEBIAN,$(i)),, \ 73 | $(shell mv $(i) $(_THEOS_SCHEME_STAGE)) \ 74 | ) \ 75 | ) \ 76 | $(shell mv $(wildcard $(_THEOS_STAGING_TMP)/*) $(THEOS_STAGING_DIR)) \ 77 | ) 78 | endif 79 | $(ECHO_NOTHING)COPYFILE_DISABLE=1 $(FAKEROOT) -r $(_THEOS_PLATFORM_DPKG_DEB) -Z$(_THEOS_PLATFORM_DPKG_DEB_COMPRESSION) -z$(THEOS_PLATFORM_DEB_COMPRESSION_LEVEL) -b "$(THEOS_STAGING_DIR)" "$(_THEOS_DEB_PACKAGE_FILENAME)"$(ECHO_END) 80 | 81 | # This variable is used in package.mk 82 | after-package:: __THEOS_LAST_PACKAGE_FILENAME = $(_THEOS_DEB_PACKAGE_FILENAME) 83 | 84 | else # _THEOS_DEB_CAN_PACKAGE == 0 85 | internal-package:: 86 | $(ERROR_BEGIN)"$(MAKE) package requires you to have a control file either in the layout/DEBIAN/ directory or in the project root. The control is used to determine info about the package (e.g., name, arch, and version)."$(ERROR_END) 87 | 88 | endif # _THEOS_DEB_CAN_PACKAGE 89 | endif # _THEOS_PACKAGE_FORMAT_LOADED 90 | -------------------------------------------------------------------------------- /makefiles/package/ipa.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PACKAGE_FORMAT_LOADED),) 2 | _THEOS_PACKAGE_FORMAT_LOADED := 1 3 | 4 | _THEOS_IPA_PACKAGE_CONTROL_PATH := $(THEOS_PROJECT_DIR)/control 5 | _THEOS_IPA_CAN_PACKAGE := $(call __exists,$(_THEOS_IPA_PACKAGE_CONTROL_PATH)) 6 | _THEOS_PACKAGE_INC_VERSION_PREFIX := - 7 | _THEOS_PACKAGE_EXTRA_VERSION_PREFIX := + 8 | 9 | _THEOS_IPA_HAS_IPABUILD := $(call __executable,zip) 10 | ifneq ($(_THEOS_IPA_HAS_IPABUILD),$(_THEOS_TRUE)) 11 | internal-package-check:: 12 | @echo "$(MAKE) package requires zip."; exit 1 13 | endif 14 | 15 | _THEOS_IPA_COMPRESSION_LEVEL := 1 16 | ifeq ($(_THEOS_FINAL_PACKAGE),$(_THEOS_TRUE)) 17 | _THEOS_IPA_COMPRESSION_LEVEL := 9 18 | endif 19 | 20 | ifeq ($(_THEOS_IPA_CAN_PACKAGE),$(_THEOS_TRUE)) # Control file found 21 | THEOS_PACKAGE_NAME := $(shell grep -i "^Package:" "$(_THEOS_IPA_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2-) 22 | THEOS_PACKAGE_BASE_VERSION := $(shell grep -i "^Version:" "$(_THEOS_IPA_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2-) 23 | 24 | _THEOS_ABSOLUTE_PACKAGE_DIR = $(THEOS_PROJECT_DIR)/$(THEOS_PACKAGE_DIR) 25 | _THEOS_IPA_PACKAGE_FILENAME = $(_THEOS_ABSOLUTE_PACKAGE_DIR)/$(THEOS_PACKAGE_NAME)_$(_THEOS_INTERNAL_PACKAGE_VERSION).ipa 26 | internal-package:: 27 | $(ECHO_NOTHING)cp -a $(THEOS_STAGING_DIR)/Applications $(THEOS_STAGING_DIR)/Payload; pushd $(THEOS_STAGING_DIR) &> /dev/null; zip -yqru$(_THEOS_IPA_COMPRESSION_LEVEL) "$(_THEOS_IPA_PACKAGE_FILENAME)" Payload; popd &> /dev/null$(ECHO_END) 28 | 29 | # This variable is used in package.mk 30 | after-package:: __THEOS_LAST_PACKAGE_FILENAME = $(_THEOS_IPA_PACKAGE_FILENAME) 31 | 32 | else # _THEOS_IPA_CAN_PACKAGE == 0 33 | internal-package:: 34 | @echo "$(MAKE) package requires you to have a control file in the project root. The control is used to determine info about the package (e.g., name and version)."; exit 1 35 | 36 | endif # _THEOS_IPA_CAN_PACKAGE 37 | endif # _THEOS_PACKAGE_FORMAT_LOADED 38 | -------------------------------------------------------------------------------- /makefiles/package/none.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PACKAGE_FORMAT_LOADED),) 2 | _THEOS_PACKAGE_FORMAT_LOADED := 1 3 | 4 | # This package format does nothing - it simply relies upon the internal-package rule in package.mk to do nothing for it. 5 | endif # _THEOS_PACKAGE_FORMAT_LOADED 6 | -------------------------------------------------------------------------------- /makefiles/package/pkg.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PACKAGE_FORMAT_LOADED),) 2 | _THEOS_PACKAGE_FORMAT_LOADED := 1 3 | 4 | _THEOS_PKG_PACKAGE_CONTROL_PATH := $(THEOS_PROJECT_DIR)/control 5 | _THEOS_PKG_CAN_PACKAGE := $(call __exists,$(_THEOS_PKG_PACKAGE_CONTROL_PATH)) 6 | _THEOS_PACKAGE_INC_VERSION_PREFIX := - 7 | _THEOS_PACKAGE_EXTRA_VERSION_PREFIX := + 8 | 9 | _THEOS_PKG_HAS_PKGBUILD := $(call __executable,pkgbuild) 10 | ifneq ($(_THEOS_PKG_HAS_PKGBUILD),$(_THEOS_TRUE)) 11 | internal-package-check:: 12 | $(ERROR_BEGIN)"$(MAKE) package requires pkgbuild."$(ERROR_END) 13 | endif 14 | 15 | ifeq ($(_THEOS_PKG_CAN_PACKAGE),$(_THEOS_TRUE)) # Control file found 16 | THEOS_PACKAGE_NAME := $(shell grep -i "^Package:" "$(_THEOS_PKG_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2-) 17 | THEOS_PACKAGE_BASE_VERSION := $(shell grep -i "^Version:" "$(_THEOS_PKG_PACKAGE_CONTROL_PATH)" | cut -d' ' -f2-) 18 | 19 | _THEOS_PKG_PACKAGE_FILENAME = $(THEOS_PACKAGE_DIR)/$(THEOS_PACKAGE_NAME)_$(_THEOS_INTERNAL_PACKAGE_VERSION).pkg 20 | internal-package:: 21 | $(ECHO_NOTHING)COPYFILE_DISABLE=1 $(FAKEROOT) -r pkgbuild --root "$(THEOS_STAGING_DIR)" --identifier "$(THEOS_PACKAGE_NAME)" --version "$(_THEOS_INTERNAL_PACKAGE_VERSION)" --ownership recommended "$(_THEOS_PKG_PACKAGE_FILENAME)" $(STDERR_NULL_REDIRECT)$(ECHO_END) 22 | 23 | # This variable is used in package.mk 24 | after-package:: __THEOS_LAST_PACKAGE_FILENAME = $(_THEOS_PKG_PACKAGE_FILENAME) 25 | 26 | else # _THEOS_PKG_CAN_PACKAGE == 0 27 | internal-package:: 28 | $(ERROR_BEGIN)"$(MAKE) package requires you to have a control file in the project root. The control is used to determine info about the package (e.g., name and version)."$(ERROR_END) 29 | 30 | endif # _THEOS_PKG_CAN_PACKAGE 31 | endif # _THEOS_PACKAGE_FORMAT_LOADED 32 | -------------------------------------------------------------------------------- /makefiles/package/rpm.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PACKAGE_FORMAT_LOADED),) 2 | _THEOS_PACKAGE_FORMAT_LOADED := 1 3 | 4 | _THEOS_RPM_PACKAGE_SPEC_PATH := $(wildcard $(THEOS_PROJECT_DIR)/package.spec) 5 | _THEOS_RPM_CAN_PACKAGE := $(call __exists,$(_THEOS_RPM_PACKAGE_SPEC_PATH)) 6 | _THEOS_PACKAGE_INC_VERSION_PREFIX := 7 | _THEOS_PACKAGE_EXTRA_VERSION_PREFIX := + 8 | 9 | _THEOS_RPM_HAS_RPMBUILD := $(call __executable,rpmbuild) 10 | ifneq ($(_THEOS_RPM_HAS_RPMBUILD),$(_THEOS_TRUE)) 11 | internal-package-check:: 12 | $(ERROR_BEGIN)"$(MAKE) package requires rpmbuild."$(ERROR_END) 13 | endif 14 | 15 | ifeq ($(_THEOS_RPM_CAN_PACKAGE),$(_THEOS_TRUE)) # Spec file found 16 | THEOS_PACKAGE_NAME := $(shell grep -i "^Name:" "$(_THEOS_RPM_PACKAGE_SPEC_PATH)" | cut -d':' -f2- | xargs) 17 | THEOS_PACKAGE_ARCH := $(shell grep -i "^BuildArch:" "$(_THEOS_RPM_PACKAGE_SPEC_PATH)" | cut -d':' -f2- | xargs) 18 | ifeq ($(_THEOS_FINAL_PACKAGE),$(_THEOS_TRUE)) 19 | THEOS_PACKAGE_BASE_VERSION := $(shell grep -i "^Version:" "$(_THEOS_RPM_PACKAGE_SPEC_PATH)" | cut -d':' -f2- | xargs)-$(shell grep -i "^Release:" "$(_THEOS_RPM_PACKAGE_SPEC_PATH)" | cut -d':' -f2- | xargs) 20 | else 21 | THEOS_PACKAGE_BASE_VERSION := $(shell grep -i "^Version:" "$(_THEOS_RPM_PACKAGE_SPEC_PATH)" | cut -d':' -f2- | xargs) 22 | endif 23 | 24 | before-package:: 25 | ifeq ($(_THEOS_FINAL_PACKAGE),$(_THEOS_TRUE)) 26 | $(ECHO_NOTHING)sed -e '/^[Ss]ource0:/d' "$(_THEOS_RPM_PACKAGE_SPEC_PATH)" > "$(THEOS_OBJ_DIR)/package.spec"$(ECHO_END) 27 | else 28 | $(ECHO_NOTHING)sed -e 's/[Rr]elease:.*/Release: '$(shell echo "$(_THEOS_INTERNAL_PACKAGE_VERSION)" | cut -d - -f 2-)'/g' -e '/^[Ss]ource0:/d' "$(_THEOS_RPM_PACKAGE_SPEC_PATH)" > "$(THEOS_OBJ_DIR)/package.spec"$(ECHO_END) 29 | endif 30 | $(ECHO_NOTHING)echo '%files' >> "$(THEOS_OBJ_DIR)/package.spec"$(ECHO_END) 31 | $(ECHO_NOTHING)echo '/*' >> "$(THEOS_OBJ_DIR)/package.spec"$(ECHO_END) 32 | 33 | _THEOS_RPM_PACKAGE_FILENAME = $(THEOS_PACKAGE_DIR)/$(THEOS_PACKAGE_NAME)-$(_THEOS_INTERNAL_PACKAGE_VERSION).$(THEOS_PACKAGE_ARCH).rpm 34 | internal-package:: 35 | $(ECHO_NOTHING)COPYFILE_DISABLE=1 $(FAKEROOT) -r rpmbuild -bb "$(THEOS_OBJ_DIR)/package.spec" --buildroot "$(THEOS_STAGING_DIR)" --define "_rpmdir$(_THEOS_RELATIVE_DATA_DIR)/$(THEOS_OBJ_DIR_NAME)" $(STDERR_NULL_REDIRECT)$(STDOUT_NULL_REDIRECT)$(ECHO_END) 36 | $(ECHO_NOTHING)ln -f "$(THEOS_OBJ_DIR)/$(THEOS_PACKAGE_ARCH)/$(THEOS_PACKAGE_NAME)-$(_THEOS_INTERNAL_PACKAGE_VERSION).$(THEOS_PACKAGE_ARCH).rpm" "$(_THEOS_RPM_PACKAGE_FILENAME)"$(ECHO_END) 37 | $(ECHO_NOTHING)rm -r "$(THEOS_OBJ_DIR)/$(THEOS_PACKAGE_ARCH)"$(ECHO_END) 38 | 39 | # This variable is used in package.mk 40 | after-package:: __THEOS_LAST_PACKAGE_FILENAME = $(_THEOS_RPM_PACKAGE_FILENAME) 41 | 42 | else # _THEOS_RPM_CAN_PACKAGE == 0 43 | internal-package:: 44 | $(ERROR_BEGIN)"$(MAKE) package requires you to have a package.spec file in the project directory. The spec is used to determine info about the package (e.g., name, arch, and version)."$(ERROR_END) 45 | 46 | endif # _THEOS_RPM_CAN_PACKAGE 47 | endif # _THEOS_PACKAGE_FORMAT_LOADED 48 | -------------------------------------------------------------------------------- /makefiles/platform/Cygwin.mk: -------------------------------------------------------------------------------- 1 | include $(THEOS_MAKE_PATH)/platform/Windows.mk -------------------------------------------------------------------------------- /makefiles/platform/Darwin.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PLATFORM_LOADED),$(_THEOS_FALSE)) 2 | _THEOS_PLATFORM_LOADED := 1 3 | _THEOS_PLATFORM_HAS_XCODE := $(call __executable,xcode-select) 4 | 5 | # Darwin is the common platform for macOS and iOS (and derivatives). Xcode is only available on 6 | # macOS. If xcode-select is present, treat the platform like macOS, otherwise treat it like iOS. 7 | THEOS_PLATFORM_NAME := $(if $(_THEOS_PLATFORM_HAS_XCODE),macosx,iphone) 8 | 9 | ifneq ($(THEOS_CURRENT_ARCH),) 10 | ifneq ($(THEOS_PLATFORM_SDK_ROOT_$(THEOS_CURRENT_ARCH)),) 11 | THEOS_PLATFORM_SDK_ROOT = $(THEOS_PLATFORM_SDK_ROOT_$(THEOS_CURRENT_ARCH)) 12 | endif 13 | endif 14 | 15 | ifeq ($(_THEOS_PLATFORM_HAS_XCODE),$(_THEOS_TRUE)) 16 | ifeq ($(THEOS_PLATFORM_SDK_ROOT),) 17 | THEOS_PLATFORM_SDK_ROOT := $(shell xcode-select -print-path) 18 | endif 19 | # To have xcrun use our customized THEOS_PLATFORM_SDK_ROOT 20 | export DEVELOPER_DIR = $(THEOS_PLATFORM_SDK_ROOT) 21 | endif 22 | 23 | _THEOS_PLATFORM_DEFAULT_TARGET := iphone 24 | 25 | # Long flags are a GNUism. We can use this to tell whether to use GNU du or BSD du flags. 26 | ifeq ($(shell du --version >/dev/null 2>&1 && echo 1),1) 27 | _THEOS_PLATFORM_DU_EXCLUDE := --exclude 28 | else 29 | _THEOS_PLATFORM_DU_EXCLUDE := -I 30 | endif 31 | 32 | ifeq ($(call __executable,md5),$(_THEOS_TRUE)) 33 | _THEOS_PLATFORM_MD5SUM := md5 34 | else 35 | _THEOS_PLATFORM_MD5SUM := md5sum 36 | endif 37 | 38 | ifeq ($(call __executable,open),$(_THEOS_TRUE)) 39 | _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER := open -R 40 | endif 41 | 42 | THEOS_SUDO_COMMAND ?= sudo 43 | _THEOS_PLATFORM_GET_LOGICAL_CORES := sysctl -n hw.ncpu 44 | _THEOS_PLATFORM_SWIFT ?= swift 45 | endif 46 | -------------------------------------------------------------------------------- /makefiles/platform/FreeBSD.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PLATFORM_LOADED),) 2 | _THEOS_PLATFORM_LOADED := 1 3 | THEOS_PLATFORM_NAME := freebsd 4 | 5 | _THEOS_PLATFORM_DEFAULT_TARGET := iphone 6 | _THEOS_PLATFORM_DU_EXCLUDE := -I 7 | _THEOS_PLATFORM_MD5SUM := md5 8 | 9 | # TODO: Find some better way to determine _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER, as not all desktop 10 | # environments use Nautilus as the file manager 11 | _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER := nautilus 12 | 13 | _THEOS_PLATFORM_GET_LOGICAL_CORES := sysctl -n hw.ncpu 14 | endif 15 | -------------------------------------------------------------------------------- /makefiles/platform/Linux.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PLATFORM_LOADED),$(_THEOS_FALSE)) 2 | _THEOS_PLATFORM_LOADED := 1 3 | THEOS_PLATFORM_NAME := linux 4 | 5 | _THEOS_PLATFORM_DEFAULT_TARGET := iphone 6 | _THEOS_PLATFORM_DU_EXCLUDE := --exclude 7 | _THEOS_PLATFORM_MD5SUM := md5sum 8 | _THEOS_PLATFORM_BIN := $(THEOS)/toolchain/$(THEOS_PLATFORM_NAME)/host/bin 9 | ifeq ($(call __exists,$(_THEOS_PLATFORM_BIN)),$(_THEOS_TRUE)) 10 | _THEOS_PLATFORM_SWIFT := $(_THEOS_PLATFORM_BIN)/swift 11 | else 12 | _THEOS_PLATFORM_SWIFT := swift 13 | endif 14 | 15 | # Determine whether we’re on Windows Subsystem for Linux. 16 | _THEOS_IS_WSL = $(if $(shell grep Microsoft /proc/version 2>/dev/null),$(_THEOS_TRUE),$(_THEOS_FALSE)) 17 | 18 | ifeq ($(_THEOS_IS_WSL),$(_THEOS_TRUE)) 19 | _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER := /mnt/c/Windows/explorer.exe /select, 20 | _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER_PATH_TRANSLATOR := wslpath -aw 21 | else 22 | # TODO: Find some better way to determine _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER, as not all desktop 23 | # environments use Nautilus as the file manager 24 | _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER := nautilus 25 | endif 26 | 27 | _THEOS_PLATFORM_GET_LOGICAL_CORES := nproc 28 | endif 29 | -------------------------------------------------------------------------------- /makefiles/platform/Windows.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_PLATFORM_LOADED),) 2 | _THEOS_PLATFORM_LOADED := 1 3 | THEOS_PLATFORM_NAME := windows 4 | 5 | _THEOS_PLATFORM_DEFAULT_TARGET := iphone 6 | _THEOS_PLATFORM_DU_EXCLUDE := --exclude 7 | _THEOS_PLATFORM_MD5SUM := md5sum 8 | _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER := explorer /select, 9 | _THEOS_PLATFORM_SHOW_IN_FILE_MANAGER_PATH_TRANSLATOR := cygpath -aw 10 | _THEOS_PLATFORM_GET_LOGICAL_CORES := nproc 11 | endif 12 | -------------------------------------------------------------------------------- /makefiles/rules.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_RULES_LOADED),$(_THEOS_FALSE)) 2 | _THEOS_RULES_LOADED := 1 3 | 4 | ifeq ($(THEOS_CURRENT_INSTANCE),) 5 | include $(THEOS_MAKE_PATH)/master/rules.mk 6 | else 7 | include $(THEOS_MAKE_PATH)/instance/rules.mk 8 | endif 9 | 10 | ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no) 11 | .NOTPARALLEL: 12 | else ifneq ($(_THEOS_MAKE_PARALLEL), yes) 13 | .NOTPARALLEL: 14 | endif 15 | 16 | %.mm: %.l.mm 17 | $(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $< > $@ 18 | 19 | %.mm: %.xmm 20 | $(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $< > $@ 21 | 22 | %.mm: %.xm 23 | $(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $< > $@ 24 | 25 | %.m: %.xm 26 | $(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $< > $@ 27 | 28 | ifneq ($(THEOS_BUILD_DIR),.) 29 | $(THEOS_BUILD_DIR): 30 | @mkdir -p $(THEOS_BUILD_DIR) 31 | endif 32 | 33 | $(THEOS_OBJ_DIR): 34 | @mkdir -p $@ 35 | 36 | $(THEOS_OBJ_DIR)/.stamp: $(THEOS_OBJ_DIR) 37 | @mkdir -p $(dir $@); touch $@ 38 | 39 | $(THEOS_OBJ_DIR)/%/.stamp: $(THEOS_OBJ_DIR) 40 | @mkdir -p $(dir $@); touch $@ 41 | 42 | Makefile: ; 43 | $(_THEOS_RELATIVE_MAKE_PATH)%.mk: ; 44 | $(THEOS_MAKE_PATH)/%.mk: ; 45 | $(THEOS_MAKE_PATH)/master/%.mk: ; 46 | $(THEOS_MAKE_PATH)/instance/%.mk: ; 47 | $(THEOS_MAKE_PATH)/instance/shared/%.mk: ; 48 | $(THEOS_MAKE_PATH)/platform/%.mk: ; 49 | $(THEOS_MAKE_PATH)/targets/%.mk: ; 50 | $(THEOS_MAKE_PATH)/targets/%/%.mk: ; 51 | 52 | ifneq ($(THEOS_PACKAGE_DIR_NAME),) 53 | $(THEOS_PACKAGE_DIR): 54 | @mkdir -p $(THEOS_PACKAGE_DIR) 55 | endif 56 | 57 | endif 58 | 59 | # TODO MAKE A BUNCH OF THINGS PHONY 60 | $(eval $(call __mod,rules.mk)) 61 | -------------------------------------------------------------------------------- /makefiles/simbltweak.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/simbltweak.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),simbltweak) 5 | include $(THEOS_MAKE_PATH)/instance/simbltweak.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/stage.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_STAGING_RULES_LOADED),$(_THEOS_FALSE)) 2 | _THEOS_STAGING_RULES_LOADED := 1 3 | 4 | .PHONY: stage before-stage internal-stage after-stage 5 | 6 | # For the toplevel invocation of make, mark 'all' and the *-stage rules as prerequisites. 7 | # We do not do this for anything else, because otherwise, all the staging rules would run for every subproject. 8 | ifeq ($(_THEOS_TOP_INVOCATION_DONE),$(_THEOS_FALSE)) 9 | stage:: all before-stage internal-stage after-stage 10 | else # _THEOS_TOP_INVOCATION_DONE 11 | stage:: internal-stage 12 | endif 13 | 14 | # Only do the master staging rules if we're the toplevel make invocation. 15 | ifeq ($(_THEOS_TOP_INVOCATION_DONE),$(_THEOS_FALSE)) 16 | before-stage:: 17 | $(ECHO_NOTHING)rm -rf "$(THEOS_STAGING_DIR)" "$(_THEOS_SCHEME_STAGE)"$(ECHO_END) 18 | $(ECHO_NOTHING)$(FAKEROOT) -c$(ECHO_END) 19 | $(ECHO_NOTHING)mkdir -p "$(THEOS_STAGING_DIR)" "$(_THEOS_SCHEME_STAGE)"$(ECHO_END) 20 | else # _THEOS_TOP_INVOCATION_DONE 21 | before-stage:: 22 | @: 23 | endif # _THEOS_TOP_INVOCATION_DONE 24 | 25 | internal-stage:: 26 | $(ECHO_NOTHING)[ -d $(THEOS_LAYOUT_DIR_NAME) ] && rsync -a "$(THEOS_LAYOUT_DIR_NAME)/" "$(THEOS_STAGING_DIR)" --exclude "DEBIAN" $(_THEOS_RSYNC_EXCLUDE_COMMANDLINE) || true$(ECHO_END) 27 | 28 | after-stage:: 29 | @: 30 | 31 | endif # _THEOS_STAGING_RULES_LOADED 32 | -------------------------------------------------------------------------------- /makefiles/subproject.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/subproject.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),subproject) 5 | include $(THEOS_MAKE_PATH)/instance/subproject.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/target.mk: -------------------------------------------------------------------------------- 1 | # Define a variable containing the newline character. We’ll need it below as $(shell) isn’t able to 2 | # return a string containing newlines - they get replaced with spaces. 3 | define ___newline 4 | 5 | 6 | endef 7 | 8 | # Extract the target arguments out of a colon-separated variable. This is done using a scary bit of 9 | # bash magic because we need to retain empty arguments within TARGET, and $(word) collapses spaces. 10 | # It’s still safe enough, under the assumption that the set of expected values in TARGET are finite 11 | # (e.g. tokens such as iphone, and version identifiers such as 15.0). 12 | # 13 | # How it works: 14 | # 1. Inside a shell, creates an array of input values, by substituting the separator character (:) 15 | # with quotes that delimit the end of one value and start the next one. It would have been much 16 | # nicer to use readarray, but this was added in bash 4.1 - macOS continues to ship bash 3.2.57. 17 | # 2. We then loop over the array and printf each value as a Make export statement. This is as good 18 | # as it gets without proper array support in Make. 19 | # 3. Finally, back on the Make side of things, we substitute the delimiter with a newline, so that 20 | # our string can be successfully evaluated by Make (see ___newline discussion above). 21 | define ___get_target_args 22 | $(subst ;,$(___newline), \ 23 | $(shell \ 24 | args=('$(subst :,' ',$(1))'); \ 25 | for (( i=0; i<$${#args[@]}; i++ )); do \ 26 | if [[ $${args[$$i]} != '' ]]; then \ 27 | printf 'export __THEOS_TARGET_ARG_%s := %s;' "$$i" "$${args[$$i]}"; \ 28 | fi; \ 29 | done \ 30 | ) \ 31 | ) 32 | endef 33 | 34 | # Evaluate and export the TARGET arguments. This expects to be passed multiple variables, which are 35 | # sorted in decreasing precedence: 36 | # 1. The TARGET variable, defined by the project’s own Makefile. 37 | # 2. Any schema overrides of TARGET. 38 | # 3. The platform’s default TARGET. 39 | define __eval_target 40 | $(eval \ 41 | $(call ___get_target_args,$(3)) \ 42 | $(call ___get_target_args,$(2)) \ 43 | $(call ___get_target_args,$(1)) \ 44 | ) 45 | endef 46 | -------------------------------------------------------------------------------- /makefiles/targets/Cygwin: -------------------------------------------------------------------------------- 1 | Windows -------------------------------------------------------------------------------- /makefiles/targets/Darwin/appletv.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := appletv 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := appletvos 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := AppleTVOS 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := tvos 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-tvos 9 | _THEOS_DARWIN_CAN_USE_MODULES := $(_THEOS_TRUE) 10 | 11 | NEUTRAL_ARCH := arm64 12 | 13 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 9.0 14 | 15 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 16 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 17 | endif 18 | -------------------------------------------------------------------------------- /makefiles/targets/Darwin/appletv_simulator.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := appletvos_simulator 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := appletvos 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := AppleTVSimulator 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := tvos-simulator 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-tvos 9 | _THEOS_TARGET_PLATFORM_IS_SIMULATOR := $(_THEOS_TRUE) 10 | _THEOS_DARWIN_CAN_USE_MODULES := $(_THEOS_TRUE) 11 | 12 | NEUTRAL_ARCH := x86_64 13 | 14 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 9.0 15 | 16 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 17 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 18 | 19 | ifeq ($(APPLETV_SIMULATOR_ROOT),) 20 | internal-install:: 21 | $(ERROR_BEGIN)"$(MAKE) install for the simulator requires that you set APPLETV_SIMULATOR_ROOT to the root directory of the simulated OS."$(ERROR_END) 22 | else 23 | internal-install:: stage 24 | $(ECHO_NOTHING)install.mergeDir "$(THEOS_STAGING_DIR)" "$(APPLETV_SIMULATOR_ROOT)"$(ECHO_END) 25 | endif 26 | 27 | _TARGET_OBJC_ABI_CFLAGS = -fobjc-abi-version=2 -fobjc-legacy-dispatch 28 | _TARGET_OBJC_ABI_LDFLAGS = -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -allow_simulator_linking_to_macosx_dylibs 29 | 30 | _THEOS_TARGET_CFLAGS += $(_TARGET_OBJC_ABI_CFLAGS) 31 | _THEOS_TARGET_LDFLAGS += $(_TARGET_OBJC_ABI_LDFLAGS) 32 | endif 33 | -------------------------------------------------------------------------------- /makefiles/targets/Darwin/iphone.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := iphone 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := iphoneos 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := iPhoneOS 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := iphoneos 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-ios 9 | 10 | TARGET_INSTALL_REMOTE := $(_THEOS_FALSE) 11 | 12 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 13 | include $(THEOS_MAKE_PATH)/targets/_common/iphone.mk 14 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 15 | endif 16 | -------------------------------------------------------------------------------- /makefiles/targets/Darwin/macosx.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := macosx 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := macosx 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := MacOSX 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := macosx 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-macosx 9 | _THEOS_TARGET_DARWIN_BUNDLE_TYPE := hierarchial 10 | 11 | TARGET_CODESIGN ?= 12 | TARGET_CODESIGN_FLAGS ?= 13 | 14 | TARGET_INSTALL_REMOTE := $(_THEOS_FALSE) 15 | _THEOS_TARGET_DEFAULT_PACKAGE_FORMAT := pkg 16 | 17 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 18 | 19 | # We have to figure out the target version here, as we need it in the calculation of the deployment version. 20 | _TARGET_VERSION_GE_10_8 := $(call __simplify,_TARGET_VERSION_GE_10_8,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,10.8)) 21 | _TARGET_VERSION_GE_10_11 := $(call __simplify,_TARGET_VERSION_GE_10_11,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,10.11)) 22 | _TARGET_VERSION_GE_10_14 := $(call __simplify,_TARGET_VERSION_GE_10_14,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,10.14)) 23 | _TARGET_VERSION_GE_10_15 := $(call __simplify,_TARGET_VERSION_GE_10_15,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,10.15)) 24 | 25 | # For compatibility reasons, the macOS 11.0 SDK lives a double life, sometimes presenting itself as 26 | # the macOS 10.16 SDK. Since 11.0 is greater than 10.16, this will catch both version numbers. 27 | _TARGET_VERSION_GE_11_0 := $(call __simplify,_TARGET_VERSION_GE_11_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,10.16)) 28 | 29 | ifeq ($(_TARGET_VERSION_GE_10_8),1) 30 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 10.6 31 | else 32 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 10.5 33 | endif 34 | 35 | _THEOS_DARWIN_STABLE_SWIFT_VERSION := 10.14.4 36 | 37 | ifeq ($(_TARGET_VERSION_GE_11_0),1) 38 | ARCHS ?= x86_64 arm64 39 | NEUTRAL_ARCH := x86_64 40 | else ifeq ($(_TARGET_VERSION_GE_10_14),1) 41 | ARCHS ?= x86_64 42 | NEUTRAL_ARCH := x86_64 43 | else 44 | ARCHS ?= i386 x86_64 45 | NEUTRAL_ARCH := i386 46 | endif 47 | 48 | ifeq ($(_TARGET_VERSION_GE_10_15),1) 49 | _THEOS_DARWIN_CAN_USE_MODULES := $(_THEOS_TRUE) 50 | endif 51 | 52 | ifeq ($(_TARGET_VERSION_GE_10_15),1) 53 | _THEOS_TARGET_USE_CLANG_TARGET_FLAG := $(_THEOS_TRUE) 54 | endif 55 | 56 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 57 | endif 58 | -------------------------------------------------------------------------------- /makefiles/targets/Darwin/native.mk: -------------------------------------------------------------------------------- 1 | include $(THEOS_MAKE_PATH)/targets/Darwin/$(THEOS_PLATFORM_NAME).mk 2 | -------------------------------------------------------------------------------- /makefiles/targets/Darwin/simulator.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := iphone_simulator 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := iphonesimulator 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := iPhoneSimulator 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := ios-simulator 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-ios 9 | _THEOS_TARGET_PLATFORM_IS_SIMULATOR := $(_THEOS_TRUE) 10 | 11 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 12 | 13 | ifeq ($(IPHONE_SIMULATOR_ROOT),) 14 | internal-install:: 15 | $(ERROR_BEGIN)"$(MAKE) install for the simulator requires that you set IPHONE_SIMULATOR_ROOT to the root directory of the simulated OS."$(ERROR_END) 16 | else 17 | internal-install:: stage 18 | $(ECHO_NOTHING)install.mergeDir "$(THEOS_STAGING_DIR)" "$(IPHONE_SIMULATOR_ROOT)"$(ECHO_END) 19 | endif 20 | 21 | # We have to figure out the target version here, as we need it in the calculation of the deployment version. 22 | _TARGET_VERSION_GE_3_2 = $(call __simplify,_TARGET_VERSION_GE_3_2,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,3.2)) 23 | _TARGET_VERSION_GE_4_0 = $(call __simplify,_TARGET_VERSION_GE_4_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,4.0)) 24 | _TARGET_VERSION_GE_7_0 = $(call __simplify,_TARGET_VERSION_GE_7_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,7.0)) 25 | _TARGET_VERSION_GE_8_0 = $(call __simplify,_TARGET_VERSION_GE_8_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,8.0)) 26 | _TARGET_VERSION_GE_8_4 = $(call __simplify,_TARGET_VERSION_GE_8_4,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,8.4)) 27 | _TARGET_VERSION_GE_11_0 = $(call __simplify,_TARGET_VERSION_GE_11_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,11.0)) 28 | 29 | ARCHS ?= $(if $(_TARGET_VERSION_GE_8_0),,i386) $(if $(_TARGET_VERSION_GE_7_0),x86_64) 30 | NEUTRAL_ARCH = $(if $(_TARGET_VERSION_GE_8_0),x86_64,i386) 31 | 32 | _TARGET_VERSION_FLAG = $(if $(_TARGET_VERSION_GE_7_0),-mios-simulator-version-min=$(_THEOS_TARGET_IPHONEOS_DEPLOYMENT_VERSION),-mmacosx-version-min=$(if $(_TARGET_VERSION_GE_4_0),10.6,10.5)) 33 | _TARGET_OBJC_ABI_CFLAGS = $(if $(_TARGET_VERSION_GE_3_2),-fobjc-abi-version=2 -fobjc-legacy-dispatch) 34 | _TARGET_OBJC_ABI_LDFLAGS = $(if $(_TARGET_VERSION_GE_3_2),-Xlinker -objc_abi_version -Xlinker 2) 35 | 36 | ifeq ($(_TARGET_VERSION_GE_8_4),1) 37 | _THEOS_DARWIN_CAN_USE_MODULES := 1 38 | endif 39 | 40 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 41 | 42 | ifeq ($(_TARGET_VERSION_GE_7_0),) 43 | VERSIONFLAGS = -mmacosx-version-min=$(if $(_TARGET_VERSION_GE_4_0),10.6,10.5) 44 | endif 45 | 46 | _TARGET_OBJC_ABI_CFLAGS := $(if $(_TARGET_VERSION_GE_3_2),-fobjc-abi-version=2 -fobjc-legacy-dispatch) 47 | _TARGET_OBJC_ABI_LDFLAGS := $(if $(_TARGET_VERSION_GE_3_2),-Xlinker -objc_abi_version -Xlinker 2) 48 | 49 | _THEOS_TARGET_CFLAGS += $(_TARGET_OBJC_ABI_CFLAGS) 50 | _THEOS_TARGET_LDFLAGS += $(_TARGET_OBJC_ABI_LDFLAGS) -Xlinker -allow_simulator_linking_to_macosx_dylibs 51 | endif 52 | -------------------------------------------------------------------------------- /makefiles/targets/Darwin/watchos.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := watchos 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := watchos 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := WatchOS 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := watchos 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-watchos 9 | _THEOS_DARWIN_CAN_USE_MODULES := $(_THEOS_TRUE) 10 | 11 | NEUTRAL_ARCH := armv7k 12 | 13 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 14 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 15 | endif 16 | -------------------------------------------------------------------------------- /makefiles/targets/Darwin/watchos_simulator.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := watchos_simulator 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := watchsimulator 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := WatchSimulator 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := watchos-simulator 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-watchos 9 | _THEOS_TARGET_PLATFORM_IS_SIMULATOR := $(_THEOS_TRUE) 10 | _THEOS_DARWIN_CAN_USE_MODULES := $(_THEOS_TRUE) 11 | 12 | NEUTRAL_ARCH := i386 13 | 14 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 15 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 16 | 17 | ifeq ($(WATCHOS_SIMULATOR_ROOT),) 18 | internal-install:: 19 | $(ERROR_BEGIN)"$(MAKE) install for the simulator requires that you set WATCHOS_SIMULATOR_ROOT to the root directory of the simulated OS."$(ERROR_END) 20 | else 21 | internal-install:: stage 22 | $(ECHO_NOTHING)install.mergeDir "$(THEOS_STAGING_DIR)" "$(WATCHOS_SIMULATOR_ROOT)"$(ECHO_END) 23 | endif 24 | 25 | _TARGET_OBJC_ABI_CFLAGS = -fobjc-abi-version=2 -fobjc-legacy-dispatch 26 | _TARGET_OBJC_ABI_LDFLAGS = -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -allow_simulator_linking_to_macosx_dylibs 27 | 28 | _THEOS_TARGET_CFLAGS += $(_TARGET_OBJC_ABI_CFLAGS) 29 | _THEOS_TARGET_LDFLAGS += $(_TARGET_OBJC_ABI_LDFLAGS) 30 | endif 31 | -------------------------------------------------------------------------------- /makefiles/targets/Linux/iphone.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := iphone 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := iphoneos 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := iPhoneOS 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := iphoneos 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-ios 9 | 10 | SWIFTBINPATH ?= $(THEOS)/toolchain/swift/bin 11 | SDKBINPATH ?= $(THEOS)/toolchain/$(THEOS_PLATFORM_NAME)/$(THEOS_TARGET_NAME)/bin 12 | 13 | # Determine toolchain to use based on file existence. 14 | ifeq ($(_THEOS_TARGET_SDK_BIN_PREFIX),) 15 | ifeq ($(call __exists,$(SDKBINPATH)/armv7-apple-darwin11-ld),$(_THEOS_TRUE)) 16 | _THEOS_TARGET_SDK_BIN_PREFIX ?= armv7-apple-darwin11- 17 | else ifeq ($(call __exists,$(SDKBINPATH)/arm64-apple-darwin14-ld),$(_THEOS_TRUE)) 18 | _THEOS_TARGET_SDK_BIN_PREFIX ?= arm64-apple-darwin14- 19 | else 20 | # toolchain has no prefix so we are responsible of supplying target triple to clang for cross compiling 21 | _THEOS_TARGET_USE_CLANG_TARGET_FLAG := $(_THEOS_TRUE) 22 | endif 23 | endif 24 | 25 | PREFIX := $(SDKBINPATH)/$(_THEOS_TARGET_SDK_BIN_PREFIX) 26 | 27 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 28 | include $(THEOS_MAKE_PATH)/targets/_common/iphone.mk 29 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 30 | 31 | endif 32 | -------------------------------------------------------------------------------- /makefiles/targets/Linux/linux.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := linux 4 | 5 | ifneq ($(__THEOS_TARGET_ARG_1),) 6 | CROSS_COMPILE := $(__THEOS_TARGET_ARG_1)- 7 | endif 8 | 9 | TARGET_CC ?= $(CROSS_COMPILE)gcc 10 | TARGET_CXX ?= $(CROSS_COMPILE)g++ 11 | TARGET_LD ?= $(CROSS_COMPILE)g++ 12 | TARGET_STRIP ?= $(CROSS_COMPILE)strip 13 | TARGET_STRIP_FLAGS ?= 14 | TARGET_CODESIGN_ALLOCATE ?= 15 | TARGET_CODESIGN ?= 16 | TARGET_CODESIGN_FLAGS ?= 17 | 18 | TARGET_INSTALL_REMOTE := $(_THEOS_FALSE) 19 | 20 | include $(THEOS_MAKE_PATH)/targets/_common/linux.mk 21 | 22 | endif 23 | -------------------------------------------------------------------------------- /makefiles/targets/Linux/native.mk: -------------------------------------------------------------------------------- 1 | linux.mk -------------------------------------------------------------------------------- /makefiles/targets/Windows/cygwin.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := cygwin 4 | 5 | ifneq ($(__THEOS_TARGET_ARG_1),) 6 | CROSS_COMPILE := $(__THEOS_TARGET_ARG_1)- 7 | endif 8 | 9 | TARGET_CC ?= $(CROSS_COMPILE)gcc 10 | TARGET_CXX ?= $(CROSS_COMPILE)g++ 11 | TARGET_LD ?= $(CROSS_COMPILE)g++ 12 | TARGET_STRIP ?= $(CROSS_COMPILE)strip 13 | TARGET_STRIP_FLAGS ?= 14 | TARGET_CODESIGN_ALLOCATE ?= 15 | TARGET_CODESIGN ?= 16 | TARGET_CODESIGN_FLAGS ?= 17 | 18 | TARGET_INSTALL_REMOTE := $(_THEOS_FALSE) 19 | 20 | include $(THEOS_MAKE_PATH)/targets/_common/cygwin.mk 21 | 22 | endif 23 | -------------------------------------------------------------------------------- /makefiles/targets/Windows/iphone.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(_THEOS_TARGET_LOADED),) 2 | _THEOS_TARGET_LOADED := 1 3 | THEOS_TARGET_NAME := iphone 4 | 5 | _THEOS_TARGET_PLATFORM_NAME := iphoneos 6 | _THEOS_TARGET_PLATFORM_SDK_NAME := iPhoneOS 7 | _THEOS_TARGET_PLATFORM_FLAG_NAME := iphoneos 8 | _THEOS_TARGET_PLATFORM_SWIFT_NAME := apple-ios 9 | 10 | # Determine toolchain to use based on file existence. 11 | ifeq ($(SDKTARGET),) 12 | ifeq ($(call __exists,$(THEOS)/toolchain/$(THEOS_PLATFORM_NAME)/$(THEOS_TARGET_NAME)/bin/arm64-apple-darwin14-ld),$(_THEOS_TRUE)) 13 | SDKTARGET ?= arm64-apple-darwin14 14 | else 15 | SDKTARGET ?= armv7-apple-darwin11 16 | endif 17 | endif 18 | 19 | SWIFTBINPATH ?= $(THEOS)/toolchain/swift/bin 20 | SDKBINPATH ?= $(THEOS)/toolchain/$(THEOS_PLATFORM_NAME)/$(THEOS_TARGET_NAME)/bin 21 | PREFIX := $(SDKBINPATH)/$(SDKTARGET)- 22 | 23 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_head.mk 24 | include $(THEOS_MAKE_PATH)/targets/_common/iphone.mk 25 | include $(THEOS_MAKE_PATH)/targets/_common/darwin_tail.mk 26 | endif 27 | -------------------------------------------------------------------------------- /makefiles/targets/Windows/native.mk: -------------------------------------------------------------------------------- 1 | cygwin.mk -------------------------------------------------------------------------------- /makefiles/targets/_common/cygwin.mk: -------------------------------------------------------------------------------- 1 | # Variables that are common to all Linux-based targets. 2 | TARGET_EXE_EXT := .exe 3 | TARGET_LIB_EXT := .dll 4 | TARGET_AR_EXT := .a 5 | 6 | TARGET_LDFLAGS_DYNAMICLIB = -shared -Wl,-soname,$(1) 7 | TARGET_CFLAGS_DYNAMICLIB = -fPIC 8 | -------------------------------------------------------------------------------- /makefiles/targets/_common/darwin_head.mk: -------------------------------------------------------------------------------- 1 | # Variables that are common to all Darwin-based targets. 2 | TARGET_EXE_EXT := 3 | TARGET_LIB_EXT := .dylib 4 | TARGET_AR_EXT := .a 5 | 6 | TARGET_LDFLAGS_DYNAMICLIB = -dynamiclib -install_name "$(LOCAL_INSTALL_PATH)/$(1)" 7 | TARGET_CFLAGS_DYNAMICLIB = 8 | 9 | _THEOS_TARGET_SUPPORTS_BUNDLES := 1 10 | 11 | _THEOS_TARGET_CC := clang 12 | _THEOS_TARGET_CXX := clang++ 13 | _THEOS_TARGET_SWIFTC := swiftc 14 | _THEOS_TARGET_ARG_ORDER := 1 2 15 | ifeq ($(__THEOS_TARGET_ARG_1),clang) 16 | _THEOS_TARGET_ARG_ORDER := 2 3 17 | else ifeq ($(__THEOS_TARGET_ARG_1),gcc) 18 | _THEOS_TARGET_ARG_ORDER := 2 3 19 | endif 20 | 21 | _THEOS_TARGET_DEFAULT_PACKAGE_FORMAT ?= deb 22 | 23 | ifeq ($(_THEOS_TARGET_PLATFORM_IS_SIMULATOR),$(_THEOS_TRUE)) 24 | _THEOS_TARGET_LOGOS_DEFAULT_GENERATOR := internal 25 | 26 | TARGET_CODESIGN ?= codesign 27 | TARGET_CODESIGN_FLAGS ?= --sign 'Apple Development' 28 | else 29 | TARGET_INSTALL_REMOTE ?= $(_THEOS_TRUE) 30 | 31 | ifeq ($(TARGET_CODESIGN),) 32 | # Determine the path to ldid. If it can’t be found, just use “ldid” so there’s an understandable 33 | # “no such file or directory” error. 34 | ifeq ($(call __executable,ldid),$(_THEOS_TRUE)) 35 | TARGET_CODESIGN = ldid 36 | else ifeq ($(call __executable,$(SDKBINPATH)/ldid),$(_THEOS_TRUE)) 37 | TARGET_CODESIGN = $(SDKBINPATH)/ldid 38 | else 39 | TARGET_CODESIGN = ldid 40 | endif 41 | endif 42 | 43 | TARGET_CODESIGN_FLAGS ?= -S 44 | endif 45 | 46 | # __invocation returns the command-line invocation for the tool specified as its argument. 47 | ifneq ($(PREFIX),) 48 | # Linux, Cygwin 49 | __invocation = $(PREFIX)$(1) 50 | else ifeq ($(_THEOS_PLATFORM_HAS_XCODE),$(_THEOS_TRUE)) 51 | # macOS 52 | __invocation = $(shell xcrun -sdk $(_THEOS_TARGET_PLATFORM_NAME) -f $(1) 2>/dev/null) 53 | else 54 | # iOS 55 | __invocation = $(1) 56 | endif 57 | 58 | # give precedence to Swift toolchains located at SWIFTBINPATH 59 | ifeq ($(call __exists,$(SWIFTBINPATH)),$(_THEOS_TRUE)) 60 | __invocation_swift = $(SWIFTBINPATH)/$(1) 61 | else 62 | __invocation_swift = $(call __invocation,$(1)) 63 | endif 64 | 65 | ifeq ($(_THEOS_IS_MAKE_GT_4_0),) 66 | # Make 3 has a bug where __simplify ends up truncating text sometimes 67 | # (root cause presently unknown). Only use __simplify for targets on 68 | # Make >= 4 69 | __target_simplify = $(2) 70 | else 71 | __target_simplify = $(call __simplify,$(1),$(2)) 72 | endif 73 | 74 | TARGET_CC ?= $(call __target_simplify,TARGET_CC,$(call __invocation,$(_THEOS_TARGET_CC))) 75 | TARGET_CXX ?= $(call __target_simplify,TARGET_CXX,$(call __invocation,$(_THEOS_TARGET_CXX))) 76 | TARGET_LD ?= $(call __target_simplify,TARGET_LD,$(call __invocation,$(_THEOS_TARGET_CXX))) 77 | TARGET_LIPO ?= $(call __target_simplify,TARGET_LIPO,$(call __invocation,lipo)) 78 | TARGET_STRIP ?= $(call __target_simplify,TARGET_STRIP,$(call __invocation,strip)) 79 | TARGET_CODESIGN_ALLOCATE ?= $(call __target_simplify,TARGET_CODESIGN_ALLOCATE,$(call __invocation,codesign_allocate)) 80 | TARGET_LIBTOOL ?= $(call __target_simplify,TARGET_LIBTOOL,$(call __invocation,libtool)) 81 | TARGET_XCODEBUILD ?= $(call __target_simplify,TARGET_XCODEBUILD,$(call __invocation,xcodebuild)) 82 | TARGET_XCPRETTY ?= $(call __target_simplify,TARGET_XCPRETTY,$(call __invocation,xcpretty)) 83 | TARGET_SWIFTC ?= $(call __target_simplify,TARGET_SWIFTC,$(call __invocation_swift,$(_THEOS_TARGET_SWIFTC))) 84 | 85 | TARGET_SWIFT_SUPPORT_BIN ?= $(THEOS_VENDOR_SWIFT_SUPPORT_PATH)/.theos_build/release 86 | TARGET_ORION_BIN ?= $(THEOS_VENDOR_ORION_PATH)/.theos_build/release 87 | 88 | TARGET_STRIP_FLAGS ?= -x 89 | 90 | ifeq ($(TARGET_DSYMUTIL),) 91 | TARGET_DSYMUTIL := $(call __invocation,dsymutil) 92 | ifneq ($(call __executable,$(TARGET_DSYMUTIL)),$(_THEOS_TRUE)) 93 | TARGET_DSYMUTIL := $(call __invocation,llvm-dsymutil) 94 | ifneq ($(call __executable,$(TARGET_DSYMUTIL)),$(_THEOS_TRUE)) 95 | TARGET_DSYMUTIL := 96 | endif 97 | endif 98 | endif 99 | 100 | _THEOS_TARGET_CC_VERSION = $(shell $(TARGET_CC) -dumpversion) 101 | 102 | # A version specified as a target argument overrides all previous definitions. 103 | _SDKVERSION := $(or $(__THEOS_TARGET_ARG_$(word 1,$(_THEOS_TARGET_ARG_ORDER))),$(SDKVERSION_$(THEOS_CURRENT_ARCH)),$(SDKVERSION)) 104 | _THEOS_TARGET_SDK_VERSION := $(or $(_SDKVERSION),latest) 105 | _THEOS_TARGET_INCLUDE_SDK_VERSION := $(or $(INCLUDE_SDKVERSION),$(INCLUDE_SDKVERSION_$(THEOS_CURRENT_ARCH)),same) 106 | 107 | _UNSORTED_SDKS := $(patsubst $(THEOS_SDKS_PATH)/$(_THEOS_TARGET_PLATFORM_SDK_NAME)%.sdk,%,$(wildcard $(THEOS_SDKS_PATH)/$(_THEOS_TARGET_PLATFORM_SDK_NAME)*.sdk)) 108 | 109 | ifneq ($(THEOS_PLATFORM_SDK_ROOT),) 110 | _XCODE_SDK_DIR := $(THEOS_PLATFORM_SDK_ROOT)/Platforms/$(_THEOS_TARGET_PLATFORM_SDK_NAME).platform/Developer/SDKs 111 | _UNSORTED_SDKS += $(patsubst $(_XCODE_SDK_DIR)/$(_THEOS_TARGET_PLATFORM_SDK_NAME)%.sdk,%,$(wildcard $(_XCODE_SDK_DIR)/$(_THEOS_TARGET_PLATFORM_SDK_NAME)*.sdk)) 112 | endif 113 | 114 | ifeq ($(words $(_UNSORTED_SDKS)),0) 115 | before-all:: 116 | ifeq ($(_XCODE_SDK_DIR),) 117 | $(ERROR_BEGIN)"You do not have any SDKs in $(THEOS_SDKS_PATH)."$(ERROR_END) 118 | else 119 | $(ERROR_BEGIN)"You do not have any SDKs in $(_XCODE_SDK_DIR) or $(THEOS_SDKS_PATH)."$(ERROR_END) 120 | endif 121 | endif 122 | 123 | _SORTED_SDKS = $(call __simplify,_SORTED_SDKS,$(shell echo $(_UNSORTED_SDKS) | tr ' ' $$'\n' | sort -t. -k 1,1n -k 2,2n)) 124 | _LATEST_SDK = $(call __simplify,_LATEST_SDK,$(lastword $(_SORTED_SDKS))) 125 | 126 | ifeq ($(_THEOS_TARGET_SDK_VERSION),latest) 127 | override _THEOS_TARGET_SDK_VERSION := $(_LATEST_SDK) 128 | endif 129 | 130 | ifeq ($(_THEOS_TARGET_INCLUDE_SDK_VERSION),latest) 131 | override _THEOS_TARGET_INCLUDE_SDK_VERSION := $(_LATEST_SDK) 132 | else ifeq ($(_THEOS_TARGET_INCLUDE_SDK_VERSION),same) 133 | override _THEOS_TARGET_INCLUDE_SDK_VERSION := $(_THEOS_TARGET_SDK_VERSION) 134 | endif 135 | 136 | # Can't be := since _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION isn't assigned until iphone.mk. 137 | _THEOS_TARGET_OS_DEPLOYMENT_VERSION = $(or $(__THEOS_TARGET_ARG_$(word 2,$(_THEOS_TARGET_ARG_ORDER))),$(TARGET_OS_DEPLOYMENT_VERSION_$(THEOS_CURRENT_ARCH)),$(TARGET_OS_DEPLOYMENT_VERSION),$(_SDKVERSION),$(_THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION)) 138 | 139 | ifeq ($(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),latest) 140 | override _THEOS_TARGET_OS_DEPLOYMENT_VERSION = $(_LATEST_SDK) 141 | endif 142 | -------------------------------------------------------------------------------- /makefiles/targets/_common/darwin_tail.mk: -------------------------------------------------------------------------------- 1 | # if the project defines no value for ARCHS, and the target makefile hasn’t already set a default 2 | # ARCHS, set it to the value of NEUTRAL_ARCH 3 | ARCHS ?= $(NEUTRAL_ARCH) 4 | 5 | # determine the SYSROOT (for linking) and ISYSROOT (for compiling, I for “include”) like so: 6 | # SYSROOT: check for theos/sdks/BlahX.Y.sdk, or Xcode.app/…/SDKs/BlahX.Y.sdk, or leave empty so we 7 | # show an error 8 | # ISYSROOT: check for theos/sdks/BlahA.B.sdk, or Xcode.app/…/SDKs/BlahA.B.sdk, or use the same value 9 | # as SYSROOT if not defined 10 | ifeq ($(SYSROOT),) 11 | SYSROOT := $(or $(wildcard $(THEOS_SDKS_PATH)/$(_THEOS_TARGET_PLATFORM_SDK_NAME)$(_THEOS_TARGET_SDK_VERSION).sdk),$(wildcard $(THEOS_PLATFORM_SDK_ROOT)/Platforms/$(_THEOS_TARGET_PLATFORM_SDK_NAME).platform/Developer/SDKs/$(_THEOS_TARGET_PLATFORM_SDK_NAME)$(_THEOS_TARGET_SDK_VERSION).sdk)) 12 | endif 13 | ifeq ($(ISYSROOT),) 14 | ISYSROOT := $(or $(wildcard $(THEOS_SDKS_PATH)/$(_THEOS_TARGET_PLATFORM_SDK_NAME)$(_THEOS_TARGET_INCLUDE_SDK_VERSION).sdk),$(wildcard $(THEOS_PLATFORM_SDK_ROOT)/Platforms/$(_THEOS_TARGET_PLATFORM_SDK_NAME).platform/Developer/SDKs/$(_THEOS_TARGET_PLATFORM_SDK_NAME)$(_THEOS_TARGET_INCLUDE_SDK_VERSION).sdk),$(SYSROOT)) 15 | endif 16 | 17 | TARGET_PRIVATE_FRAMEWORK_PATH ?= $(SYSROOT)/System/Library/PrivateFrameworks 18 | TARGET_PRIVATE_FRAMEWORK_INCLUDE_PATH ?= $(ISYSROOT)/System/Library/PrivateFrameworks 19 | 20 | # if the toolchain is capable of using clang modules, define the flags that enable modules 21 | ifeq ($(_THEOS_DARWIN_CAN_USE_MODULES),$(_THEOS_TRUE)) 22 | MODULESFLAGS := -fmodules -fcxx-modules -fmodule-name=$(THEOS_CURRENT_INSTANCE) -fbuild-session-file=$(_THEOS_BUILD_SESSION_FILE) \ 23 | -fmodules-prune-after=345600 -fmodules-prune-interval=86400 -fmodules-validate-once-per-build-session 24 | endif 25 | 26 | ifneq ($(_THEOS_DARWIN_STABLE_SWIFT_VERSION),) 27 | ifeq ($(call __vercmp,$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),ge,$(_THEOS_DARWIN_STABLE_SWIFT_VERSION)),1) 28 | _THEOS_DARWIN_HAS_STABLE_SWIFT := $(_THEOS_TRUE) 29 | endif 30 | endif 31 | 32 | _THEOS_TARGET_SWIFT_TARGET := $(_THEOS_TARGET_PLATFORM_SWIFT_NAME)$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION)$(_THEOS_TARGET_PLATFORM_SWIFT_SUFFIX) 33 | 34 | ifeq ($(_THEOS_TARGET_USE_CLANG_TARGET_FLAG),$(_THEOS_TRUE)) 35 | VERSIONFLAGS := -target $(THEOS_CURRENT_ARCH)-$(_THEOS_TARGET_SWIFT_TARGET) 36 | else 37 | VERSIONFLAGS := -m$(_THEOS_TARGET_PLATFORM_FLAG_NAME)-version-min=$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION) 38 | endif 39 | 40 | _THEOS_TARGET_CFLAGS := -isysroot "$(ISYSROOT)" $(VERSIONFLAGS) $(_THEOS_TARGET_CC_CFLAGS) 41 | _THEOS_TARGET_CCFLAGS := $(_TARGET_LIBCPP_CCFLAGS) 42 | _THEOS_TARGET_LDFLAGS := -isysroot "$(SYSROOT)" $(VERSIONFLAGS) $(LEGACYFLAGS) -multiply_defined suppress $(_TARGET_LIBCPP_LDFLAGS) $(_TARGET_LIBSWIFT_LDFLAGS) 43 | 44 | # if toolchain has prefix, point clang to the ld we want to use 45 | ifneq ($(_THEOS_TARGET_SDK_BIN_PREFIX),) 46 | _THEOS_TARGET_LDFLAGS += -fuse-ld=$(SDKBINPATH)/$(_THEOS_TARGET_SDK_BIN_PREFIX)ld 47 | endif 48 | 49 | _THEOS_TARGET_SWIFTFLAGS := -sdk "$(SYSROOT)" $(_THEOS_TARGET_CC_SWIFTFLAGS) 50 | # we *dont* want to readlink here because if the user has a dual toolchain setup then iphone/bin/swiftc 51 | # might symlink the host one, but we want to use the iphone res dir and not the host one 52 | _THEOS_TARGET_SWIFT_RESOURCE_DIR := $(dir $(shell type -p $(TARGET_SWIFTC)))../lib/swift 53 | _THEOS_TARGET_SWIFT_LDPATHS = $(call __simplify,_THEOS_TARGET_SWIFT_LDPATHS,$(_THEOS_TARGET_SWIFT_RESOURCE_DIR)/$(_THEOS_TARGET_PLATFORM_NAME) /usr/lib/swift) 54 | 55 | ifeq ($(call __exists,$(_THEOS_TARGET_SWIFT_RESOURCE_DIR)),$(_THEOS_TRUE)) 56 | _THEOS_TARGET_SWIFTFLAGS += -resource-dir $(_THEOS_TARGET_SWIFT_RESOURCE_DIR) 57 | _THEOS_TARGET_CFLAGS += -resource-dir $(_THEOS_TARGET_SWIFT_RESOURCE_DIR)/clang 58 | _THEOS_TARGET_LDFLAGS += -resource-dir $(_THEOS_TARGET_SWIFT_RESOURCE_DIR)/clang 59 | endif 60 | 61 | ifeq ($(_THEOS_TARGET_USE_APPLE_LIBSWIFT),$(_THEOS_TRUE)) 62 | _THEOS_TARGET_LDFLAGS += $(foreach path,$(_THEOS_TARGET_SWIFT_LDPATHS),-L$(path)) 63 | else 64 | ifeq ($(call __executable,$(TARGET_SWIFTC)),$(_THEOS_TRUE)) 65 | _THEOS_TARGET_SWIFT_VERSION = $(call __simplify,_THEOS_TARGET_SWIFT_VERSION,$(shell $(TARGET_SWIFTC) --version 2>/dev/null | head -1 | cut -d'v' -f2 | cut -d' ' -f2 | cut -d'-' -f1)) 66 | ifeq ($(firstword $(subst ., ,$(_THEOS_TARGET_SWIFT_VERSION))),4) 67 | _THEOS_TARGET_SWIFT_VERSION_PATH = $(_THEOS_TARGET_SWIFT_VERSION) 68 | else 69 | _THEOS_TARGET_SWIFT_VERSION_PATH = stable 70 | endif 71 | _THEOS_TARGET_SWIFT_LDFLAGS = $(call __simplify,_THEOS_TARGET_SWIFT_LDFLAGS,-rpath /usr/lib/swift -rpath /usr/lib/libswift/$(_THEOS_TARGET_SWIFT_VERSION_PATH)) 72 | endif 73 | endif 74 | 75 | ifeq ($(_THEOS_TARGET_DARWIN_BUNDLE_TYPE),hierarchial) 76 | _THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY := /Contents 77 | _THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY := /Contents/Resources 78 | _THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY := /Contents/MacOS 79 | _THEOS_TARGET_BUNDLE_HEADERS_SUBDIRECTORY := /Contents/Headers 80 | else 81 | _THEOS_TARGET_BUNDLE_INFO_PLIST_SUBDIRECTORY := 82 | _THEOS_TARGET_BUNDLE_RESOURCE_SUBDIRECTORY := 83 | _THEOS_TARGET_BUNDLE_BINARY_SUBDIRECTORY := 84 | _THEOS_TARGET_BUNDLE_HEADERS_SUBDIRECTORY := /Headers 85 | endif 86 | -------------------------------------------------------------------------------- /makefiles/targets/_common/iphone.mk: -------------------------------------------------------------------------------- 1 | # We have to figure out the target version here, as we need it in the calculation of the deployment version. 2 | _TARGET_VERSION_GE_13_0 = $(call __simplify,_TARGET_VERSION_GE_13_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,13.0)) 3 | _TARGET_VERSION_GE_12_1 = $(call __simplify,_TARGET_VERSION_GE_12_1,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,12.1)) 4 | _TARGET_VERSION_GE_12_0 = $(call __simplify,_TARGET_VERSION_GE_12_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,12.0)) 5 | _TARGET_VERSION_GE_10_0 = $(call __simplify,_TARGET_VERSION_GE_10_0,$(call __vercmp $(_THEOS_TARGET_SDK_VERSION),ge,10.0)) 6 | _TARGET_VERSION_GE_8_4 = $(call __simplify,_TARGET_VERSION_GE_8_4,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,8.4)) 7 | _TARGET_VERSION_GE_7_0 = $(call __simplify,_TARGET_VERSION_GE_7_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,7.0)) 8 | _TARGET_VERSION_GE_6_0 = $(call __simplify,_TARGET_VERSION_GE_6_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,6.0)) 9 | _TARGET_VERSION_GE_4_0 = $(call __simplify,_TARGET_VERSION_GE_4_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,4.0)) 10 | _TARGET_VERSION_GE_3_0 = $(call __simplify,_TARGET_VERSION_GE_3_0,$(call __vercmp,$(_THEOS_TARGET_SDK_VERSION),ge,3.0)) 11 | 12 | ifeq ($(_TARGET_VERSION_GE_13_0),1) 13 | _THEOS_TARGET_USE_CLANG_TARGET_FLAG := $(_THEOS_TRUE) 14 | endif 15 | 16 | ifeq ($(_TARGET_VERSION_GE_12_0),1) 17 | _TARGET_LIBCPP_CCFLAGS := -stdlib=libc++ 18 | _TARGET_LIBCPP_LDFLAGS := -stdlib=libc++ -lc++ 19 | endif 20 | 21 | ifeq ($(_TARGET_VERSION_GE_12_0),1) 22 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 9.0 23 | else ifeq ($(_TARGET_VERSION_GE_10_0),1) 24 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 6.0 25 | else ifeq ($(_TARGET_VERSION_GE_7_0),1) 26 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 5.0 27 | else ifeq ($(_TARGET_VERSION_GE_6_0),1) 28 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 4.3 29 | else 30 | _THEOS_TARGET_DEFAULT_OS_DEPLOYMENT_VERSION := 3.0 31 | endif 32 | 33 | _THEOS_DARWIN_STABLE_SWIFT_VERSION := 12.2 34 | 35 | _DEPLOY_VERSION_GE_14_0 = $(call __simplify,_DEPLOY_VERSION_GE_14_0,$(call __vercmp,$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),ge,14.0)) 36 | _DEPLOY_VERSION_GE_11_0 = $(call __simplify,_DEPLOY_VERSION_GE_11_0,$(call __vercmp,$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),ge,11.0)) 37 | _DEPLOY_VERSION_GE_9_0 = $(call __simplify,_DEPLOY_VERSION_GE_9_0,$(call __vercmp,$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),ge,9.0)) 38 | _DEPLOY_VERSION_GE_5_0 = $(call __simplify,_DEPLOY_VERSION_GE_5_0,$(call __vercmp,$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),ge,5.0)) 39 | _DEPLOY_VERSION_GE_3_0 = $(call __simplify,_DEPLOY_VERSION_GE_3_0,$(call __vercmp,$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),ge,3.0)) 40 | _DEPLOY_VERSION_LT_4_3 = $(call __simplify,_DEPLOY_VERSION_LT_4_3,$(call __vercmp,$(_THEOS_TARGET_OS_DEPLOYMENT_VERSION),lt,4.3)) 41 | 42 | ifeq ($(_TARGET_VERSION_GE_6_0)$(_DEPLOY_VERSION_GE_3_0)$(_DEPLOY_VERSION_LT_4_3),111) 43 | ifeq ($(ARCHS)$(IPHONE_ARCHS)$(_THEOS_TARGET_WARNED_DEPLOY),) 44 | before-all:: 45 | @$(PRINT_FORMAT_WARNING) "Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries." >&2 46 | export _THEOS_TARGET_WARNED_DEPLOY := 1 47 | endif 48 | endif 49 | 50 | ifeq ($(_DEPLOY_VERSION_GE_11_0),1) # } Deploy >= 11.0 { 51 | ifeq ($(_TARGET_VERSION_GE_12_1),1) # >= 12.1 { 52 | ARCHS ?= arm64 arm64e 53 | else # } else { 54 | ARCHS ?= arm64 55 | endif # } 56 | else ifeq ($(_TARGET_VERSION_GE_7_0),1) # } >= 7.0 { 57 | ifeq ($(_TARGET_VERSION_GE_12_1),1) # >= 12.1 { 58 | ARCHS ?= armv7 arm64 arm64e 59 | else # } else { 60 | ARCHS ?= armv7 arm64 61 | endif # } 62 | else ifeq ($(_TARGET_VERSION_GE_6_0),1) # } >= 6.0 { 63 | ifeq ($(_TARGET_VERSION_GE_7_0)$(_DEPLOY_VERSION_GE_5_0),11) # >= 7.0, Deploy >= 5.0 { 64 | ARCHS ?= armv7 arm64 65 | else # } else { 66 | ARCHS ?= armv7 67 | endif # } 68 | else ifeq ($(_TARGET_VERSION_GE_3_0),1) # } >= 3.0 { 69 | ARCHS ?= armv6 armv7 70 | else # } < 3.0 { 71 | ARCHS ?= armv6 72 | endif # } 73 | 74 | ifeq ($(_TARGET_VERSION_GE_11_0),1) 75 | NEUTRAL_ARCH := arm64 76 | else 77 | NEUTRAL_ARCH := armv7 78 | endif 79 | 80 | ifeq ($(_TARGET_VERSION_GE_8_4),1) 81 | _THEOS_DARWIN_CAN_USE_MODULES := $(_THEOS_TRUE) 82 | endif 83 | 84 | # “iOS 9 changed the 32-bit pagesize on 64-bit CPUs from 4096 bytes to 16384: all 32-bit binaries 85 | # must now be compiled with -Wl,-segalign,4000.” https://twitter.com/saurik/status/654198997024796672 86 | ifneq ($(filter armv6 armv7 armv7s,$(THEOS_CURRENT_ARCH)),) 87 | LEGACYFLAGS := -Xlinker -segalign -Xlinker 4000 88 | endif 89 | 90 | # Warn about using clang >=12.0.0 when deploying for arm64e before iOS 14.0, which uses an old ABI 91 | # not supported by newer clang releases. 92 | ifneq ($(_DEPLOY_VERSION_GE_14_0),1) 93 | ifneq ($(filter arm64e,$(ARCHS)),) 94 | _TARGET_CC_VERSION_GE_1200 := $(call __vercmp,$(_THEOS_TARGET_CC_VERSION),ge,12.0.0) 95 | ifeq ($(_TARGET_CC_VERSION_GE_1200),1) 96 | before-all:: 97 | @$(PRINT_FORMAT_WARNING) "Building for iOS $(_THEOS_TARGET_OS_DEPLOYMENT_VERSION), but the current toolchain can’t produce arm64e binaries for iOS earlier than 14.0. More information: https://theos.dev/docs/arm64e-deployment" >&2 98 | endif 99 | endif 100 | endif 101 | 102 | # Use of __DATA_CONST causes broken binaries on iOS < 9. 103 | ifeq ($(_TARGET_VERSION_GE_10_0),1) 104 | ifeq ($(_DEPLOY_VERSION_GE_9_0),) 105 | LEGACYFLAGS := $(LEGACYFLAGS) -Xlinker -no_data_const 106 | endif 107 | endif 108 | -------------------------------------------------------------------------------- /makefiles/targets/_common/linux.mk: -------------------------------------------------------------------------------- 1 | # Variables that are common to all Linux-based targets. 2 | TARGET_EXE_EXT := 3 | TARGET_LIB_EXT := .so 4 | TARGET_AR_EXT := .a 5 | 6 | TARGET_LDFLAGS_DYNAMICLIB = -shared -Wl,-soname,$(1) 7 | TARGET_CFLAGS_DYNAMICLIB = -fPIC 8 | -------------------------------------------------------------------------------- /makefiles/tool.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/tool.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),tool) 5 | include $(THEOS_MAKE_PATH)/instance/tool.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/tweak.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/tweak.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),tweak) 5 | include $(THEOS_MAKE_PATH)/instance/tweak.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /makefiles/vercmp.mk: -------------------------------------------------------------------------------- 1 | empty := 2 | space := $(empty) $(empty) 3 | 4 | # __cmp function 5 | # 1. If the numbers are the same evaluate to "eq" and stop executaion. Else: 6 | # 2. Converts numbers to a per-digit space-separated format eg 80 becomes (8 0) 7 | # 3. Tests if either number being compared is longer than one digit. If so: 8 | # 1. calls ___vercmp_expand_backward to pre-pad any numbers with 0s to make both numbers the same length (1 1 0 cmp 1 becomes 1 1 0 cmp 0 0 1) 9 | # 2. Pre sets comparison result to equal as it will stop comparing as soon as it finds any unequal number 10 | # 3. Calls back to main vercmp if any numbers had multiple digits, otherwise: 11 | # If not: 12 | # 1. Sorts the two numbers and evaluates to 'lt' if the first number is first, otherwise 'gt' 13 | define __cmp 14 | $(if $(filter $(1),$(2)),eq,$(strip \ 15 | $(eval __CMP_NUM1:=$(subst 0,0 ,$(subst 1,1 ,$(subst 2,2 ,$(subst 3,3 ,$(subst 4,4 ,$(subst 5,5 ,$(subst 6,6 ,$(subst 7,7 ,$(subst 8,8 ,$(subst 9,9 ,$(1)))))))))))) \ 16 | $(eval __CMP_NUM2:=$(subst 0,0 ,$(subst 1,1 ,$(subst 2,2 ,$(subst 3,3 ,$(subst 4,4 ,$(subst 5,5 ,$(subst 6,6 ,$(subst 7,7 ,$(subst 8,8 ,$(subst 9,9 ,$(2)))))))))))) \ 17 | $(if $(filter-out 1,$(words $(__CMP_NUM1)))$(filter-out 1,$(words $(__CMP_NUM2))),$(strip \ 18 | $(call ___vercmp_expand_backward,__CMP_NUM1,$(__CMP_NUM1),$(__CMP_NUM2)) \ 19 | $(call ___vercmp_expand_backward,__CMP_NUM2,$(__CMP_NUM2),$(__CMP_NUM1)) \ 20 | $(eval __CMP_RES:=eq) \ 21 | $(call ___vercmp_presplit,__CMP_NUM1,__CMP_NUM2,__CMP_RES) \ 22 | ),$(if $(filter $(1),$(firstword $(sort $(1) $(2)))),lt,gt) \ 23 | ) \ 24 | )) 25 | endef 26 | 27 | # __vercmp NUMBER OPERATION NUMBER2 28 | # OPERATION is one of: lt, le, eq, ge, gt 29 | # 30 | # 1. Expands the arguments to arrays by splitting on "." 31 | # 2. converts 'le' to 'eq lt' and 'ge' to 'eq gt' 32 | # 3. Pads the ends of the versions with 0s to match length eg: 1 eq 1.0.1 becomes (1 0 0) eq (1 0 1) 33 | # 4. Evaluates to the internal function ___vercmp_presplit that expects the arguments to already have these transformations applied 34 | define __vercmp 35 | $(strip \ 36 | $(eval VERCMP_FIRST := $(subst .,$(space),$(1))) \ 37 | $(eval VERCMP_OP := $(if $(filter ge,$(2)),eq gt,$(if $(filter le,$(2)),eq lt,$(2)))) \ 38 | $(eval VERCMP_SECOND := $(subst .,$(space),$(3))) \ 39 | $(eval VERCMP_RES := eq) \ 40 | $(call ___vercmp_expand,VERCMP_FIRST,$(VERCMP_FIRST),$(VERCMP_SECOND)) \ 41 | $(call ___vercmp_expand,VERCMP_SECOND,$(VERCMP_SECOND),$(VERCMP_FIRST)) \ 42 | $(if $(filter $(VERCMP_OP),$(call ___vercmp_presplit,VERCMP_FIRST,VERCMP_SECOND,VERCMP_RES)),1,) \ 43 | ) 44 | endef 45 | 46 | # ___vercmp_presplit TEMP_VERSION_ARRAY_VARIABLE1 TEMP_VERSION_ARRAY_VARIABLE2 TEMP_RESULT_VARIABLE 47 | # 1. Iterates over each word in TEMP_VERSION_ARRAY_VARIABLE1 and, if the current result was eq, 48 | # 1. Extracts the first remaining word from TEMP_VERSION_ARRAY_VARIABLE2 (call it CURRENT_WORD2 49 | # in this pseudocode) and removes the first word from TEMP_VERSION_ARRAY_VARIABLE2 50 | # 2. Updates the comparison result to be the result of __cmp CURRENT_WORD CURRENT_WORD2 51 | # 2. Evaluates to the value of TEMP_RESULT_VARIABLE 52 | define ___vercmp_presplit 53 | $(strip \ 54 | $(foreach ver1,$(value $(1)),$(if $(filter eq,$(value $(3))), \ 55 | $(eval $(3):=$(call __cmp,$(ver1),$(firstword $(value $(2)))$(eval $(2):=$(wordlist 2,$(words $(value $(2))),$(value $(2)))))) \ 56 | ,)) \ 57 | $(value $(3)) \ 58 | ) 59 | endef 60 | 61 | # ___vercmp_expand WORDLIST1 WORDLIST2 62 | # 63 | # Pads WORDLIST1 with trailing 0 words to be as long as WORDLIST2 64 | # 65 | # 1. Abort if WORDLIST1 already has the same number of words as WORDLIST2 66 | # 2. Abort if WORDLIST1 has fewer words than WORDLIST2 67 | # 3. Add a trailing 0 to WORDLIST1 and call itself again 68 | define ___vercmp_expand 69 | $(if $(filter $(words $(2)),$(words $(3))),, \ 70 | $(if $(filter $(words $(3)),$(firstword $(sort $(words $(2)) $(words $(3))))),, \ 71 | $(eval $(1) += 0) \ 72 | $(call ___vercmp_expand,$(1),$(value $(1)),$(3)) \ 73 | ) \ 74 | ) 75 | endef 76 | 77 | # ___vercmp_expand_backward WORDLIST1 WORDLIST2 78 | # 79 | # Pads WORDLIST1 with leading 0 words to be as long as WORDLIST2 80 | # 81 | # 1. Abort if WORDLIST1 already has the same number of words as WORDLIST2 82 | # 2. Abort if WORDLIST1 has fewer words than WORDLIST2 83 | # 3. Add a leading 0 to WORDLIST1 and call itself again 84 | define ___vercmp_expand_backward 85 | $(if $(filter $(words $(2)),$(words $(3))),, \ 86 | $(if $(filter $(words $(3)),$(firstword $(sort $(words $(2)) $(words $(3))))),, \ 87 | $(eval $(1) := 0 $(1)) \ 88 | $(call ___vercmp_expand_backward,$(1),$(value $(1)),$(3)) \ 89 | ) \ 90 | ) 91 | endef 92 | 93 | ifeq (0,1) 94 | # __vercmp test code 95 | $(info 1.8,gt,1.7: $(call __vercmp,1.8,gt,1.7)) 96 | $(info 1.7,gt,1.8: $(call __vercmp,1.7,gt,1.8)) 97 | $(info 1.8,eq,1.8: $(call __vercmp,1.8,eq,1.8)) 98 | $(info 1.8,eq,1.7: $(call __vercmp,1.8,eq,1.7)) 99 | $(info 1.8,lt,1.9: $(call __vercmp,1.8,lt,1.9)) 100 | $(info 1.8,lt,1.10: $(call __vercmp,1.8,lt,1.10)) 101 | $(info 5.0,ge,5.0.1: $(call __vercmp,5.0,ge,5.0.1)) 102 | $(info 5.0.1,ge,5.0: $(call __vercmp,5.0.1,ge,5.0)) 103 | $(info 5.0,ge,5.0: $(call __vercmp,5.0.1,ge,5.0)) 104 | $(info 5.0,le,5.0.1: $(call __vercmp,5.0,le,5.0.1)) 105 | $(info 5.0,le,5.0: $(call __vercmp,5.0,le,5.0)) 106 | $(info 5.0,le,4.9: $(call __vercmp,5.0.1,le,4.9)) 107 | endif 108 | -------------------------------------------------------------------------------- /makefiles/xcodeproj.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(THEOS_CURRENT_INSTANCE),) 2 | include $(THEOS_MAKE_PATH)/master/xcodeproj.mk 3 | else 4 | ifeq ($(_THEOS_CURRENT_TYPE),xcodeproj) 5 | include $(THEOS_MAKE_PATH)/instance/xcodeproj.mk 6 | endif 7 | endif 8 | -------------------------------------------------------------------------------- /mod/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opa334/theos/acb68177c6413676b0298bb42f5c421cc008aead/mod/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "theos", 3 | "version": "2.5.0", 4 | "description": "A cross-platform build system for creating iOS, macOS, Linux, and Windows programs.", 5 | "author": "Theos", 6 | "license": "GPL-3.0", 7 | "homepage": "https://theos.github.io/", 8 | "bugs": "https://github.com/theos/theos/issues", 9 | 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/theos/theos.git" 13 | }, 14 | 15 | "keywords": [ 16 | "build", 17 | "ios", 18 | "iphone", 19 | "mac", 20 | "jailbreak", 21 | "objc" 22 | ], 23 | 24 | "bin": { 25 | "logos": "./bin/logos.pl", 26 | "logify": "./bin/logify.pl", 27 | "nic": "./bin/nic.pl", 28 | "nicify": "./bin/nicify.pl", 29 | "denicify": "./bin/denicify.pl" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sdks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opa334/theos/acb68177c6413676b0298bb42f5c421cc008aead/sdks/.keep -------------------------------------------------------------------------------- /templates/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opa334/theos/acb68177c6413676b0298bb42f5c421cc008aead/templates/.keep -------------------------------------------------------------------------------- /toolchain/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opa334/theos/acb68177c6413676b0298bb42f5c421cc008aead/toolchain/.keep -------------------------------------------------------------------------------- /vendor/mod/rootless/instance/framework.mk: -------------------------------------------------------------------------------- 1 | _THEOS_INTERNAL_LDFLAGS += -dynamiclib -install_name "@rpath/$(_LOCAL_INSTANCE_TARGET)" 2 | -------------------------------------------------------------------------------- /vendor/mod/rootless/instance/library.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(_LOCAL_LINKAGE_TYPE),static) 2 | _THEOS_INTERNAL_LDFLAGS += -install_name "@rpath/$(THEOS_CURRENT_INSTANCE)$(TARGET_LIB_EXT)" 3 | endif 4 | -------------------------------------------------------------------------------- /vendor/mod/rootless/instance/rules.mk: -------------------------------------------------------------------------------- 1 | _THEOS_INTERNAL_LDFLAGS += -rpath $(THEOS_PACKAGE_INSTALL_PREFIX)/Library/Frameworks -rpath $(THEOS_PACKAGE_INSTALL_PREFIX)/usr/lib # v1 2 | _THEOS_INTERNAL_LDFLAGS += -rpath '@loader_path/.jbroot/Library/Frameworks' -rpath '@loader_path/.jbroot/usr/lib' # v2 3 | -------------------------------------------------------------------------------- /vendor/mod/rootless/package.mk: -------------------------------------------------------------------------------- 1 | THEOS_PACKAGE_INSTALL_PREFIX = /var/jb 2 | -------------------------------------------------------------------------------- /vendor/mod/rootless/package/deb.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(THEOS_PACKAGE_ARCH),iphoneos-arm64) 2 | THEOS_PACKAGE_ARCH := iphoneos-arm64 3 | endif 4 | --------------------------------------------------------------------------------