├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── bin ├── class-dump ├── class-dump-z ├── iosod ├── ldid2 └── lipo ├── install.sh ├── notes └── arm64e-legacy.txt ├── specifications ├── iPhoneOS │ └── Specifications │ │ ├── iPhoneOSPackageTypes.xcspec │ │ └── iPhoneOSProductTypes.xcspec └── iPhoneSimulator │ └── Specifications │ ├── iPhone Simulator PackageTypes.xcspec │ └── iPhone Simulator ProductTypes.xcspec └── templates ├── Activator Listener.xctemplate ├── Icon-small.png ├── Icon-small@2x.png ├── TemplateIcon.icns └── TemplateInfo.plist ├── Base.xctemplate ├── TemplateIcon.icns └── TemplateInfo.plist ├── Cocoa Touch Library.xctemplate ├── TemplateIcon.icns ├── TemplateInfo.plist ├── ___PACKAGENAMEASIDENTIFIER___.h └── ___PACKAGENAMEASIDENTIFIER___.m ├── Command-line Tool.xctemplate ├── TemplateIcon.icns ├── TemplateInfo.plist └── ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld │ ├── .xccurrentversion │ └── ___PACKAGENAMEASIDENTIFIER___.xcdatamodel │ ├── .xccurrentversion │ └── contents ├── Debian Package.xctemplate ├── TemplateIcon.icns └── TemplateInfo.plist ├── Empty Project.xctemplate ├── TemplateIcon.icns └── TemplateInfo.plist ├── Logos Tweak.xctemplate ├── TemplateIcon.icns ├── TemplateInfo.plist ├── ___PACKAGENAMEASIDENTIFIER___.mm └── ___PACKAGENAMEASIDENTIFIER___.xm ├── ManPage.xctemplate ├── TemplateIcon.icns ├── TemplateInfo.plist └── ___PACKAGENAMEASIDENTIFIER___.1 ├── PreferenceLoader Bundle.xctemplate ├── TemplateIcon.icns ├── TemplateInfo.plist ├── ___PACKAGENAMEASIDENTIFIER___-Info.plist ├── ___PACKAGENAMEASIDENTIFIER___-PreferenceBundles.plist ├── ___PACKAGENAMEASIDENTIFIER___-PreferenceLoader.plist ├── ___PACKAGENAMEASIDENTIFIER___-Preferences.plist ├── ___PACKAGENAMEASIDENTIFIER___Controller.h ├── ___PACKAGENAMEASIDENTIFIER___Controller.m ├── ___PACKAGENAMEASIDENTIFIER___Icon.png └── ___PACKAGENAMEASIDENTIFIER___Icon@2x.png ├── PreferenceLoader.xctemplate ├── TemplateIcon.icns ├── TemplateInfo.plist ├── ___PACKAGENAMEASIDENTIFIER___.plist ├── ___PACKAGENAMEASIDENTIFIER___Icon.png └── ___PACKAGENAMEASIDENTIFIER___Icon@2x.png ├── Unit Tests.xctemplate ├── TemplateIcon.icns └── TemplateInfo.plist └── XPC Service.xctemplate ├── TemplateIcon.icns ├── TemplateInfo.plist ├── main.m ├── postinst └── prerm /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | ._* 3 | .VolumeIcon.icns 4 | .com.apple.timemachine.supported 5 | .fseventsd 6 | .localized 7 | .DocumentRevisions-V100 8 | .Spotlight-V100 9 | .vol 10 | 11 | testing 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/simject"] 2 | path = deps/simject 3 | url = https://github.com/angelXwind/simject 4 | [submodule "deps/sdks"] 5 | path = deps/sdks 6 | url = https://github.com/theos/sdks 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | iOSOpenDev is an independent project and has not been authorized, sponsored, or otherwise approved by Apple Inc. 2 | 3 | IOS is a registered trademark of Cisco and used under license by Apple Inc. 4 | 5 | Xcode is a registered trademark of Apple Inc. 6 | 7 | iOSOpenDev -- iOS Open Development 8 | Copyright (c) 2012-2013 Spencer W.S. James (Kokoabim) . 9 | 10 | GNU GENERAL PUBLIC LICENSE 11 | Version 2, June 1991 12 | 13 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | Everyone is permitted to copy and distribute verbatim copies 16 | of this license document, but changing it is not allowed. 17 | 18 | Preamble 19 | 20 | The licenses for most software are designed to take away your 21 | freedom to share and change it. By contrast, the GNU General Public 22 | License is intended to guarantee your freedom to share and change free 23 | software--to make sure the software is free for all its users. This 24 | General Public License applies to most of the Free Software 25 | Foundation's software and to any other program whose authors commit to 26 | using it. (Some other Free Software Foundation software is covered by 27 | the GNU Lesser General Public License instead.) You can apply it to 28 | your programs, too. 29 | 30 | When we speak of free software, we are referring to freedom, not 31 | price. Our General Public Licenses are designed to make sure that you 32 | have the freedom to distribute copies of free software (and charge for 33 | this service if you wish), that you receive source code or can get it 34 | if you want it, that you can change the software or use pieces of it 35 | in new free programs; and that you know you can do these things. 36 | 37 | To protect your rights, we need to make restrictions that forbid 38 | anyone to deny you these rights or to ask you to surrender the rights. 39 | These restrictions translate to certain responsibilities for you if you 40 | distribute copies of the software, or if you modify it. 41 | 42 | For example, if you distribute copies of such a program, whether 43 | gratis or for a fee, you must give the recipients all the rights that 44 | you have. You must make sure that they, too, receive or can get the 45 | source code. And you must show them these terms so they know their 46 | rights. 47 | 48 | We protect your rights with two steps: (1) copyright the software, and 49 | (2) offer you this license which gives you legal permission to copy, 50 | distribute and/or modify the software. 51 | 52 | Also, for each author's protection and ours, we want to make certain 53 | that everyone understands that there is no warranty for this free 54 | software. If the software is modified by someone else and passed on, we 55 | want its recipients to know that what they have is not the original, so 56 | that any problems introduced by others will not reflect on the original 57 | authors' reputations. 58 | 59 | Finally, any free program is threatened constantly by software 60 | patents. We wish to avoid the danger that redistributors of a free 61 | program will individually obtain patent licenses, in effect making the 62 | program proprietary. To prevent this, we have made it clear that any 63 | patent must be licensed for everyone's free use or not licensed at all. 64 | 65 | The precise terms and conditions for copying, distribution and 66 | modification follow. 67 | 68 | GNU GENERAL PUBLIC LICENSE 69 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 70 | 71 | 0. This License applies to any program or other work which contains 72 | a notice placed by the copyright holder saying it may be distributed 73 | under the terms of this General Public License. The "Program", below, 74 | refers to any such program or work, and a "work based on the Program" 75 | means either the Program or any derivative work under copyright law: 76 | that is to say, a work containing the Program or a portion of it, 77 | either verbatim or with modifications and/or translated into another 78 | language. (Hereinafter, translation is included without limitation in 79 | the term "modification".) Each licensee is addressed as "you". 80 | 81 | Activities other than copying, distribution and modification are not 82 | covered by this License; they are outside its scope. The act of 83 | running the Program is not restricted, and the output from the Program 84 | is covered only if its contents constitute a work based on the 85 | Program (independent of having been made by running the Program). 86 | Whether that is true depends on what the Program does. 87 | 88 | 1. You may copy and distribute verbatim copies of the Program's 89 | source code as you receive it, in any medium, provided that you 90 | conspicuously and appropriately publish on each copy an appropriate 91 | copyright notice and disclaimer of warranty; keep intact all the 92 | notices that refer to this License and to the absence of any warranty; 93 | and give any other recipients of the Program a copy of this License 94 | along with the Program. 95 | 96 | You may charge a fee for the physical act of transferring a copy, and 97 | you may at your option offer warranty protection in exchange for a fee. 98 | 99 | 2. You may modify your copy or copies of the Program or any portion 100 | of it, thus forming a work based on the Program, and copy and 101 | distribute such modifications or work under the terms of Section 1 102 | above, provided that you also meet all of these conditions: 103 | 104 | a) You must cause the modified files to carry prominent notices 105 | stating that you changed the files and the date of any change. 106 | 107 | b) You must cause any work that you distribute or publish, that in 108 | whole or in part contains or is derived from the Program or any 109 | part thereof, to be licensed as a whole at no charge to all third 110 | parties under the terms of this License. 111 | 112 | c) If the modified program normally reads commands interactively 113 | when run, you must cause it, when started running for such 114 | interactive use in the most ordinary way, to print or display an 115 | announcement including an appropriate copyright notice and a 116 | notice that there is no warranty (or else, saying that you provide 117 | a warranty) and that users may redistribute the program under 118 | these conditions, and telling the user how to view a copy of this 119 | License. (Exception: if the Program itself is interactive but 120 | does not normally print such an announcement, your work based on 121 | the Program is not required to print an announcement.) 122 | 123 | These requirements apply to the modified work as a whole. If 124 | identifiable sections of that work are not derived from the Program, 125 | and can be reasonably considered independent and separate works in 126 | themselves, then this License, and its terms, do not apply to those 127 | sections when you distribute them as separate works. But when you 128 | distribute the same sections as part of a whole which is a work based 129 | on the Program, the distribution of the whole must be on the terms of 130 | this License, whose permissions for other licensees extend to the 131 | entire whole, and thus to each and every part regardless of who wrote it. 132 | 133 | Thus, it is not the intent of this section to claim rights or contest 134 | your rights to work written entirely by you; rather, the intent is to 135 | exercise the right to control the distribution of derivative or 136 | collective works based on the Program. 137 | 138 | In addition, mere aggregation of another work not based on the Program 139 | with the Program (or with a work based on the Program) on a volume of 140 | a storage or distribution medium does not bring the other work under 141 | the scope of this License. 142 | 143 | 3. You may copy and distribute the Program (or a work based on it, 144 | under Section 2) in object code or executable form under the terms of 145 | Sections 1 and 2 above provided that you also do one of the following: 146 | 147 | a) Accompany it with the complete corresponding machine-readable 148 | source code, which must be distributed under the terms of Sections 149 | 1 and 2 above on a medium customarily used for software interchange; or, 150 | 151 | b) Accompany it with a written offer, valid for at least three 152 | years, to give any third party, for a charge no more than your 153 | cost of physically performing source distribution, a complete 154 | machine-readable copy of the corresponding source code, to be 155 | distributed under the terms of Sections 1 and 2 above on a medium 156 | customarily used for software interchange; or, 157 | 158 | c) Accompany it with the information you received as to the offer 159 | to distribute corresponding source code. (This alternative is 160 | allowed only for noncommercial distribution and only if you 161 | received the program in object code or executable form with such 162 | an offer, in accord with Subsection b above.) 163 | 164 | The source code for a work means the preferred form of the work for 165 | making modifications to it. For an executable work, complete source 166 | code means all the source code for all modules it contains, plus any 167 | associated interface definition files, plus the scripts used to 168 | control compilation and installation of the executable. However, as a 169 | special exception, the source code distributed need not include 170 | anything that is normally distributed (in either source or binary 171 | form) with the major components (compiler, kernel, and so on) of the 172 | operating system on which the executable runs, unless that component 173 | itself accompanies the executable. 174 | 175 | If distribution of executable or object code is made by offering 176 | access to copy from a designated place, then offering equivalent 177 | access to copy the source code from the same place counts as 178 | distribution of the source code, even though third parties are not 179 | compelled to copy the source along with the object code. 180 | 181 | 4. You may not copy, modify, sublicense, or distribute the Program 182 | except as expressly provided under this License. Any attempt 183 | otherwise to copy, modify, sublicense or distribute the Program is 184 | void, and will automatically terminate your rights under this License. 185 | However, parties who have received copies, or rights, from you under 186 | this License will not have their licenses terminated so long as such 187 | parties remain in full compliance. 188 | 189 | 5. You are not required to accept this License, since you have not 190 | signed it. However, nothing else grants you permission to modify or 191 | distribute the Program or its derivative works. These actions are 192 | prohibited by law if you do not accept this License. Therefore, by 193 | modifying or distributing the Program (or any work based on the 194 | Program), you indicate your acceptance of this License to do so, and 195 | all its terms and conditions for copying, distributing or modifying 196 | the Program or works based on it. 197 | 198 | 6. Each time you redistribute the Program (or any work based on the 199 | Program), the recipient automatically receives a license from the 200 | original licensor to copy, distribute or modify the Program subject to 201 | these terms and conditions. You may not impose any further 202 | restrictions on the recipients' exercise of the rights granted herein. 203 | You are not responsible for enforcing compliance by third parties to 204 | this License. 205 | 206 | 7. If, as a consequence of a court judgment or allegation of patent 207 | infringement or for any other reason (not limited to patent issues), 208 | conditions are imposed on you (whether by court order, agreement or 209 | otherwise) that contradict the conditions of this License, they do not 210 | excuse you from the conditions of this License. If you cannot 211 | distribute so as to satisfy simultaneously your obligations under this 212 | License and any other pertinent obligations, then as a consequence you 213 | may not distribute the Program at all. For example, if a patent 214 | license would not permit royalty-free redistribution of the Program by 215 | all those who receive copies directly or indirectly through you, then 216 | the only way you could satisfy both it and this License would be to 217 | refrain entirely from distribution of the Program. 218 | 219 | If any portion of this section is held invalid or unenforceable under 220 | any particular circumstance, the balance of the section is intended to 221 | apply and the section as a whole is intended to apply in other 222 | circumstances. 223 | 224 | It is not the purpose of this section to induce you to infringe any 225 | patents or other property right claims or to contest validity of any 226 | such claims; this section has the sole purpose of protecting the 227 | integrity of the free software distribution system, which is 228 | implemented by public license practices. Many people have made 229 | generous contributions to the wide range of software distributed 230 | through that system in reliance on consistent application of that 231 | system; it is up to the author/donor to decide if he or she is willing 232 | to distribute software through any other system and a licensee cannot 233 | impose that choice. 234 | 235 | This section is intended to make thoroughly clear what is believed to 236 | be a consequence of the rest of this License. 237 | 238 | 8. If the distribution and/or use of the Program is restricted in 239 | certain countries either by patents or by copyrighted interfaces, the 240 | original copyright holder who places the Program under this License 241 | may add an explicit geographical distribution limitation excluding 242 | those countries, so that distribution is permitted only in or among 243 | countries not thus excluded. In such case, this License incorporates 244 | the limitation as if written in the body of this License. 245 | 246 | 9. The Free Software Foundation may publish revised and/or new versions 247 | of the General Public License from time to time. Such new versions will 248 | be similar in spirit to the present version, but may differ in detail to 249 | address new problems or concerns. 250 | 251 | Each version is given a distinguishing version number. If the Program 252 | specifies a version number of this License which applies to it and "any 253 | later version", you have the option of following the terms and conditions 254 | either of that version or of any later version published by the Free 255 | Software Foundation. If the Program does not specify a version number of 256 | this License, you may choose any version ever published by the Free Software 257 | Foundation. 258 | 259 | 10. If you wish to incorporate parts of the Program into other free 260 | programs whose distribution conditions are different, write to the author 261 | to ask for permission. For software which is copyrighted by the Free 262 | Software Foundation, write to the Free Software Foundation; we sometimes 263 | make exceptions for this. Our decision will be guided by the two goals 264 | of preserving the free status of all derivatives of our free software and 265 | of promoting the sharing and reuse of software generally. 266 | 267 | NO WARRANTY 268 | 269 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 270 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 271 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 272 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 273 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 274 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 275 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 276 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 277 | REPAIR OR CORRECTION. 278 | 279 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 280 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 281 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 282 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 283 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 284 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 285 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 286 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 287 | POSSIBILITY OF SUCH DAMAGES. 288 | 289 | END OF TERMS AND CONDITIONS 290 | 291 | How to Apply These Terms to Your New Programs 292 | 293 | If you develop a new program, and you want it to be of the greatest 294 | possible use to the public, the best way to achieve this is to make it 295 | free software which everyone can redistribute and change under these terms. 296 | 297 | To do so, attach the following notices to the program. It is safest 298 | to attach them to the start of each source file to most effectively 299 | convey the exclusion of warranty; and each file should have at least 300 | the "copyright" line and a pointer to where the full notice is found. 301 | 302 | 303 | Copyright (C) 304 | 305 | This program is free software; you can redistribute it and/or modify 306 | it under the terms of the GNU General Public License as published by 307 | the Free Software Foundation; either version 2 of the License, or 308 | (at your option) any later version. 309 | 310 | This program is distributed in the hope that it will be useful, 311 | but WITHOUT ANY WARRANTY; without even the implied warranty of 312 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 313 | GNU General Public License for more details. 314 | 315 | You should have received a copy of the GNU General Public License along 316 | with this program; if not, write to the Free Software Foundation, Inc., 317 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 318 | 319 | Also add information on how to contact you by electronic and paper mail. 320 | 321 | If the program is interactive, make it output a short notice like this 322 | when it starts in an interactive mode: 323 | 324 | Gnomovision version 69, Copyright (C) year name of author 325 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 326 | This is free software, and you are welcome to redistribute it 327 | under certain conditions; type `show c' for details. 328 | 329 | The hypothetical commands `show w' and `show c' should show the appropriate 330 | parts of the General Public License. Of course, the commands you use may 331 | be called something other than `show w' and `show c'; they could even be 332 | mouse-clicks or menu items--whatever suits your program. 333 | 334 | You should also get your employer (if you work as a programmer) or your 335 | school, if any, to sign a "copyright disclaimer" for the program, if 336 | necessary. Here is a sample; alter the names: 337 | 338 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 339 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 340 | 341 | , 1 April 1989 342 | Ty Coon, President of Vice 343 | 344 | This General Public License does not permit incorporating your program into 345 | proprietary programs. If your program is a subroutine library, you may 346 | consider it more useful to permit linking proprietary applications with the 347 | library. If this is what you want to do, use the GNU Lesser General 348 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## iOSOpenDev—iOS Open Development 2 | - Copyright (c) 2012-2013 Spencer W.S. James (Kokoabim). 3 | - Copyright (c) 2019- Matt Clarke (Matchstic). 4 | 5 | iOSOpenDev allows you to develop tweaks and other jailbroken utilities using Xcode. 6 | 7 | ### Dependencies 8 | 9 | - [`theos`](https://github.com/theos/theos): to handle stuff like pre-processing Logos syntax. 10 | - [`simject`](https://github.com/angelXwind/simject): to run tweaks in the iOS Simulator 11 | 12 | ### Installation 13 | 14 | 0. Make sure you have installed and setup `theos` on your machine 15 | 1. Clone this repository to `/opt` 16 | The end path for e.g. `install.sh` should be `/opt/iOSOpenDev/install.sh` 17 | 2. `cd` to it 18 | 3. Run `git submodule init && git submodule update` 19 | 4. Run `./install.sh` (see options below to e.g. specify where `theos` is installed) 20 | 5. For future ease of use, its a good idea to make `/opt` writeable for your user account without using `sudo`. 21 | 22 | NOTE: if you run the script more than once, that may fail when copying SDKs. Try clearing the ones in `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/` (NOT the most recent one, or the symlinked one), and try again. 23 | 24 | ### `./install.sh` options 25 | 26 | | Option | Result | 27 | | ------------------------ | ------------------------------------------------------------------------------------- | 28 | | `--theos=` | Sets the path where `theos` is installed. Default: `/opt/theos` | 29 | | `--no-simject` | Skips `simject` as part of the installation procedure | 30 | | `--patch-simject` | (Re-)patches available iOS simulators after installing a new one | 31 | | `--patch-xcode` | (Re-)patches Xcode for open development (required after Xcode updates) | 32 | 33 | ### Handling Xcode updates 34 | 35 | Whenever you update Xcode, the new SDK needs to be patched, and the old ones to be moved into place. Simply run the following to do this: 36 | 37 | ``` 38 | ./install.sh --patch-xcode 39 | ``` 40 | 41 | You may also need to patch any new iOS simulators. Use the following to do this: 42 | 43 | ``` 44 | ./install.sh --patch-simject 45 | ``` 46 | 47 | ### Usage 48 | 49 | - To create a new project, use Xcode's `File -> New -> Project` option. Then, scroll down to `Templates` in the `iOS` tab. 50 | - To compile a project, use Xcode's `Product -> Build`. Executables built can be found via the auto-generated `LatestBuild` symlink. 51 | - To build a `.deb`, use Xcode's `Product -> Build For -> Profiling`. Built packages are found in `Packages`. 52 | - To change version numbers of a built package, modify `PackageVersion.plist`. 53 | 54 | ### Known issues 55 | 56 | When you create a new project, you'll need to adjust the deployment target to `<= 10.3` if you're targeting `armv7`. This is to avoid Xcode complaining that iOS 12 and higher don't support 32-bit targets. 57 | 58 | ### iOS Simulator 59 | 60 | Right now, running tweaks in the iOS Simulator isn't super smooth. You need to do the following: 61 | 62 | 1. Change the value of the `SIMJECT` flag in your project settings to `YES`. 63 | 2. Add the following to the top of your `.xm` file: 64 | ``` 65 | %config(generator=internal); 66 | ``` 67 | 3. Start an iOS Simulator (`Xcode -> Open Developer Tool -> Simulator`) and wait for it to finish starting up 68 | 4. Copy the `.plist` sitting alongside your `dylib` to `/opt/simject` (temporary workaround, needed only the first time) 69 | 5. Compile your tweak again targeting an iOS Simulator 70 | 71 | ### Troubleshooting 72 | 73 | For the arm64e ABI to be handled correctly, you MUST use an SDK that has been patched such that ENTITLEMENTS_REQUIRED=NO. Otherwise, building will fail during codesigning. 74 | 75 | ### Authors 76 | 77 | * Follow [@kokoabim](https://twitter.com/kokoabim) 78 | * Follow [@_Matchstic](https://twitter.com/_Matchstic) 79 | -------------------------------------------------------------------------------- /bin/class-dump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/bin/class-dump -------------------------------------------------------------------------------- /bin/class-dump-z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/bin/class-dump-z -------------------------------------------------------------------------------- /bin/iosod: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ----------------------------------------------------------------------- 4 | # iOSOpenDev -- iOS Open Development (http://www.iOSOpenDev.com) 5 | # Copyright (C) 2012-2013 Spencer W.S. James (Kokoabim) 6 | # ----------------------------------------------------------------------- 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # You should have received a copy of the GNU General Public License along 16 | # with this program; if not, write to the Free Software Foundation, Inc., 17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | # ----------------------------------------------------------------------- 19 | # iOSOpenDev is an independent project and has not been authorized, sponsored, or otherwise approved by Apple Inc. 20 | # IOS is a registered trademark of Cisco and is used under license by Apple Inc. 21 | # Xcode is a registered trademark of Apple Inc. 22 | # ----------------------------------------------------------------------- 23 | 24 | export setCmd="set -eo pipefail" 25 | $setCmd 26 | 27 | # path # 28 | export PATH=/opt/iOSOpenDev/bin:/opt/theos/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH 29 | 30 | # script # 31 | 32 | export scriptName="${0##*/}" 33 | export scriptVer="1.5" 34 | export originalArguments=("$@") 35 | export activeActionArg 36 | 37 | export iOSOpenDevPath="/opt/iOSOpenDev" 38 | 39 | export userName="${SUDO_USER-$USER}" 40 | export userGroup=`id -g $userName` 41 | export userHome=`eval echo ~$userName` 42 | export bashProfileFiles=("$userHome/.bash_profile" "$userHome/.bashrc" "$userHome/.zshrc" "$userHome/.bash_login" "$userHome/.profile") 43 | 44 | export tempDirsFile="`mktemp -d -t $scriptName`/tempdirs" 45 | touch "$tempDirsFile" 46 | 47 | unset LANG 48 | 49 | # development tools # 50 | 51 | xcodeAsAppPath=`xcode-select -p` 52 | [[ ! -d "$xcodeAsAppPath" ]] || \ 53 | export DEVELOPER_DIR="$xcodeAsAppPath" 54 | 55 | # === "actions" === # 56 | 57 | export ActionNames=( \ 58 | "SignCode" \ 59 | "BuildPackage" "InstallPackage" "RemovePackage" "PurgePackage" \ 60 | "SshToDevice" "RunCmdOnDevice" "RunFuncOnDevice" \ 61 | "UpdateIncludeAndLib" \ 62 | "DumpSDKHeaders" "CopyHeadersToSDK" "DumpAndCopyHeaders" "RemoveCopiedHeaders" "DumpAllHeaders" \ 63 | "AddSshKeyToDevice" \ 64 | "XcodeBuildPhase" "XcodeBuildPhaseLogos" "XcodeBuildPhaseSimjectHelper" "XcodeBuildPhaseArm64eLegacy" \ 65 | "XcodeBuildPhaseArm64ePrepare" "Help") 66 | export ActionProperty_ShortArg=0 67 | export ActionProperty_ShortUsage=1 68 | export ActionProperty_Options=2 69 | export ActionProperty_MinArgs=3 70 | export ActionProperty_MaxArgs=4 71 | export ActionProperty_Function=5 72 | export ActionProperty_RequireSudo=6 73 | export ActionProperty_LongUsage=7 74 | 75 | export Action_SignCode=("sign" "[-i identity] executable_file" "i:" 1 1 signCode false \ 76 | " Add code signature to . If is omitted, 77 | ldid is used. If is provided, codesign is used and the 78 | certificate of the matching digital identity in the Keychain is used.") 79 | 80 | export Action_BuildPackage=("build" "[-p version_plist] [-z] package_directory output_directory" "p:z" 2 2 buildPackage false \ 81 | " Build a Debian package using and place the package 82 | in . If is provided, the plist will be 83 | used to set the package's control file's Version field before building. 84 | If is provided, a zip file is created in also.") 85 | 86 | export Action_InstallPackage=("install" "[-h host_address] [-p host_port] package_file" "h:p:" 1 1 managePackageOnDevice false \ 87 | " Install on device at . If is 88 | omitted, the environment variable iOSOpenDevDevice is used. If 89 | is omitted, the environment variable iOSOpenDevPort is used or, if that 90 | variable does not exist, the default SSH port 22 is used.") 91 | 92 | export Action_RemovePackage=("remove" "[-h host_address] [-p host_port] package_name" "h:p:" 1 1 managePackageOnDevice false \ 93 | " Remove from device at . If 94 | is omitted, the environment variable iOSOpenDevDevice is used. If 95 | is omitted, the environment variable iOSOpenDevPort is used 96 | or, if that variable does not exist, the default SSH port 22 is used.") 97 | 98 | export Action_PurgePackage=("purge" "[-h host_address] [-p host_port] package_name" "h:p:" 1 1 managePackageOnDevice false \ 99 | " Purge from device at . If is 100 | omitted, the environment variable iOSOpenDevDevice is used. If 101 | is omitted, the environment variable iOSOpenDevPort is used or, if that 102 | variable does not exist, the default SSH port 22 is used.") 103 | 104 | export Action_DumpSDKHeaders=("dump" "[-i] [-z] framework_type output_directory" "iz" 2 2 dumpSDKHeaders false \ 105 | " Generate header files of the specified iOS SDK of its 106 | classes, categories and protocols in . If is 107 | omitted, class-dump-z is used. If is used, class-dump is used. If 108 | is provided, import statements are not converted from \"header.h\" 109 | to . All import statements, if the imported 110 | header file exists in the framework being processed, are converted to 111 | framework-style imports since the header files being dumped will be 112 | copied to SDK directories. If is springboard then 113 | import statements are not converted since the header files are placed 114 | in an include directory. 115 | 116 | Framework type options: 117 | public, private, springboard 118 | 119 | Outputted structure for public and private options: 120 | /Foo.framework/Headers/*.h 121 | 122 | Outputted structure for springboard option: 123 | /*.h") 124 | 125 | export Action_CopyHeadersToSDK=("cp2sdk" "[-t header_tag] framework_type source_directory" "t:" 2 2 copyHeadersToSDK true \ 126 | " Copy header files from to the location of the 127 | specified iOS SDK , tagging each header file with 128 | , if provided. Tagging is performed for distinguishability 129 | between original and other dumped header files. If is 130 | public and is empty, a header tag of \"_Dumped\" is used 131 | so that original SDK header files are not overwritten. 132 | 133 | Framework type options: 134 | public, private, springboard 135 | 136 | Valid source structures for public and private options: 137 | /Foo.framework/Headers/*.h 138 | /Foo.framework/*.h 139 | 140 | Valid source structure for springboard option: 141 | /*.h 142 | 143 | Location of public framework type: 144 | \$SDKROOT/System/Library/Frameworks 145 | 146 | Location of private framework type: 147 | \$SDKROOT/System/Library/PrivateFrameworks 148 | 149 | Location of springboard framework type: 150 | $iOSOpenDevPath/include/SpringBoard") 151 | 152 | export Action_DumpAndCopyHeaders=("dump2sdk" "[-i] [-z] [-t header_tag] framework_type" "it:z" 1 1 dumpAndCopyHeaders true \ 153 | " Generate and copy header files of the specified iOS SDK 154 | , tagging each header file with , if 155 | provided. If is omitted, class-dump-z is used. If is used, 156 | class-dump is used. If is provided, import statements are not 157 | converted from \"header.h\" to . 158 | 159 | Using this would be as if the dump argument was used then followed by 160 | the cp2sdk argument. Header files are outputted to a temporary 161 | directory which is removed. 162 | 163 | Framework type options: 164 | public, private, springboard") 165 | 166 | export Action_RemoveCopiedHeaders=("rmheaders" "framework_type header_tag" "" 2 2 removeCopiedHeaders true \ 167 | " Remove previously copied header files of the specified iOS SDK 168 | which are tagged with . 169 | 170 | Framework type options: 171 | public or private") 172 | 173 | export Action_AddSshKeyToDevice=("sshkey" "[-h host_address] [-p host_port] [-r]" "h:rp:" 0 0 addSshKeyToDevice false \ 174 | " Add the local user's public SSH authentication key as an authorized key 175 | to the root account of the device at . If 176 | is omitted, the environment variable iOSOpenDevDevice is used. If 177 | is omitted, the environment variable iOSOpenDevPort is used 178 | or, if that variable does not exist, the default SSH port 22 is used. If 179 | is omitted, the current user is used. If is used, root is used. 180 | If the local user does not already have a SSH authentication key then 181 | one will be generated and the passphrase to set for it will be asked. 182 | Adding a user's public SSH authentication key as an authorized key will 183 | allow public key authentication which requires no password upon log on 184 | of SSH connections. This is required for Xcode Build Phases of projects 185 | created from iOSOpenDev templates to function. This should be performed 186 | by the account that will be used for developing in Xcode. Public keys 187 | are stored in the root account's ~/.ssh/authorized_keys file.") 188 | 189 | export Action_DumpAllHeaders=("dumpall2sdk" "[-i] [-z]" "iz" 0 0 dumpAllHeaders true \ 190 | " Generate and copy header files of the iOS SDK framework types public, 191 | private and springboard. If is omitted, class-dump-z is used. If 192 | is used, class-dump is used. If is provided, import statements 193 | are not converted from \"header.h\" to .") 194 | 195 | export Action_RunCmdOnDevice=("run" "[-h host_address] [-p host_port] command ..." "h:p:" 0 2048 runCmdOnDevice false \ 196 | " Run on device at . If is 197 | omitted, the environment variable iOSOpenDevDevice is used. If 198 | is omitted, the environment variable iOSOpenDevPort is 199 | used or, if that variable does not exist, the default SSH port 22 200 | is used.") 201 | 202 | export Action_RunFuncOnDevice=("func" "[-h host_address] [-p host_port] function" "h:p:" 1 1 runFuncOnDevice false \ 203 | " Perform on device at . If is 204 | is omitted, the environment variable iOSOpenDevDevice is used. If 205 | is omitted, the environment variable iOSOpenDevPort is used 206 | or, if that variable does not exist, the default SSH port 22 is used. 207 | 208 | Available functions: 209 | respring, reboot") 210 | 211 | export Action_XcodeBuildPhaseLogos=("--xcbp-logos" "" "" 0 0 xcodeBuildPhase_Logos false \ 212 | " DO NOT USE. For use by Xcode as a Build Phase for projects created from 213 | iOSOpenDev templates only.") 214 | 215 | export Action_XcodeBuildPhase=("--xcbp" "" "" 0 0 xcodeBuildPhase false \ 216 | " DO NOT USE. For use by Xcode as a Build Phase for projects created from 217 | iOSOpenDev templates only.") 218 | 219 | export Action_XcodeBuildPhase=("--simject-helper" "" "" 0 0 xcodeBuildPhase_SimjectHelper false \ 220 | " DO NOT USE. For use by Xcode as a Build Phase for projects created from 221 | iOSOpenDev templates only.") 222 | 223 | export Action_XcodeBuildPhaseArm64eLegacy=("--arm64e-legacy-postbuild" "" "" 0 0 xcodeBuildPhase_arm64eLegacyPostbuild false \ 224 | " DO NOT USE. For use by Xcode as a Build Phase for projects created from 225 | iOSOpenDev templates only.") 226 | 227 | export Action_XcodeBuildPhaseArm64ePrepare=("--arm64e-legacy-prebuild" "" "" 0 0 xcodeBuildPhase_Prepare false \ 228 | " DO NOT USE. For use by Xcode as a Build Phase for projects created from 229 | iOSOpenDev templates only.") 230 | 231 | 232 | export Action_SshToDevice=("ssh" "[-h host_address] [-p host_port]" "h:p:" 0 0 sshToDevice false \ 233 | " Secure Shell (SSH) to device at . If is 234 | omitted, the environment variable iOSOpenDevDevice is used. If 235 | is omitted, the environment variable iOSOpenDevPort is used 236 | or, if that variable does not exist, the default SSH port 22 is used.") 237 | 238 | export Action_UpdateIncludeAndLib=("update" "[-h host_address] [-p host_port]" "h:p:" 0 0 updateIncludeAndLib false \ 239 | " Update include and lib directories using device at . 240 | If is omitted, the environment variable 241 | iOSOpenDevDevice is used. If is omitted, the environment 242 | variable iOSOpenDevPort is used or, if that variable does not exist, 243 | the default SSH port 22 is used.") 244 | 245 | export Action_Help=("--help" "" "" 0 0 "" false \ 246 | " Show this help.") 247 | 248 | # === cleanup & panic === # 249 | 250 | function cleanup() # no args 251 | { 252 | local exitCode=$? 253 | set +e 254 | trap - $signals 255 | 256 | removeTempData 257 | 258 | exit $exitCode 259 | } 260 | export signals="0 1 2 3 15" 261 | trap cleanup $signals 262 | 263 | function panic() # args: exitCode, message... 264 | { 265 | local exitCode=$1 266 | set +e 267 | 268 | shift 269 | [[ "$@" == "" ]] || \ 270 | echo "$@" >&2 271 | 272 | exit $exitCode 273 | } 274 | 275 | # === common functions === # 276 | 277 | function determineBashProfileFile() 278 | { 279 | $setCmd 280 | 281 | local f 282 | local filePath 283 | 284 | for f in "${bashProfileFiles[@]}"; do 285 | if [[ -f "$f" ]]; then 286 | if [[ -n `perl -ne 'print $1 if /^(?:export)? *'"iOSOpenDevPath"'=(.*)$/' "$f"` ]]; then 287 | filePath="$f" 288 | break 289 | fi 290 | fi 291 | done 292 | 293 | if [[ $filePath == "" ]]; then 294 | 295 | filePath="$bashProfileFiles" # use first array item 296 | 297 | touch "$filePath" || \ 298 | panic $? "Failed to touch $filePath" 299 | 300 | changeOwn "$userName:$userGroup" "$filePath" 301 | changeMode 0600 "$filePath" 302 | fi 303 | 304 | # return # 305 | echo "$filePath" 306 | } 307 | 308 | function removeTempData() # no args 309 | { 310 | local tempDirs 311 | 312 | if [[ -f "$tempDirsFile" ]]; then 313 | tempDirs=(`cat "$tempDirsFile"`) 314 | 315 | for td in "${tempDirs[@]}"; do 316 | rm -rf "$td" || true # forget abou' it. 317 | done 318 | 319 | rm -rf "`dirname \"$tempDirsFile\"`" || true # forget abou' it. 320 | fi 321 | } 322 | 323 | function requireDir() # args: dirPath [, makeDirIfNotFound] 324 | { 325 | local dirPath="$1" 326 | local makeDirIfNotFound="$2" 327 | 328 | if [[ ! -d "$dirPath" ]]; then 329 | if [[ $makeDirIfNotFound == "true" ]]; then 330 | 331 | mkdir -p "$dirPath" || \ 332 | panic $? "Failed to create directory $dirPath" 333 | 334 | else 335 | panic 1 "Directory $dirPath not found" 336 | fi 337 | fi 338 | } 339 | 340 | function copyFile() # args: sourceFile, targetDirOrFile 341 | { 342 | local sourceFile="$1" 343 | local targetDirOrFile="$2" 344 | 345 | cp -fR "$sourceFile" "$targetDirOrFile" || \ 346 | panic $? "Failed to copy file $sourceFile to $targetDirOrFile" 347 | } 348 | 349 | function changeMode() # args: mode, target 350 | { 351 | local mode="$1" 352 | local target="$2" 353 | 354 | if [[ -e "$target" ]]; then 355 | 356 | chmod $mode "$target" || \ 357 | panic $? "Failed to change mode to $mode on $target" 358 | fi 359 | } 360 | 361 | function changeOwn() # args: ownerAndOrGroup, target 362 | { 363 | local ownerAndOrGroup="$1" 364 | local target="$2" 365 | 366 | if [[ -e "$target" ]]; then 367 | 368 | chown "$ownerAndOrGroup" "$target" || \ 369 | panic $? "Failed to change ownership to $ownerAndOrGroup on $target" 370 | fi 371 | } 372 | 373 | function requireFile() # args: filePath [, touchFileIfNotFound] 374 | { 375 | local filePath="$1" 376 | local touchFileIfNotFound="$2" 377 | 378 | if [[ ! -f "$filePath" ]]; then 379 | if [[ $touchFileIfNotFound == "true" ]]; then 380 | 381 | touch "$filePath" || \ 382 | panic $? "Failed to touch $filePath" 383 | 384 | else 385 | panic 1 "File $filePath not found" 386 | fi 387 | fi 388 | } 389 | 390 | function requireExportedVariable() # args: envVarName[, message] 391 | { 392 | local envVarName="$1" 393 | local message="$2" 394 | local value 395 | 396 | if [[ ${!envVarName} == "" ]]; then 397 | value=`getBashProfileEnvVarValue "$envVarName"` 398 | 399 | [[ $value != "" ]] || \ 400 | panic 1 "Environment variable $envVarName is not set or is empty" 401 | 402 | eval $envVarName='$value' 403 | export $envVarName 404 | fi 405 | } 406 | 407 | function createSymlink() # args: sourcePath, linkPath 408 | { 409 | local sourcePath="$1" 410 | local linkPath="$2" 411 | 412 | ln -fhs "$sourcePath" "$linkPath" || \ 413 | panic $? "Failed to create symbolic link $linkPath -> $sourcePath" 414 | } 415 | 416 | function extractTar() # args: tarPath, outputPath 417 | { 418 | local tarPath="$1" 419 | local outputPath="$2" 420 | 421 | tar -C "$outputPath" -zxf "$tarPath" || \ 422 | panic $? "Failed to extract $tarPath to $outputPath" 423 | } 424 | 425 | function copyFileToDevice() # args: sourceFile, targetDir, hostAddress, hostPort 426 | { 427 | local sourceFile="$1" 428 | local targetDir="$2" 429 | local hostAddress="$3" 430 | local hostPort="$4" 431 | local targetFilePath 432 | 433 | ssh -p$hostPort root@$hostAddress mkdir -p "\"$targetDir\"" || \ 434 | panic $? "Failed to create directory $targetDir on device $hostAddress" 435 | 436 | targetFilePath="$targetDir/`basename \"$sourceFile\"`" || \ 437 | panic $? "Failed to build target file path" 438 | 439 | ssh -p$hostPort root@$hostAddress rm -f "\"$targetFilePath\"" || \ 440 | panic $? "Failed to remove existing file $targetFilePath on device $hostAddress" 441 | 442 | scp -P$hostPort "$sourceFile" root@$hostAddress:"\"$targetFilePath\"" || \ 443 | panic $? "Failed to copy file $sourceFile to device $hostAddress at directory $targetDir" 444 | } 445 | 446 | function getSdkProperty() # args: sdk, propertyName 447 | { 448 | $setCmd 449 | 450 | local sdk="$1" 451 | local propertyName="$2" 452 | 453 | propertyValue=`xcodebuild -version -sdk $sdk $propertyName` || \ 454 | panic $? "Failed to get $sdk SDK property $propertyName" 455 | 456 | # return # 457 | echo "$propertyValue" 458 | } 459 | 460 | function getBashProfileEnvVarValue() # args: envVarName 461 | { 462 | $setCmd 463 | 464 | local envVarName="$1" 465 | local perlValue 466 | local bashProfileFile 467 | 468 | bashProfileFile=`determineBashProfileFile` 469 | 470 | perlValue=`perl -ne 'print $1 if /^(?:export)? *'"$envVarName"'=(.*)$/' "$bashProfileFile"` || \ 471 | panic $? "Failed to perl" 472 | 473 | # return # 474 | echo "$perlValue" 475 | } 476 | 477 | function getTempDir() # no args 478 | { 479 | $setCmd 480 | 481 | local tempDir 482 | 483 | tempDir=`mktemp -d -t $scriptName` || \ 484 | panic $? "Failed to create temporary directory" 485 | 486 | # remember the temp dir path; in cleanup() these are rm'd # 487 | 488 | echo "$tempDir" >> "$tempDirsFile" || \ 489 | panic $? "Failed to echo into temporary file $tempDirsFile" 490 | 491 | # return # 492 | echo "$tempDir" 493 | } 494 | 495 | function downloadFile() # args: sourceUrl, targetPath 496 | { 497 | local sourceUrl="$1" 498 | local targetPath="$2" 499 | local curlPath 500 | 501 | requireDir "${targetPath%/*}" true 502 | 503 | curlPath=`which curl` || \ 504 | panic $? "Failed to get curl path" 505 | 506 | "$curlPath" --silent --insecure --output "$targetPath" "$sourceUrl" || \ 507 | panic $? "Failed to download $sourceUrl to $targetPath" 508 | } 509 | 510 | # === sign (action) === # 511 | 512 | function signCode() # args: executableToSign, identityToSignWith 513 | { 514 | local executableToSign="$1" 515 | local identityToSignWith="$2" 516 | local cmdBin 517 | local cmdArg 518 | local codesignAllocatePath 519 | local entitlements="$CODE_SIGN_ENTITLEMENTS" 520 | 521 | # process arguments # 522 | 523 | requireFile "$executableToSign" false 524 | 525 | if [[ "$identityToSignWith" == "" || "$identityToSignWith" == "-" ]]; then 526 | 527 | # use ldid # 528 | 529 | cmdBin="ldid2" 530 | 531 | if [[ "$entitlements" == "" ]]; then 532 | cmdArg=("-S") 533 | else 534 | cmdArg=("-S${PROJECT_DIR}/${entitlements}") 535 | fi 536 | 537 | else 538 | 539 | # use codesign # 540 | codesignAllocatePath=`xcodebuild -sdk iphoneos -find codesign_allocate` || \ 541 | panic $? "Failed to get codesign_allocate path" 542 | 543 | export CODESIGN_ALLOCATE="$codesignAllocatePath" 544 | 545 | cmdBin=`xcodebuild -sdk iphoneos -find codesign` || \ 546 | panic $? "Failed to get codesign path" 547 | 548 | if [[ "$entitlements" == "" ]]; then 549 | cmdArg=("-fs" "$identityToSignWith") 550 | else 551 | cmdArg=("-fs" "$identityToSignWith" "--entitlements" "${PROJECT_DIR}/${entitlements}") 552 | fi 553 | fi 554 | 555 | echo -n "Signing $executableToSign with `basename \"$cmdBin\"`... " 556 | 557 | "$cmdBin" "${cmdArg[@]}" "$executableToSign" || \ 558 | panic $? "Failed." 559 | 560 | # success # 561 | echo "Done." 562 | } 563 | 564 | 565 | # === build (action) === # 566 | 567 | function readDefaultsValue() # args: plistPath, propertyName 568 | { 569 | $setCmd 570 | 571 | local plistPath="$1" 572 | local propertyName="$2" 573 | local value 574 | 575 | value=`defaults read "${plistPath%.*}" "$propertyName"` || \ 576 | panic $? "Failed to read defaults property $propertyName from $plistPath" 577 | 578 | # return # 579 | echo "$value" 580 | } 581 | 582 | function getVersionFromVersionPList() # args: plistPath 583 | { 584 | $setCmd 585 | 586 | local plistPath="$1" 587 | local version 588 | local major 589 | local minor 590 | local bugFix 591 | local stage 592 | local pkgRev 593 | 594 | major=`readDefaultsValue "$plistPath" "Major"` 595 | minor=`readDefaultsValue "$plistPath" "Minor"` 596 | bugFix=`readDefaultsValue "$plistPath" "BugFix"` 597 | stage=`readDefaultsValue "$plistPath" "Stage"` 598 | pkgRev=`readDefaultsValue "$plistPath" "PackageRevision"` 599 | 600 | version="$major.$minor" 601 | 602 | [[ "$bugFix" == "" ]] || version+=".$bugFix" 603 | [[ "$stage" == "" ]] || version+="$stage" 604 | [[ "$pkgRev" == "" ]] || version+="-$pkgRev" 605 | 606 | # return # 607 | echo "$version" 608 | } 609 | 610 | function setControlFileVersionFieldUsingVersionPList() # args: controlFile, plistPath 611 | { 612 | local controlFile="$1" 613 | local plistPath="$2" 614 | local versionReadFromPList 615 | 616 | requireFile "$controlFile" false 617 | requireFile "$plistPath" false 618 | 619 | # read plist to get version # 620 | 621 | versionReadFromPList=`getVersionFromVersionPList "$plistPath"` 622 | 623 | [[ $versionReadFromPList != "" ]] || \ 624 | panic 1 "Failed to read version from $plistPath" 625 | 626 | # write version to control file # 627 | 628 | echo -n "Setting control file $controlFile Version field to $versionReadFromPList using $plistPath... " 629 | 630 | sed -i "" "s/Version:.*/Version: $versionReadFromPList/g" "$controlFile" || \ 631 | panic $? "Failed." 632 | 633 | # success # 634 | echo "Done." 635 | } 636 | 637 | function getControlFieldValue() # args: controlFile, fieldName [, isRequired] 638 | { 639 | $setCmd 640 | 641 | local controlFile="$1" 642 | local fieldName="$2" 643 | local isRequired="$3" 644 | local perlValue 645 | 646 | perlValue=`perl -ne 'print $1 if /^'"$fieldName"': *(.*) *$/' "$controlFile"` || \ 647 | panic $? "Failed perl command using $controlFile" 648 | 649 | if [[ "$perlValue" == "" ]] && [[ "$isRequired" == "true" ]]; then 650 | panic 1 "Missing control field: $fieldName" 651 | fi 652 | 653 | # return # 654 | echo "$perlValue" 655 | } 656 | 657 | 658 | function getPackageFileNameUsingControlFile() # args: controlFile 659 | { 660 | $setCmd 661 | 662 | local controlFile="$1" 663 | local pkgId 664 | local pkgVer 665 | local pkgArch 666 | 667 | pkgId=`getControlFieldValue "$controlFile" Package true` 668 | pkgVer=`getControlFieldValue "$controlFile" Version true` 669 | pkgArch=`getControlFieldValue "$controlFile" Architecture true` 670 | 671 | # return # 672 | echo "${pkgId}_${pkgVer}_${pkgArch}" 673 | } 674 | 675 | function buildPackage() # args: packageDir, outputDir, versionPList [, useZOption] 676 | { 677 | local packageDir="$1" 678 | local outputDir="$2" 679 | local versionPList="$3" 680 | local useZOption="$4" 681 | local subFileControlTxtToRemove="$packageDir/DEBIAN/control.txt" 682 | local subFilesToRemove=(".DS_Store" "0xdeadfa11") 683 | local packageFileName 684 | local packageName 685 | local zipFileName 686 | 687 | echo "Preparing to build package..." 688 | 689 | # verify arguments # 690 | 691 | requireDir "$packageDir" 692 | 693 | requireDir "$outputDir" true 694 | 695 | [[ "$versionPList" == "" ]] || \ 696 | requireFile "$versionPList" false 697 | 698 | # cleanup # 699 | 700 | [[ ! -f "$subFileControlTxtToRemove" ]] || \ 701 | rm -f "$subFileControlTxtToRemove" || \ 702 | panic $? "Failed to remove file $subFileControlTxtToRemove" 703 | 704 | for f in "${subFilesToRemove[@]}"; do 705 | find "$packageDir" -type f -name "$f" -exec rm -f '{}' \; || \ 706 | panic $? "Failed to remove file $f" 707 | done 708 | 709 | xattr -crs "$packageDir" || true # forget abou' it (does not work on 10.6) 710 | 711 | changeMode 0644 "$packageDir/DEBIAN/control" 712 | changeMode 0755 "$packageDir/DEBIAN/preinst" 713 | changeMode 0755 "$packageDir/DEBIAN/postinst" 714 | changeMode 0755 "$packageDir/DEBIAN/prerm" 715 | changeMode 0755 "$packageDir/DEBIAN/postrm" 716 | 717 | # set control file version field # 718 | 719 | [[ "$versionPList" == "" ]] || \ 720 | setControlFileVersionFieldUsingVersionPList "$packageDir/DEBIAN/control" "$versionPList" 721 | 722 | # determine package name # 723 | 724 | packageName=`getPackageFileNameUsingControlFile "$packageDir/DEBIAN/control"` 725 | 726 | # create package # 727 | 728 | createDebianPackage "$packageDir" "$packageName" "$outputDir" 729 | 730 | # create zip # 731 | 732 | if [[ $useZOption == "true" ]]; then 733 | 734 | zipFileName="$outputDir/${packageName}.zip" 735 | 736 | echo -n "Creating zip $zipFileName... " 737 | 738 | rm -f "$zipFileName" || \ 739 | panic $? "Failed to remove $zipFileName" 740 | 741 | pushd "$packageDir" 1> /dev/null 742 | 743 | zip -qrX "$zipFileName" * || \ 744 | panic $? "Failed." 745 | 746 | popd 1> /dev/null 747 | 748 | echo "Done." 749 | fi 750 | } 751 | 752 | function createDebianPackage() # args: sourceDir, packageName [, outputDir] 753 | { 754 | $setCmd 755 | 756 | local sourceDir="$1" 757 | local packageName="$2" 758 | local outputDir="$3" 759 | 760 | local packageFile="${outputDir:-.}/$packageName.deb" 761 | 762 | echo -n "Building package $packageFileName... " 763 | 764 | local tempDir="`getTempDir`" 765 | 766 | createTarForDebianPackage "$sourceDir/DEBIAN" "$tempDir" "control" "-n" 767 | createTarForDebianPackage "$sourceDir" "$tempDir" "data" "--exclude" "DEBIAN/*" "--exclude" "DEBIAN" 768 | 769 | echo "2.0" > "$tempDir/debian-binary" || \ 770 | panic $? "Failed to create debian-binary file" 771 | 772 | ar -rc "$packageFile" "$tempDir/debian-binary" "$tempDir/control.tar.gz" "$tempDir/data.tar.gz" || \ 773 | panic $? "Failed to create Debian archive" 774 | 775 | echo "Done." 776 | } 777 | 778 | function createTarForDebianPackage() # args: sourceDir, outputDir, tarName [, options] 779 | { 780 | $setCmd 781 | 782 | local sourceDir="$1" 783 | local outputDir="$2" 784 | local tarName="$3" 785 | shift 3 786 | 787 | pushd "$sourceDir" 1> /dev/null 788 | 789 | tar -cLpz --disable-copyfile --exclude ".*" "$@" -f "$outputDir/$tarName.tar.gz" * || \ 790 | panic $? "Failed to create $tarName archive" 791 | 792 | popd 1> /dev/null 793 | } 794 | 795 | 796 | # === install, remove, purge (actions) === # 797 | 798 | function managePackageOnDevice() # args: manageAction, packageFileOrName, hostAddress, hostPort 799 | { 800 | local manageAction="$1" 801 | local packageFileOrName="$2" 802 | local hostAddress="$3" 803 | local hostPort="$4" 804 | local doingWhat 805 | local direction 806 | local didWhat 807 | local cmdBin="dpkg" 808 | local cmdArg 809 | local devicePackagesDir 810 | 811 | if [[ "$manageAction" == "install" ]]; then 812 | doingWhat="Installing" 813 | direction="on" 814 | didWhat="installed" 815 | cmdArg="--install" 816 | elif [[ "$manageAction" == "remove" ]]; then 817 | doingWhat="Removing" 818 | direction="from" 819 | didWhat="removed" 820 | cmdArg="--remove" 821 | elif [[ "$manageAction" == "purge" ]]; then 822 | doingWhat="Purging" 823 | direction="from" 824 | didWhat="purged" 825 | cmdArg="--purge" 826 | else 827 | panic 1 "Invalid manage action: $manageAction" 828 | fi 829 | 830 | if [[ $hostAddress == "" ]]; then 831 | 832 | requireExportedVariable "iOSOpenDevDevice" 833 | 834 | hostAddress="$iOSOpenDevDevice" 835 | 836 | [[ $hostAddress != "" ]] || \ 837 | panic 1 "Host address not provided and environment variable iOSOpenDevDevice is not set or is empty" 838 | fi 839 | 840 | if [[ $hostPort == "" ]]; then 841 | 842 | hostPort="$iOSOpenDevPort" 843 | 844 | [[ $hostPort != "" ]] || hostPort="22" 845 | 846 | fi 847 | 848 | # if installing, copy package to device # 849 | 850 | if [[ $manageAction == "install" ]]; then 851 | 852 | requireFile "$packageFileOrName" false 853 | 854 | devicePackagesDir="/var/root/iOSOpenDevPackages" 855 | 856 | copyFileToDevice "$packageFileOrName" "$devicePackagesDir" "$hostAddress" "$hostPort" 857 | 858 | packageFileOrName="$devicePackagesDir/`basename \"$packageFileOrName\"`" 859 | fi 860 | 861 | # install, remove or purge package # 862 | 863 | echo "$doingWhat package `basename \"$packageFileOrName\"` $direction device $hostAddress... " 864 | 865 | ssh -p$hostPort root@$hostAddress "$cmdBin" $cmdArg "$packageFileOrName" || \ 866 | panic $? "Failed." 867 | 868 | # success # 869 | echo "Done." 870 | } 871 | 872 | # === rmheaders (action) === # 873 | 874 | function removeCopiedHeaders() # args: removeWhat, headerFileTag 875 | { 876 | local removeWhat="$1" 877 | local headerFileTag="$2" 878 | local fileNamePattern="*${headerFileTag}.h" 879 | local iosSdkPath 880 | local basePath 881 | local foundFiles 882 | local f 883 | 884 | [[ "$removeWhat" != "public" || "$headerFileTag" != "" ]] || \ 885 | panic 1 "Invalid option: cannot target public frameworks with an empty header tag" 886 | 887 | iosSdkPath=`getSdkProperty iphoneos Path` 888 | requireDir "$iosSdkPath" 889 | 890 | if [[ $removeWhat == "private" ]]; then 891 | basePath="$iosSdkPath/System/Library/PrivateFrameworks" 892 | elif [[ $removeWhat == "public" ]]; then 893 | basePath="$iosSdkPath/System/Library/Frameworks" 894 | else 895 | panic $? "Invalid option: $removeWhat" 896 | fi 897 | requireDir "$basePath" 898 | 899 | # find and remove header files # 900 | 901 | foundFiles=(`find "$basePath" -type f -name "$fileNamePattern"`) 902 | 903 | if [[ "${#foundFiles[@]}" != 0 ]]; then 904 | 905 | echo "Removing ${#foundFiles[@]} header files matching '$fileNamePattern' in iOS SDK $removeWhat frameworks..." 906 | 907 | for f in "${foundFiles[@]}"; do 908 | rm -f "$f" || \ 909 | panic $? "Failed to remove file $f" 910 | done 911 | 912 | else 913 | echo "No header files found matching '$fileNamePattern' in iOS SDK $removeWhat frameworks" 914 | fi 915 | } 916 | 917 | # === cp2sdk (action) === # 918 | 919 | function copyHeadersToSDK() # args: copyWhat, sourceDirectory [, headerFileTag] 920 | { 921 | local copyWhat="$1" 922 | local sourceDirectory="$2" 923 | local headerFileTag="$3" 924 | local iosSdkPath 925 | local targetBasePath 926 | local dontUseHeadersDir=false 927 | local copyingToWhere 928 | 929 | requireDir "$sourceDirectory" 930 | 931 | iosSdkPath=`getSdkProperty iphoneos Path` 932 | requireDir "$iosSdkPath" 933 | 934 | if [[ $copyWhat == "private" ]]; then 935 | targetBasePath="$iosSdkPath/System/Library/PrivateFrameworks" 936 | copyingToWhere="iOS SDK $copyWhat frameworks" 937 | 938 | elif [[ $copyWhat == "public" ]]; then 939 | targetBasePath="$iosSdkPath/System/Library/Frameworks" 940 | copyingToWhere="iOS SDK $copyWhat frameworks" 941 | [[ $headerFileTag != "" ]] || \ 942 | headerFileTag="_Dumped" 943 | 944 | elif [[ $copyWhat == "springboard" ]]; then 945 | targetBasePath="$iOSOpenDevPath/include/SpringBoard" 946 | copyingToWhere="$targetBasePath" 947 | dontUseHeadersDir=true 948 | requireDir "$targetBasePath" true # <-- for springboard only (since headers don't go in SDK) 949 | 950 | else 951 | panic $? "Invalid option: $copyWhat" 952 | fi 953 | 954 | requireDir "$targetBasePath" 955 | 956 | echo "Copying header files from $sourceDirectory to $copyingToWhere..." 957 | 958 | processDirToCopyHeadersToSDK "$sourceDirectory" "$sourceDirectory" "$targetBasePath" "$headerFileTag" "$dontUseHeadersDir" 959 | } 960 | 961 | function processDirToCopyHeadersToSDK() # args: pathToTrimOffFromTargetHeaderFilePaths, sourceDirectory, targetBasePath, headerFileTag, dontUseHeadersDir 962 | { 963 | local pathToTrimOffFromTargetHeaderFilePaths="$1" 964 | local sourceDirectory="$2" 965 | local targetBasePath="$3" 966 | local headerFileTag="$4" 967 | local dontUseHeadersDir="$5" 968 | 969 | local foundDirs 970 | local d 971 | local foundFiles 972 | local f 973 | 974 | local fileName 975 | local sourceDirectoryWithNoHeaders 976 | local targetDir 977 | local targetfile 978 | 979 | # files # 980 | 981 | foundFiles=(`find "$sourceDirectory" -type f -maxdepth 1 -mindepth 1 -name "*.h"`) 982 | 983 | for f in "${foundFiles[@]}"; do 984 | sourceDirectoryWithNoHeaders="${sourceDirectory%/Headers}" 985 | targetDir="$targetBasePath${sourceDirectoryWithNoHeaders/#$pathToTrimOffFromTargetHeaderFilePaths}" 986 | 987 | [[ $dontUseHeadersDir == "true" ]] || \ 988 | targetDir+="/Headers" 989 | 990 | fileName="${f/#$sourceDirectory}" 991 | targetfile="${targetDir}${fileName%.h}${headerFileTag}.h" 992 | 993 | requireDir "$targetDir" true 994 | changeMode 0777 "$targetDir" 995 | 996 | copyFile "$f" "$targetfile" 997 | changeMode 0666 "$targetfile" 998 | done 999 | 1000 | # dirs # 1001 | 1002 | foundDirs=(`find -E "$sourceDirectory" -type d -maxdepth 1 -mindepth 1 -iregex "^.*/(Frameworks|.+\.framework|Headers)$"`) 1003 | 1004 | for d in "${foundDirs[@]}"; do 1005 | processDirToCopyHeadersToSDK "$pathToTrimOffFromTargetHeaderFilePaths" "$d" "$targetBasePath" "$headerFileTag" $dontUseHeadersDir 1006 | done 1007 | } 1008 | 1009 | # === dump === # 1010 | 1011 | function dumpSDKHeaders() # args: dumpWhat, outputDirectory [, useZOption] [, useIOption] 1012 | { 1013 | local dumpWhat="$1" 1014 | local outputDirectory="$2" 1015 | local useZOption="$3" 1016 | local useIOption="$4" 1017 | local iosSdkPath 1018 | local iosSdkVersion 1019 | local sourceBasePath 1020 | local classDumpBin 1021 | local classDumpArgs 1022 | local dontUseHeadersDir=false 1023 | local dumpingWhat 1024 | 1025 | iosSdkPath=`getSdkProperty iphoneos Path` 1026 | requireDir "$iosSdkPath" 1027 | 1028 | iosSdkVersion=`getSdkProperty iphoneos SDKVersion` 1029 | 1030 | if [[ $dumpWhat == "private" ]]; then 1031 | sourceBasePath="$iosSdkPath/System/Library/PrivateFrameworks" 1032 | dumpingWhat="iOS SDK $dumpWhat frameworks" 1033 | elif [[ $dumpWhat == "public" ]]; then 1034 | sourceBasePath="$iosSdkPath/System/Library/Frameworks" 1035 | dumpingWhat="iOS SDK $dumpWhat frameworks" 1036 | elif [[ $dumpWhat == "springboard" ]]; then 1037 | sourceBasePath="$iosSdkPath/System/Library/CoreServices/SpringBoard.app" 1038 | dumpingWhat="iOS SpringBoard Core Service" 1039 | dontUseHeadersDir="true" 1040 | else 1041 | panic $? "Invalid option: $dumpWhat" 1042 | fi 1043 | 1044 | if [[ $useZOption == "true" ]]; then 1045 | classDumpBin="class-dump" 1046 | classDumpArgs="--sdk-ios $iosSdkVersion" 1047 | else 1048 | classDumpBin="class-dump-z" 1049 | classDumpArgs="-pabkkAR -X NS,CF,CG -y $iosSdkPath" 1050 | fi 1051 | 1052 | classDumpBin="`which $classDumpBin`" || \ 1053 | panic $? "Failed to get $classDumpBin path" 1054 | 1055 | echo "Dumping header files of $dumpingWhat to $outputDirectory..." 1056 | 1057 | processDirToDumpSDKHeaders "$sourceBasePath" "$sourceBasePath" "$outputDirectory" $dontUseHeadersDir 1058 | 1059 | if [[ $useIOption != "true" ]]; then 1060 | echo "Fixing import statements..." 1061 | cleanUpDumpedHeaderFiles "$outputDirectory" "$dumpWhat" 1062 | fi 1063 | } 1064 | 1065 | function processDirToDumpSDKHeaders() # args: pathToTrimOffFromTargetHeaderFilePaths, sourceDirectory, outputDirectory, dontUseHeadersDir 1066 | { 1067 | local pathToTrimOffFromTargetHeaderFilePaths="$1" 1068 | local sourceDirectory="$2" 1069 | local outputDirectory="$3" 1070 | local dontUseHeadersDir="$4" 1071 | local foundDirs 1072 | local d 1073 | local foundFiles 1074 | local f 1075 | local targetPath 1076 | 1077 | # files # 1078 | 1079 | foundFiles=(`find -E "$sourceDirectory" -type f -maxdepth 1 -mindepth 1 -iregex "^.*/([^.]+|.+\.dylib|.+\.o)?$" -not -name "PkgInfo"`) 1080 | 1081 | for f in "${foundFiles[@]}"; do 1082 | targetPath="$outputDirectory${sourceDirectory/#$pathToTrimOffFromTargetHeaderFilePaths}" 1083 | 1084 | [[ $dontUseHeadersDir == "true" ]] || \ 1085 | targetPath+="/Headers" 1086 | 1087 | requireDir "$targetPath" true 1088 | "$classDumpBin" $classDumpArgs -H -o "$targetPath" "$f" 2>/dev/null || true # forget abou' it. 1089 | done 1090 | 1091 | # dirs # 1092 | 1093 | foundDirs=(`find "$sourceDirectory" -type d -maxdepth 1 -mindepth 1 -not -name "Headers" -not -name "_CodeSignature"`) 1094 | 1095 | for d in "${foundDirs[@]}"; do 1096 | processDirToDumpSDKHeaders "$pathToTrimOffFromTargetHeaderFilePaths" "$d" "$outputDirectory" $dontUseHeadersDir 1097 | done 1098 | } 1099 | 1100 | function cleanUpDumpedHeaderFiles() # args: baseDir [, forWhat] 1101 | { 1102 | local baseDir="$1" 1103 | local forWhat="$2" 1104 | local removals=("NSObject\\.h" "NSString\\.h") 1105 | local r 1106 | local files 1107 | local f 1108 | local fileDir 1109 | local fwDirBaseName 1110 | local fwName 1111 | local imports 1112 | local i 1113 | local fileName 1114 | local origFileContents 1115 | local newFileContents 1116 | local fName 1117 | 1118 | # springboard only: move XXUnknownSuperclass.h to SBUnknownSuperclass.h 1119 | 1120 | if [[ $forWhat == "springboard" && -f "$baseDir/XXUnknownSuperclass.h" ]]; then 1121 | mv -f "$baseDir/XXUnknownSuperclass.h" "$baseDir/SBUnknownSuperclass.h" || \ 1122 | panic $? "Failed to move $baseDir/XXUnknownSuperclass.h to $baseDir/SBUnknownSuperclass.h" 1123 | fi 1124 | 1125 | # find files 1126 | 1127 | files=(`find "$baseDir" -name '*.h'`) 1128 | 1129 | # remove imports (in $removals) 1130 | 1131 | for r in "${removals[@]}"; do 1132 | for f in "${files[@]}"; do 1133 | perl -i -pe 's/^#import "'"$r"'"$//g' "$f" || \ 1134 | panic $? "Failed to perl $f" 1135 | done 1136 | done 1137 | 1138 | # iterate through all files 1139 | 1140 | for f in "${files[@]}"; do 1141 | fName="${f##*/}" 1142 | fileDir="${f%/*}" 1143 | fwDirBaseName="${f%.framework/*}" 1144 | fwName="${fwDirBaseName##*/}" 1145 | 1146 | origFileContents=`cat "$f"` || \ 1147 | panic $? "Failed to cat $f" 1148 | newFileContents="$origFileContents" 1149 | 1150 | if [[ $forWhat != "springboard" ]]; then 1151 | # change "headerfile.h" imports to imports (if headerfile.h exists in framework's directory) 1152 | 1153 | set +e 1154 | imports=(`perl -ne 'print if /#import[\s]+"[^\/]+"/' "$f"`) 1155 | set -e 1156 | 1157 | for i in "${imports[@]}"; do 1158 | if [[ "$i" == \"*\" ]]; then 1159 | fileName=${i//\"/} 1160 | if [[ -f "$fileDir/$fileName" ]]; then 1161 | newFileContents=`echo "$newFileContents" | sed "s/^#import *\"$fileName\"/#import \\<$fwName\\/$fileName\\>/g"` || \ 1162 | panic $? "Failed to echo into sed" 1163 | fi 1164 | fi 1165 | done 1166 | fi 1167 | 1168 | # address XXUnknownSuperclass 1169 | 1170 | if [[ -f "$fileDir/XXUnknownSuperclass.h" ]] || [[ $forWhat == "springboard" && -f "$fileDir/SBUnknownSuperclass.h" ]]; then 1171 | 1172 | # XXUnknownSuperclass.h found ... 1173 | 1174 | if [[ $forWhat != "springboard" ]]; then 1175 | # change to 1176 | newFileContents=`echo "$newFileContents" | sed "s/^#import *\\\( *\\/\\/ *Unknown library\)/#import \\<${fwName}\\/XXUnknownSuperclass\\.h\\>/g"` || \ 1177 | panic $? "Failed to echo into sed" 1178 | 1179 | else 1180 | # change to "SBUnknownSuperclass.h" 1181 | newFileContents=`echo "$newFileContents" | sed "s/^#import *\\\( *\\/\\/ *Unknown library\)/#import \\"SBUnknownSuperclass\\.h\\"/g"` || \ 1182 | panic $? "Failed to echo into sed" 1183 | 1184 | # change XXUnknownSuperclass to SBUnknownSuperclass 1185 | newFileContents=`echo "$newFileContents" | sed "s/XXUnknownSuperclass/SBUnknownSuperclass/g"` || \ 1186 | panic $? "Failed to echo into sed" 1187 | fi 1188 | else 1189 | # XXUnknownSuperclass.h not found ... 1190 | 1191 | # remove import of 1192 | newFileContents=`echo "$newFileContents" | sed "s/^#import *\\\( *\\/\\/ *Unknown library\)//g"` || \ 1193 | panic $? "Failed to echo into sed" 1194 | 1195 | # replace XXUnknownSuperclass with NSObject 1196 | newFileContents=`echo "$newFileContents" | sed "s/ *: *XXUnknownSuperclass */ : NSObject /g"` || \ 1197 | panic $? "Failed to echo into sed" 1198 | fi 1199 | 1200 | # TODO: insert (XX|SB)UnknownSuperclass interface 1201 | #if [[ $fName == "XXUnknownSuperclass.h" ]]; then 1202 | # "@interface XXUnknownSuperclass : NSObject" 1203 | # "@end" 1204 | #elif [[ $forWhat == "springboard" && $fName == "SBUnknownSuperclass.h" ]]; then 1205 | # "@interface SBUnknownSuperclass : NSObject" 1206 | # "@end" 1207 | #fi 1208 | 1209 | # rewrite file (if changed) 1210 | 1211 | [[ $origFileContents == "$newFileContents" ]] || \ 1212 | echo "$newFileContents" > "$f" || \ 1213 | panic $? "Failed to echo into $f" 1214 | done 1215 | } 1216 | 1217 | # === dump2sdk (action) === # 1218 | 1219 | function dumpAndCopyHeaders() # args: copyWhat [, headerFileTag] [, useZOption] [, useIOption] 1220 | { 1221 | local copyWhat="$1" 1222 | local headerFileTag="$2" 1223 | local useZOption="$3" 1224 | local useIOption="$4" 1225 | local tmpDir 1226 | 1227 | tmpDir=`getTempDir` 1228 | 1229 | dumpSDKHeaders "$copyWhat" "$tmpDir" "$useZOption" "$useIOption" 1230 | 1231 | copyHeadersToSDK "$copyWhat" "$tmpDir" "$headerFileTag" 1232 | } 1233 | 1234 | # === sshkey (action) === # 1235 | 1236 | function addSshKeyToDevice() # args: [hostAddress] [, useROption] [, hostPort] 1237 | { 1238 | local hostAddress="$1" 1239 | local useROption="$2" 1240 | local hostPort="$3" 1241 | local homeDir=`eval echo ~$USER` 1242 | local privateKeyPath="$homeDir/.ssh/id_rsa" 1243 | local publicKeyPath="$homeDir/.ssh/id_rsa.pub" 1244 | local authorizedKeysPath="/var/root/.ssh/authorized_keys" 1245 | local publicKey 1246 | local sshKeygenBin 1247 | local existingAuthorizedKeys 1248 | local grepExit 1249 | 1250 | if [[ "$useROption" == "true" ]]; then 1251 | local argsWithoutROption=(${originalArguments[@]/-r/}) 1252 | requireSudo "${argsWithoutROption[@]}" 1253 | fi 1254 | 1255 | if [[ $hostAddress == "" ]]; then 1256 | 1257 | requireExportedVariable "iOSOpenDevDevice" 1258 | hostAddress="$iOSOpenDevDevice" 1259 | 1260 | [[ $hostAddress != "" ]] || \ 1261 | panic 1 "Host address not provided and environment variable iOSOpenDevDevice is not set or is empty" 1262 | fi 1263 | 1264 | if [[ $hostPort == "" ]]; then 1265 | 1266 | hostPort="$iOSOpenDevPort" 1267 | 1268 | [[ $hostPort != "" ]] || \ 1269 | hostPort=22 1270 | fi 1271 | 1272 | sshKeygenBin=`which ssh-keygen` || \ 1273 | panic $? "Failed to get ssh-keygen path" 1274 | 1275 | if [[ ! -f "$publicKeyPath" ]]; then 1276 | echo "User's SSH authentication key does not exist, generating..." 1277 | "$sshKeygenBin" -t rsa -f "$privateKeyPath" || \ 1278 | panic $? "Failed to generate SSH authentication key" 1279 | fi 1280 | 1281 | requireFile "$publicKeyPath" false 1282 | 1283 | publicKey=`cat "$publicKeyPath"` || \ 1284 | panic $? "Failed to cat $publicKeyPath" 1285 | 1286 | echo "Reading existing authorized keys from device $iOSOpenDevDevice..." 1287 | 1288 | existingAuthorizedKeys=`ssh -p$hostPort -T root@$hostAddress << EOF 1289 | if [[ ! -d "${authorizedKeysPath%/*}" ]]; then 1290 | mkdir "${authorizedKeysPath%/*}" 1291 | chmod 700 "${authorizedKeysPath%/*}" 1292 | fi 1293 | if [[ ! -f "$authorizedKeysPath" ]]; then 1294 | touch "$authorizedKeysPath" 1295 | chmod 600 "$authorizedKeysPath" 1296 | fi 1297 | cat "$authorizedKeysPath" 1298 | EOF 1299 | ` || panic $? "Failed to read $authorizedKeysPath on device $hostAddress" 1300 | 1301 | set +e 1302 | echo "$existingAuthorizedKeys" | grep -q "$publicKey" || grepExit=$? 1303 | set -e 1304 | 1305 | if [[ $grepExit == 2 ]]; then 1306 | panic 2 "Failed to pipe echo into grep" 1307 | elif [[ $grepExit == 1 ]]; then 1308 | echo "Writing SSH authentication public key of local account $USER to device..." 1309 | ssh -p$hostPort root@$hostAddress echo "$publicKey" \>\> "$authorizedKeysPath" || \ 1310 | panic $? "Failed to append public key to $authorizedKeysPath on device $hostAddress" 1311 | 1312 | echo "Password-less SSH connections can now be performed by local account 1313 | $USER to the root account on device $hostAddress." 1314 | elif [[ $grepExit == "" || $grepExit == 0 ]]; then 1315 | echo "Public key is already authorized." 1316 | fi 1317 | } 1318 | 1319 | # === dumpall2sdk (Action) === # 1320 | 1321 | function dumpAllHeaders() # args: [useZOption] [, useIOption] 1322 | { 1323 | local useZOption="$1" 1324 | local useIOption="$2" 1325 | 1326 | dumpAndCopyHeaders "public" "" "$useZOption" "$useIOption" 1327 | dumpAndCopyHeaders "private" "" "$useZOption" "$useIOption" 1328 | dumpAndCopyHeaders "springboard" "" "$useZOption" "$useIOption" 1329 | } 1330 | 1331 | # === run (Action) === # 1332 | 1333 | function runCmdOnDevice() # args: $hostAddress, [, hostPort] ... 1334 | { 1335 | local hostAddress="$1" 1336 | local hostPort="$2" 1337 | shift 2 1338 | 1339 | if [[ $hostAddress == "" ]]; then 1340 | 1341 | requireExportedVariable "iOSOpenDevDevice" 1342 | 1343 | hostAddress="$iOSOpenDevDevice" 1344 | 1345 | [[ $hostAddress != "" ]] || \ 1346 | panic 1 "Host address not provided and environment variable iOSOpenDevDevice is not set or is empty" 1347 | fi 1348 | 1349 | if [[ $hostPort == "" ]]; then 1350 | 1351 | hostPort="$iOSOpenDevPort" 1352 | 1353 | [[ $hostPort != "" ]] || \ 1354 | hostPort=22 1355 | 1356 | fi 1357 | 1358 | ssh -p$hostPort root@$hostAddress "$@" || \ 1359 | panic $? "Failed to run $@ on device $hostAddress" 1360 | } 1361 | 1362 | # === ssh (Action) === # 1363 | 1364 | function sshToDevice() # args: $hostAddress, $hostPort 1365 | { 1366 | local hostAddress="$1" 1367 | local hostPort="$2" 1368 | 1369 | if [[ $hostAddress == "" ]]; then 1370 | 1371 | requireExportedVariable "iOSOpenDevDevice" 1372 | 1373 | hostAddress="$iOSOpenDevDevice" 1374 | 1375 | [[ $hostAddress != "" ]] || \ 1376 | panic 1 "Host address not provided and environment variable iOSOpenDevDevice is not set or is empty" 1377 | fi 1378 | 1379 | if [[ $hostPort == "" ]]; then 1380 | 1381 | hostPort="$iOSOpenDevPort" 1382 | 1383 | [[ $hostPort != "" ]] || \ 1384 | hostPort=22 1385 | 1386 | fi 1387 | 1388 | ssh -p$hostPort root@$hostAddress || \ 1389 | panic $? "Failed to SSH to device $hostAddress" 1390 | } 1391 | 1392 | # === update (Action) === # 1393 | 1394 | function updateIncludeAndLib() # args: $hostAddress, $hostPort 1395 | { 1396 | local hostAddress="$1" 1397 | local hostPort="$2" 1398 | 1399 | if [[ $hostAddress == "" ]]; then 1400 | 1401 | requireExportedVariable "iOSOpenDevDevice" 1402 | 1403 | hostAddress="$iOSOpenDevDevice" 1404 | 1405 | [[ $hostAddress != "" ]] || \ 1406 | panic 1 "Host address not provided and environment variable iOSOpenDevDevice is not set or is empty" 1407 | fi 1408 | 1409 | if [[ $hostPort == "" ]]; then 1410 | 1411 | hostPort="$iOSOpenDevPort" 1412 | 1413 | [[ $hostPort != "" ]] || \ 1414 | hostPort=22 1415 | 1416 | fi 1417 | 1418 | # include 1419 | 1420 | echo "Updating include files..." 1421 | 1422 | copyFromDevice $hostAddress "/usr/include/ActionMenu/ActionMenu.h" "$iOSOpenDevPath/include/ActionMenu" "$hostPort" 1423 | copyFromDevice $hostAddress "/usr/include/SiriObjects.h" "$iOSOpenDevPath/include/AssistantExtensions" "$hostPort" 1424 | downloadFile "https://raw.github.com/rpetrich/CaptainHook/master/CaptainHook.h" "$iOSOpenDevPath/include/CaptainHook/CaptainHook.h" 1425 | copyFromDevice $hostAddress "/usr/include/libactivator/libactivator.h" "$iOSOpenDevPath/include/libactivator" "$hostPort" 1426 | copyFromDevice $hostAddress "/usr/include/substrate.h" "$iOSOpenDevPath/include" "$hostPort" 1427 | 1428 | # lib 1429 | 1430 | echo "Updating lib files..." 1431 | 1432 | copyFromDevice $hostAddress "/usr/lib/libactionmenu.dylib" "$iOSOpenDevPath/lib" "$hostPort" 1433 | copyFromDevice $hostAddress "/usr/lib/libactivator.dylib" "$iOSOpenDevPath/lib" "$hostPort" 1434 | copyFromDevice $hostAddress "/usr/lib/libsubstrate.dylib" "$iOSOpenDevPath/lib" "$hostPort" 1435 | } 1436 | 1437 | function copyFromDevice() # args: hostAddress, sourceFile, targetDir, hostPort 1438 | { 1439 | local hostAddress="$1" 1440 | local sourceFile="$2" 1441 | local targetDir="$3" 1442 | local hostPort="$4" 1443 | 1444 | requireDir "$targetDir" true 1445 | 1446 | scp -P$hostPort -q root@$hostAddress:"\"$sourceFile\"" "$targetDir" || \ 1447 | panic $? "Failed to copy file $sourceFile from device $hostAddress to directory $targetDir" 1448 | } 1449 | 1450 | # === func (Action) === # 1451 | 1452 | function runFuncOnDevice() # args: function, hostAddress, hostPort 1453 | { 1454 | local func="$1" 1455 | local hostAddress="$2" 1456 | local hostPort="$3" 1457 | local cmd 1458 | 1459 | if [[ $hostAddress == "" ]]; then 1460 | 1461 | requireExportedVariable "iOSOpenDevDevice" 1462 | 1463 | hostAddress="$iOSOpenDevDevice" 1464 | 1465 | [[ $hostAddress != "" ]] || \ 1466 | panic 1 "Host address not provided and environment variable iOSOpenDevDevice is not set or is empty" 1467 | fi 1468 | 1469 | if [[ $hostPort == "" ]]; then 1470 | 1471 | hostPort="$iOSOpenDevPort" 1472 | 1473 | [[ $hostPort != "" ]] || \ 1474 | hostPort=22 1475 | 1476 | fi 1477 | 1478 | case "$func" in 1479 | reboot) 1480 | cmd="reboot" 1481 | ;; 1482 | respring) 1483 | cmd="killall SpringBoard" 1484 | ;; 1485 | *) 1486 | panic $? "Invalid function: $func" 1487 | ;; 1488 | esac 1489 | 1490 | ssh -p$hostPort root@$hostAddress $cmd || \ 1491 | panic $? "Failed to perform function $func on device $hostAddress" 1492 | } 1493 | 1494 | # === sudo === # 1495 | 1496 | function requireSudo() # args: ... 1497 | { 1498 | if [[ $EUID != 0 ]]; then 1499 | 1500 | removeTempData 1501 | 1502 | exec sudo "$0" "$@" || \ 1503 | panic $? "Failed to re-execute as root" 1504 | fi 1505 | } 1506 | 1507 | # === xcbp-logos === # 1508 | 1509 | function doesFileContain() # args: filePath, pattern 1510 | { 1511 | $setCmd 1512 | 1513 | local filePath="$1" 1514 | local pattern="$2" 1515 | local perlValue 1516 | local funcReturn 1517 | 1518 | perlValue=`perl -ne 'if (/'"$pattern"'/) { print "true"; exit; }' "$filePath"` || \ 1519 | panic $? "Failed to perl" 1520 | 1521 | if [[ $perlValue == "true" ]]; then 1522 | funcReturn="true" 1523 | else 1524 | funcReturn="false" 1525 | fi 1526 | 1527 | # return # 1528 | echo $funcReturn 1529 | } 1530 | 1531 | function xcodeBuildPhase_SimjectHelper() # no args 1532 | { 1533 | if [ "$SIMJECT" = "YES" ]; then 1534 | 1535 | echo "Automating simject..." 1536 | cp "$TARGET_BUILD_DIR/$EXECUTABLE_PATH" /opt/simject 1537 | for dylib in /opt/simject/*.dylib; do ldid -S "$dylib"; done 1538 | resim 1539 | 1540 | fi 1541 | } 1542 | 1543 | function xcodeBuildPhase_arm64eLegacyPostbuild() # no args 1544 | { 1545 | [[ "$ACTION" == "build" ]] || \ 1546 | panic 1 "For Xcode Build Phase use only" 1547 | 1548 | if [ "${SKIP_LEGACY}" = "1" ];then 1549 | exit 0; 1550 | fi 1551 | 1552 | 1553 | if [ "${CONFIGURATION}" != "Release" ];then 1554 | exit 0; 1555 | fi 1556 | 1557 | export SKIP_LEGACY=1 1558 | 1559 | FINAL_PRODUCT="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" 1560 | 1561 | xcodebuild -project "${PROJECT_FILE_PATH}" \ 1562 | -target "${TARGETNAME}" \ 1563 | -toolchain "com.applex.dt.toolchain.Xcode.arm64e.legacy" \ 1564 | VALID_ARCHS=arm64e \ 1565 | SYMROOT="${SYMROOT}/arm64e-legacy" \ 1566 | CONFIGURATION="${CONFIGURATION}" 1567 | 1568 | echo "Merging ${SYMROOT}/arm64e-legacy/${CONFIGURATION}-${PLATFORM_NAME}/${EXECUTABLE_PATH} and ${FINAL_PRODUCT}" 1569 | "${iOSOpenDevPath}/bin/lipo" -create "${SYMROOT}/arm64e-legacy/${CONFIGURATION}-${PLATFORM_NAME}/${EXECUTABLE_PATH}" $FINAL_PRODUCT -output $FINAL_PRODUCT 1570 | } 1571 | 1572 | function xcodeBuildPhase_Prepare() 1573 | { 1574 | [[ "$ACTION" == "build" ]] || \ 1575 | panic 1 "For Xcode Build Phase use only" 1576 | 1577 | if [ "${SKIP_LEGACY}" = "1" ]; then 1578 | return 1579 | fi 1580 | 1581 | if [ "${CONFIGURATION}" = "Release" ]; then 1582 | echo "Cleaned built product" 1583 | rm -f "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" 1584 | fi 1585 | } 1586 | 1587 | function xcodeBuildPhase_Logos() # no args 1588 | { 1589 | [[ "$ACTION" == "build" ]] || \ 1590 | panic 1 "For Xcode Build Phase use only" 1591 | 1592 | echo "Preparing to run Xcode Build Phase for Logos Processor..." 1593 | 1594 | # process environment variables 1595 | 1596 | local pbxProjectFilePath="$PROJECT_FILE_PATH/project.pbxproj" 1597 | local logosProcessor 1598 | local projectFileModified=false 1599 | local projectContainsXmFiles 1600 | local projectContainsXFiles 1601 | local lastKnownXmFileTypeNotObjCpp 1602 | local lastKnownXFileTypeNotObjC 1603 | local xmFileLangSpecNotObjCpp 1604 | local xFileLangSpecNotObjC 1605 | local projectXmFiles 1606 | local projectXFiles 1607 | local logosStdErr 1608 | local logosErr=0 1609 | 1610 | # verify use 1611 | 1612 | [[ -f "$pbxProjectFilePath" ]] || \ 1613 | panic 1 "Xcode project file not found: $pbxProjectFilePath" 1614 | 1615 | logosProcessor=`which logos.pl` || \ 1616 | panic $? "Failed to locate Logos Processor. Is Theos installed? If not, see http://iphonedevwiki.net/index.php/Theos/Getting_Started." 1617 | 1618 | # for *.xm project files, set known file-type and language specifications to Objective-C++ 1619 | 1620 | projectContainsXmFiles=`doesFileContain "$pbxProjectFilePath" '\/\* .+\.xm \*\/ *= *\{.*?isa *= *PBXFileReference\b'` 1621 | projectContainsXFiles=`doesFileContain "$pbxProjectFilePath" '\/\* .+\.x \*\/ *= *\{.*?isa *= *PBXFileReference\b'` 1622 | 1623 | if [[ $projectContainsXmFiles == "true" ]]; then 1624 | 1625 | lastKnownXmFileTypeNotObjCpp=`doesFileContain "$pbxProjectFilePath" '\/\* .+\.xm \*\/ *= *\{.*?isa *= *PBXFileReference\b[^\}]*?\blastKnownFileType *= *text\b'` 1626 | 1627 | if [[ $lastKnownXmFileTypeNotObjCpp == "true" ]]; then 1628 | echo "Modifying Xcode project file: setting *.xm file-types to Objective-C++..." 1629 | 1630 | perl -i -pe 's/^(.*\/\* .+\.xm \*\/ *= *{.*?isa *= *PBXFileReference\b[^}]*?\blastKnownFileType *= *)[^;]+(.*)$/\1sourcecode.cpp.objcpp\2/g' "$pbxProjectFilePath" || \ 1631 | panic $? "Failed to modify Xcode project file" 1632 | 1633 | projectFileModified=true 1634 | fi 1635 | 1636 | xmFileLangSpecNotObjCpp=`perl -ne 'if ($_ =~ /\/\* .+\.xm \*\/ *= *\{.*?isa *= *PBXFileReference\b/ && $_ !~ /\bxcLanguageSpecificationIdentifier *= *xcode\.lang\.objcpp\b/) { print "true"; exit; }' "$pbxProjectFilePath"` || \ 1637 | panic $? "Failed to execute perl on $pbxProjectFilePath" 1638 | 1639 | if [[ $xmFileLangSpecNotObjCpp == "true" ]]; then 1640 | echo "Modifying Xcode project file: setting *.xm language to Objective-C++..." 1641 | 1642 | perl -i -pe 'if ($_ =~ /\/\* .+\.xm \*\/ *= *\{.*?isa *= *PBXFileReference\b/ && $_ !~ /\bxcLanguageSpecificationIdentifier *= *xcode\.lang\.objcpp\b/) { s/^(.*\/\* .+\.xm \*\/ *= *{.*?isa *= *PBXFileReference\b[^}]*)(.*)$/\1xcLanguageSpecificationIdentifier = xcode.lang.objcpp; \2/g; }' "$pbxProjectFilePath" || \ 1643 | panic $? "Failed to modify Xcode project file" 1644 | 1645 | projectFileModified=true 1646 | fi 1647 | fi 1648 | 1649 | if [[ $projectContainsXFiles == "true" ]]; then 1650 | 1651 | lastKnownXFileTypeNotObjCpp=`doesFileContain "$pbxProjectFilePath" '\/\* .+\.x \*\/ *= *\{.*?isa *= *PBXFileReference\b[^\}]*?\blastKnownFileType *= *text\b'` 1652 | 1653 | if [[ $lastKnownXFileTypeNotObjC == "true" ]]; then 1654 | echo "Modifying Xcode project file: setting *.x file-types to Objective-C..." 1655 | 1656 | perl -i -pe 's/^(.*\/\* .+\.x \*\/ *= *{.*?isa *= *PBXFileReference\b[^}]*?\blastKnownFileType *= *)[^;]+(.*)$/\1sourcecode.c.objc\2/g' "$pbxProjectFilePath" || \ 1657 | panic $? "Failed to modify Xcode project file" 1658 | 1659 | projectFileModified=true 1660 | fi 1661 | 1662 | xFileLangSpecNotObjC=`perl -ne 'if ($_ =~ /\/\* .+\.x \*\/ *= *\{.*?isa *= *PBXFileReference\b/ && $_ !~ /\bxcLanguageSpecificationIdentifier *= *xcode\.lang\.objc\b/) { print "true"; exit; }' "$pbxProjectFilePath"` || \ 1663 | panic $? "Failed to execute perl on $pbxProjectFilePath" 1664 | 1665 | if [[ $xFileLangSpecNotObjC == "true" ]]; then 1666 | echo "Modifying Xcode project file: setting *.x language to Objective-C..." 1667 | 1668 | perl -i -pe 'if ($_ =~ /\/\* .+\.x \*\/ *= *\{.*?isa *= *PBXFileReference\b/ && $_ !~ /\bxcLanguageSpecificationIdentifier *= *xcode\.lang\.objc\b/) { s/^(.*\/\* .+\.x \*\/ *= *{.*?isa *= *PBXFileReference\b[^}]*)(.*)$/\1xcLanguageSpecificationIdentifier = xcode.lang.objc; \2/g; }' "$pbxProjectFilePath" || \ 1669 | panic $? "Failed to modify Xcode project file" 1670 | 1671 | projectFileModified=true 1672 | fi 1673 | fi 1674 | 1675 | if [[ $projectFileModified == "true" ]]; then 1676 | echo "DON'T WORRY, EVERYTHING IS OK!" 1677 | echo "The Xcode project file was modified to provide better *.xm & *.x file support." 1678 | echo "To dismiss this build error, just perform the build again." 1679 | panic 1 1680 | fi 1681 | 1682 | # for each *.xm project file, use Logos Processor to generate *.mm file 1683 | 1684 | projectXmFiles=($(perl -ne 'if ($_ =~ /\/\* (.+\.xm) \*\/ *= *{.*?isa *= *PBXFileReference\b/) { print "$1\n"; }' "$pbxProjectFilePath")) 1685 | projectXFiles=($(perl -ne 'if ($_ =~ /\/\* (.+\.x) \*\/ *= *{.*?isa *= *PBXFileReference\b/) { print "$1\n"; }' "$pbxProjectFilePath")) 1686 | 1687 | for f in "${projectXmFiles[@]}"; do 1688 | echo "Logos Processor: $f -> ${f%.*}.mm..." 1689 | 1690 | logosStdErr=$(("$logosProcessor" "$PROJECT_DIR/$TARGET_NAME/$f" > "$PROJECT_DIR/$TARGET_NAME/${f%.*}.mm") 2>&1) || \ 1691 | logosErr=$? 1692 | 1693 | if [[ $logosErr != 0 ]]; then 1694 | echo "Failed Logos Processor" >&2 1695 | echo "Logos Processor outputted:" >&2 1696 | echo "$logosStdErr" >&2 1697 | exit $logosErr 1698 | fi 1699 | 1700 | done 1701 | 1702 | for f in "${projectXFiles[@]}"; do 1703 | echo "Logos Processor: $f -> ${f%.*}.m..." 1704 | 1705 | logosStdErr=$(("$logosProcessor" "$PROJECT_DIR/$TARGET_NAME/$f" > "$PROJECT_DIR/$TARGET_NAME/${f%.*}.m") 2>&1) || \ 1706 | panic $? "Failed Logos Processor" 1707 | 1708 | [[ $logosStdErr == "" ]] || \ 1709 | panic 1 "Logos Processor outputted: $logosStdErr" 1710 | done 1711 | 1712 | echo "Note: If any *.xm or *.x file generated above by the Logos Processor (${projectXmFiles[@]}) is not being compiled below, then you must add it to the Xcode project to be compiled." 1713 | 1714 | # success # 1715 | echo "Xcode Build Phase for Logos Processor complete." 1716 | } 1717 | 1718 | # === xcbp (action) === # 1719 | 1720 | function xcodeBuildPhase() # no args 1721 | { 1722 | [[ "$ACTION" == "build" ]] || \ 1723 | panic 1 "For Xcode Build Phase use only" 1724 | 1725 | echo "Preparing to run Xcode Build Phase..." 1726 | 1727 | # process environment variables # 1728 | 1729 | local builtExecutable="$TARGET_BUILD_DIR/$EXECUTABLE_PATH" 1730 | local packageDirectory="$PROJECT_DIR/$TARGET_NAME/Package" 1731 | local packageInstallPath="$packageDirectory$INSTALL_PATH" 1732 | local packageVersionPListPath="$PROJECT_DIR/$TARGET_NAME/PackageVersion.plist" 1733 | local allPackagesDir="$PROJECT_DIR/Packages" 1734 | local builtProductsDir="$BUILT_PRODUCTS_DIR" 1735 | local latestBuildSymlink="$PROJECT_DIR/LatestBuild" 1736 | local stripBin 1737 | local stripOption 1738 | local versionPListPath 1739 | local packageFileName 1740 | 1741 | local packageInstallSource 1742 | if [[ $SHALLOW_BUNDLE != "YES" ]]; then 1743 | packageInstallSource="$TARGET_BUILD_DIR/$EXECUTABLE_PATH" 1744 | else 1745 | packageInstallSource="$TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH" 1746 | fi 1747 | 1748 | # if build setting iOSOpenDevDevice is empty, get it from user's Bash profile 1749 | [[ $iOSOpenDevDevice != "" ]] || \ 1750 | iOSOpenDevDevice=`getBashProfileEnvVarValue "iOSOpenDevDevice"` 1751 | 1752 | # if build setting iOSOpenDevPort is empty, try to get it from user's profile 1753 | # or, if that fails, use the default value of 22 1754 | 1755 | [[ $iOSOpenDevPort != "" ]] || \ 1756 | iOSOpenDevPort=`getBashProfileEnvVarValue "iOSOpenDevPort"` 1757 | 1758 | [[ $iOSOpenDevPort != "" ]] || \ 1759 | iOSOpenDevPort=22 1760 | 1761 | 1762 | # verify requirements # 1763 | requireFile "$builtExecutable" false 1764 | requireDir "$packageDirectory" 1765 | 1766 | # create latest build symlink # 1767 | createSymlink "$builtProductsDir" "$latestBuildSymlink" 1768 | 1769 | # if doing Archive, strip executable ... 1770 | # note: even though Xcode strips the executable AFTER this script runs, the 1771 | # executable is stripped now since it will be included in the package 1772 | # that will be built by this script below 1773 | if [[ "$CONFIGURATION" == "Release" && "$VALIDATE_PRODUCT" == "YES" && "$DEPLOYMENT_POSTPROCESSING" == "YES" ]]; then 1774 | if [[ "$STRIP_INSTALLED_PRODUCT" == "YES" ]]; then 1775 | 1776 | stripBin=`xcodebuild -sdk iphoneos -find strip` || \ 1777 | panic $? "Failed to get strip path" 1778 | 1779 | [[ "$STRIP_STYLE" != "debugging" ]] || stripOption="-S" 1780 | 1781 | echo "Stripping $builtExecutable..." 1782 | 1783 | "$stripBin" $stripOption "$builtExecutable" || \ 1784 | panic $? "Failed to strip $builtExecutable" 1785 | fi 1786 | fi 1787 | 1788 | # if doing any, ... # 1789 | 1790 | if [[ "$MACH_O_TYPE" == "staticlib" && "$CODE_SIGN_IDENTITY" == "" ]]; then 1791 | echo "Skipping signing (since ldid would be used and it fails on static libraries)" 1792 | elif [[ "$PLATFORM_NAME" != "iphoneos" ]]; then 1793 | echo "Skipping signing (since platform is not iphoneos)" 1794 | else 1795 | signCode "$builtExecutable" "$CODE_SIGN_IDENTITY" 1796 | fi 1797 | 1798 | changeMode "$INSTALL_MODE_FLAG" "$builtExecutable" 1799 | 1800 | # if doing any and iOSOpenDevCopyOnBuild is YES, then copy executable to device ... 1801 | if [[ "$iOSOpenDevCopyOnBuild" == "YES" ]]; then 1802 | 1803 | if [[ "$iOSOpenDevDevice" != "" ]]; then 1804 | copyFileToDevice "$builtExecutable" "/var/root/iOSOpenDevBuilds/$PROJECT_NAME" "$iOSOpenDevDevice" "$iOSOpenDevPort" 1805 | else 1806 | # build setting iOSOpenDevDevice is empty # 1807 | panic 1 "Unable to copy executable to device since build setting iOSOpenDevDevice is not set or is empty and it is not exported in your Bash personal initialization file" 1808 | fi 1809 | 1810 | fi 1811 | 1812 | # if doing Archive, For Archiving or For Profiling, build package... 1813 | if [[ "$CONFIGURATION" == "Release" && "$VALIDATE_PRODUCT" == "YES" ]] || [[ "$iOSOpenDevInstallOnAnyBuild" == "YES" ]] || [[ "$iOSOpenDevBuildPackageOnAnyBuild" == "YES" ]]; then 1814 | 1815 | # if doing Archive, do... 1816 | #if [[ "$DEPLOYMENT_POSTPROCESSING" == "YES" ]]; then 1817 | #fi 1818 | 1819 | # prepare to build package # 1820 | 1821 | echo "Copying $packageInstallSource to package directory at $packageInstallPath..." 1822 | 1823 | requireDir "$packageInstallPath" true 1824 | 1825 | copyFile "$packageInstallSource" "$packageInstallPath" 1826 | 1827 | # build package # 1828 | 1829 | [[ "$iOSOpenDevUsePackageVersionPList" != "YES" ]] || \ 1830 | versionPListPath="$packageVersionPListPath" 1831 | 1832 | buildPackage "$packageDirectory" "$allPackagesDir" "$versionPListPath" true 1833 | 1834 | # if more than just $iOSOpenDevBuildPackageOnAnyBuild == "YES" ... 1835 | if [[ "$CONFIGURATION" == "Release" && "$VALIDATE_PRODUCT" == "YES" ]] || [[ "$iOSOpenDevInstallOnAnyBuild" == "YES" ]]; then 1836 | 1837 | # if doing For Archiving or For Profiling, see about installing package on device... 1838 | if [[ "$DEPLOYMENT_POSTPROCESSING" == "NO" || "$iOSOpenDevInstallOnAnyBuild" == "YES" ]]; then 1839 | 1840 | # if build setting iOSOpenDevInstallOnProfiling is enabled, installation of package is enabled... 1841 | if [[ "$iOSOpenDevInstallOnProfiling" == "YES" || "$iOSOpenDevInstallOnAnyBuild" == "YES" ]]; then 1842 | 1843 | # if iOSOpenDevDevice has a value, install package on device... 1844 | if [[ "$iOSOpenDevDevice" != "" ]]; then 1845 | 1846 | # get package file name # 1847 | packageFileName="`getPackageFileNameUsingControlFile \"$packageDirectory/DEBIAN/control\"`.deb" 1848 | 1849 | # install package on device # 1850 | managePackageOnDevice "install" "$allPackagesDir/$packageFileName" "$iOSOpenDevDevice" "$iOSOpenDevPort" 1851 | 1852 | # respring? # 1853 | if [[ "$iOSOpenDevRespringOnInstall" == "YES" ]]; then 1854 | echo "Respringing device..." 1855 | runFuncOnDevice "respring" "$iOSOpenDevDevice" "$iOSOpenDevPort" 1856 | fi 1857 | else 1858 | # build setting iOSOpenDevDevice is empty # 1859 | panic 1 "Unable to install package on device since build setting iOSOpenDevDevice is not set or is empty and it is not exported in your Bash personal initialization file" 1860 | fi 1861 | else 1862 | # build setting iOSOpenDevInstallOnProfiling is disabled # 1863 | echo "Installation of package on device is disabled. To enable, set build setting iOSOpenDevInstallOnProfiling to YES." 1864 | fi 1865 | fi 1866 | fi 1867 | fi 1868 | 1869 | # success # 1870 | echo "Xcode Build Phase complete." 1871 | } 1872 | 1873 | # === usage === # 1874 | 1875 | function showUsageAndExit() # args: showEverything 1876 | { 1877 | local showEverything="$1" 1878 | local n 1879 | 1880 | echo "$scriptName (v$scriptVer) -- iOSOpenDev Command-line Tool" 1881 | echo "Usages:" 1882 | 1883 | for n in "${ActionNames[@]}"; do 1884 | eval echo "\" $scriptName \${Action_$n[$ActionProperty_ShortArg]} \${Action_$n[$ActionProperty_ShortUsage]}\"" 1885 | done 1886 | 1887 | if [[ $showEverything == "true" ]]; then 1888 | echo 1889 | echo "Actions:" 1890 | 1891 | for n in "${ActionNames[@]}"; do 1892 | eval echo "\" \${Action_$n[$ActionProperty_ShortArg]} \${Action_$n[$ActionProperty_ShortUsage]}\"" 1893 | eval echo "\"\${Action_$n[$ActionProperty_LongUsage]}\"" 1894 | echo 1895 | done 1896 | fi 1897 | 1898 | panic 1 1899 | } 1900 | 1901 | function showSingleUsageAndExit() 1902 | { 1903 | panic 1 "Usage: $scriptName ${activeActionArg[$ActionProperty_ShortArg]} ${activeActionArg[$ActionProperty_ShortUsage]} 1904 | 1905 | ${activeActionArg[$ActionProperty_LongUsage]} 1906 | " 1907 | 1908 | } 1909 | 1910 | # === start script === # 1911 | 1912 | [[ $1 != "" ]] || showUsageAndExit false 1913 | [[ $1 != "--help" ]] || showUsageAndExit true 1914 | 1915 | # determine active "action" (which is first argument) # 1916 | 1917 | for n in "${ActionNames[@]}"; do 1918 | foundArg=false 1919 | eval [[ "\$1" != "\${Action_$n[$ActionProperty_ShortArg]}" ]] || \ 1920 | foundArg=true 1921 | 1922 | if [[ $foundArg == true ]]; then 1923 | eval activeActionArg=("\"\${Action_$n[@]}\"") 1924 | break; 1925 | fi 1926 | done 1927 | 1928 | [[ $foundArg == true ]] || \ 1929 | panic 1 "Invalid argument: $1" 1930 | 1931 | [[ "$#" != 1 || ${activeActionArg[$ActionProperty_MinArgs]} == 0 ]] || \ 1932 | showSingleUsageAndExit 1933 | 1934 | # process action's options # 1935 | 1936 | shift 1 1937 | 1938 | while getopts ":${activeActionArg[$ActionProperty_Options]}" opt; do 1939 | case "$opt" in 1940 | \?) 1941 | panic 1 "Invalid option: -$OPTARG" 1942 | ;; 1943 | *) 1944 | [[ $opt != ":" ]] || \ 1945 | panic 1 "Option missing value: -$OPTARG" 1946 | 1947 | eval Opt_$opt="\"${OPTARG-true}\"" 1948 | ;; 1949 | esac 1950 | done 1951 | 1952 | # correct amount of arguments left? # 1953 | 1954 | shift $(($OPTIND - 1)) # shift out options 1955 | 1956 | (( "$#" >= ${activeActionArg[$ActionProperty_MinArgs]} && "$#" <= ${activeActionArg[$ActionProperty_MaxArgs]} )) || \ 1957 | showSingleUsageAndExit 1958 | 1959 | # perform action's function # 1960 | 1961 | [[ ${activeActionArg[$ActionProperty_RequireSudo]} == false ]] || \ 1962 | requireSudo "${originalArguments[@]}" 1963 | 1964 | case "${activeActionArg[$ActionProperty_ShortArg]}" in 1965 | ${Action_SignCode[$ActionProperty_ShortArg]}) 1966 | "${activeActionArg[$ActionProperty_Function]}" "$@" "$Opt_i" 1967 | ;; 1968 | ${Action_BuildPackage[$ActionProperty_ShortArg]}) 1969 | "${activeActionArg[$ActionProperty_Function]}" "$@" "$Opt_p" "$Opt_z" 1970 | ;; 1971 | ${Action_InstallPackage[$ActionProperty_ShortArg]}) 1972 | "${activeActionArg[$ActionProperty_Function]}" "install" "$@" "$Opt_h" "$Opt_p" 1973 | ;; 1974 | ${Action_RemovePackage[$ActionProperty_ShortArg]}) 1975 | "${activeActionArg[$ActionProperty_Function]}" "remove" "$@" "$Opt_h" "$Opt_p" 1976 | ;; 1977 | ${Action_PurgePackage[$ActionProperty_ShortArg]}) 1978 | "${activeActionArg[$ActionProperty_Function]}" "purge" "$@" "$Opt_h" "$Opt_p" 1979 | ;; 1980 | ${Action_DumpSDKHeaders[$ActionProperty_ShortArg]}) 1981 | "${activeActionArg[$ActionProperty_Function]}" "$@" "$Opt_z" "$Opt_i" 1982 | ;; 1983 | ${Action_CopyHeadersToSDK[$ActionProperty_ShortArg]}) 1984 | "${activeActionArg[$ActionProperty_Function]}" "$@" "$Opt_t" 1985 | ;; 1986 | ${Action_DumpAndCopyHeaders[$ActionProperty_ShortArg]}) 1987 | "${activeActionArg[$ActionProperty_Function]}" "$@" "$Opt_t" "$Opt_z" "$Opt_i" 1988 | ;; 1989 | ${Action_RemoveCopiedHeaders[$ActionProperty_ShortArg]}) 1990 | "${activeActionArg[$ActionProperty_Function]}" "$@" 1991 | ;; 1992 | ${Action_AddSshKeyToDevice[$ActionProperty_ShortArg]}) 1993 | "${activeActionArg[$ActionProperty_Function]}" "$Opt_h" "$Opt_r" "$Opt_p" 1994 | ;; 1995 | ${Action_DumpAllHeaders[$ActionProperty_ShortArg]}) 1996 | "${activeActionArg[$ActionProperty_Function]}" "$Opt_z" "$Opt_i" 1997 | ;; 1998 | ${Action_RunCmdOnDevice[$ActionProperty_ShortArg]}) 1999 | "${activeActionArg[$ActionProperty_Function]}" "$Opt_h" "$Opt_p" "$@" 2000 | ;; 2001 | ${Action_RunFuncOnDevice[$ActionProperty_ShortArg]}) 2002 | "${activeActionArg[$ActionProperty_Function]}" "$@" "$Opt_h" "$Opt_p" 2003 | ;; 2004 | ${Action_XcodeBuildPhase[$ActionProperty_ShortArg]}) 2005 | "${activeActionArg[$ActionProperty_Function]}" 2006 | ;; 2007 | ${Action_SshToDevice[$ActionProperty_ShortArg]}) 2008 | "${activeActionArg[$ActionProperty_Function]}" "$Opt_h" "$Opt_p" 2009 | ;; 2010 | ${Action_UpdateIncludeAndLib[$ActionProperty_ShortArg]}) 2011 | "${activeActionArg[$ActionProperty_Function]}" "$Opt_h" "$Opt_p" 2012 | ;; 2013 | ${Action_XcodeBuildPhaseLogos[$ActionProperty_ShortArg]}) 2014 | "${activeActionArg[$ActionProperty_Function]}" 2015 | ;; 2016 | ${Action_XcodeBuildPhaseArm64eLegacy[$ActionProperty_ShortArg]}) 2017 | "${activeActionArg[$ActionProperty_Function]}" 2018 | ;; 2019 | ${Action_XcodeBuildPhaseArm64ePrepare[$ActionProperty_ShortArg]}) 2020 | "${activeActionArg[$ActionProperty_Function]}" 2021 | ;; 2022 | esac 2023 | 2024 | # finished # 2025 | exit 0 2026 | -------------------------------------------------------------------------------- /bin/ldid2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/bin/ldid2 -------------------------------------------------------------------------------- /bin/lipo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/bin/lipo -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Define functions 4 | function patchXcode { 5 | BASE_PATH=$1 6 | CURRENT_USER="$USER" 7 | echo "[*] (Re-)patching Xcode" 8 | 9 | # TODO: Update templates with current BASE_PATH instead of /opt/iOSOpenDev 10 | 11 | echo "[*] Linking specifications if necessary..." 12 | if [ ! -L "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications" ]; then 13 | sudo ln -s "${BASE_PATH}/specifications/iPhoneOS/Specifications" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/" 14 | sudo ln -s "${BASE_PATH}/specifications/iPhoneSimulator/Specifications" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/" 15 | fi 16 | 17 | echo "[*] Transferring templates..." 18 | if [ ! -e "/Users/${CURRENT_USER}/Library/Developer/Xcode/Templates/" ]; then 19 | mkdir -p "/Users/${CURRENT_USER}/Library/Developer/Xcode/Templates/" 20 | fi 21 | cp -R "${BASE_PATH}/templates/" "/Users/${CURRENT_USER}/Library/Developer/Xcode/Templates/" 22 | 23 | echo "[*] Transferring SDKs..." 24 | sudo cp -R "${BASE_PATH}/deps/sdks/" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/" 25 | 26 | echo "[*] Patching latest SDK..." 27 | sudo /usr/libexec/PlistBuddy -c "Set DefaultProperties:AD_HOC_CODE_SIGNING_ALLOWED YES" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist 28 | sudo /usr/libexec/PlistBuddy -c "Set DefaultProperties:CODE_SIGNING_REQUIRED NO" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist 29 | sudo /usr/libexec/PlistBuddy -c "Set DefaultProperties:ENTITLEMENTS_REQUIRED NO" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist 30 | sudo /usr/libexec/PlistBuddy -c "Set DefaultProperties:AD_HOC_CODE_SIGNING_ALLOWED YES" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/SDKSettings.plist 31 | sudo /usr/libexec/PlistBuddy -c "Set DefaultProperties:CODE_SIGNING_REQUIRED NO" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/SDKSettings.plist 32 | 33 | echo "[*] Patching minimum SDK version..." 34 | sudo /usr/libexec/PlistBuddy -c "Set MinimumSDKVersion 8.4" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist 35 | sudo /usr/libexec/PlistBuddy -c "Set MinimumSDKVersion 8.4" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Info.plist 36 | 37 | if [ ! -e "${BASE_PATH}/Toolchains/Xcode.arm64eLegacy.xctoolchain" ]; then 38 | mkdir -p "${BASE_PATH}/Toolchains" 39 | 40 | echo "[*] Downloading legacy arm64e toolchain (442 MB compressed, 1.4 GB unpacked) -- this will take a while" 41 | curl -o "${BASE_PATH}/Toolchains/Xcode.arm64eLegacy.xctoolchain.tar.bz2" https://incendo.ws/files/Xcode.arm64eLegacy.xctoolchain.tar.bz2 42 | 43 | echo "[*] Unpacking legacy arm64e toolchain..." 44 | tar -xf "${BASE_PATH}/Toolchains/Xcode.arm64eLegacy.xctoolchain.tar.bz2" --directory "${BASE_PATH}/Toolchains/" 45 | fi 46 | 47 | echo "[*] Copying legacy arm64e toolchain..." 48 | 49 | sudo mkdir -p /Library/Developer/Toolchains 50 | sudo rm -rf /Library/Developer/Toolchains/Xcode.arm64eLegacy.xctoolchain 51 | sudo cp -r "${BASE_PATH}/Toolchains/Xcode.arm64eLegacy.xctoolchain" /Library/Developer/Xcode.arm64eLegacy.xctoolchain 52 | 53 | echo "[!] Done patching Xcode" 54 | } 55 | 56 | function patchSimulators { 57 | BASE_PATH=$1 58 | echo "[*] (Re-)patching iOS simulators for simject" 59 | 60 | cd "${BASE_PATH}/deps/simject" 61 | chmod +x installsubstrate.sh 62 | ./installsubstrate.sh subst 1>/dev/null 63 | 64 | echo "[!] Patched iOS simulators" 65 | } 66 | 67 | function installSimject { 68 | export THEOS=$THEOS_PATH 69 | BASE_PATH=$1 70 | 71 | echo "[*] Installing simject" 72 | 73 | cd "${BASE_PATH}/deps/simject" 74 | git submodule init 1>/dev/null && git submodule update 1>/dev/null 75 | 76 | make setup 1>/dev/null 77 | sudo cp "${BASE_PATH}/deps/simject/bin/resim" /usr/local/bin/ 78 | 79 | echo "[!] Installed simject" 80 | echo "[*] Added binary: resim" 81 | echo "[*] Call to reload the currently running iOS Simulator with tweaks" 82 | echo "[*] It is automatically invoked by Xcode if you switch on the SIMJECT flag for a Logos-based project" 83 | } 84 | 85 | 86 | # Setup defaults 87 | BASE_PATH="$( cd "$(dirname "$0")" ; pwd -P )" 88 | THEOS_PATH="/opt/theos" 89 | INSTALL_SIMJECT=1 90 | 91 | PATCH_SIMJECT_ONLY=0 92 | PATCH_XCODE_ONLY=0 93 | 94 | # Parse args 95 | for i in "$@" 96 | do 97 | case $i in 98 | --theos-path=*) 99 | THEOS_PATH="${i#*=}" 100 | shift 101 | ;; 102 | --no-simject) 103 | INSTALL_SIMJECT=0 104 | shift 105 | ;; 106 | --patch-simject) 107 | PATCH_SIMJECT_ONLY=1 108 | shift 109 | ;; 110 | --patch-xcode) 111 | PATCH_XCODE_ONLY=1 112 | shift 113 | ;; 114 | *) 115 | # unknown option, ignoring 116 | ;; 117 | esac 118 | done 119 | 120 | # Work with args 121 | 122 | if { [ "$PATCH_SIMJECT_ONLY" -ne 1 ] && [ "$PATCH_XCODE_ONLY" -ne 1 ] ; } then 123 | patchXcode $BASE_PATH 124 | 125 | # Do simject stuff second 126 | if [ "$INSTALL_SIMJECT" -ne 0 ]; then 127 | export THEOS=$THEOS_PATH 128 | 129 | installSimject $BASE_PATH 130 | patchSimulators $BASE_PATH 131 | fi 132 | 133 | echo "[!] Installation complete" 134 | elif [ "$PATCH_SIMJECT_ONLY" == 1 ]; then 135 | patchSimulators $BASE_PATH 136 | elif [ "$PATCH_XCODE_ONLY" == 1 ]; then 137 | patchXcode $BASE_PATH 138 | else 139 | echo "[!] No action specified, exiting." 140 | fi 141 | -------------------------------------------------------------------------------- /notes/arm64e-legacy.txt: -------------------------------------------------------------------------------- 1 | xcodebuild -project Xen\ HTML.xcodeproj VALID_ARCHS=arm64e -target Loader -toolchain "com.applex.dt.toolchain.Xcode.arm64e.legacy" SYMROOT="$(pwd)/DEBUGBUILD/" 2 | rm -rf ./build 3 | 4 | environment variables 5 | ===================== 6 | 7 | BUILT_PRODUCTS_DIR=/Users/matt/Library/Developer/Xcode/DerivedData/Xen_HTML-foqfwpqcsqraphbmjzrbmizmehaq/Build/Products/Release-iphoneos 8 | BUILD_DIR -> end products directory 9 | BUILD_ROOT 10 | 11 | 12 | TARGETNAME -> current target being built 13 | SYMROOT -> base path for build 14 | 15 | 16 | Steps for legacy build 17 | 1. Skip if not release build or is already running to avoid recursion 18 | if [ "${SKIP_LEGACY}" -eq "1" ];then 19 | exit 0; 20 | fi 21 | 22 | 23 | if [ "${CONFIGURATION}" -eq "Release" ];then 24 | exit 0; 25 | fi 26 | 27 | export SKIP_LEGACY=1 28 | 29 | 2. Store final binary name into var 30 | 31 | FINAL_PRODUCT="${BUILT_PRODUCTS_DIR}/FULL_PRODUCT_NAME" 32 | 33 | 3. Call for new build of current target: 34 | 35 | xcodebuild -project "${PROJECT_FILE_PATH}" -target $TARGETNAME -toolchain "com.applex.dt.toolchain.Xcode.arm64e.legacy" VALID_ARCHS=arm64e SYMROOT="${SYMROOT}/arm64e-legacy" CONFIGURATION=$CONFIGURATION 36 | 37 | 2. For generated binary, merge into final one under the original SYMROOT 38 | 39 | echo "Merging ${SYMROOT}/arm64e-legacy/${CONFIGURATION}-${PLATFORM_NAME}/${FULL_PRODUCT_NAME} and ${FINAL_PRODUCT}" 40 | "${iOSOpenDevPath}/bin/lipo" -create "${SYMROOT}/arm64e-legacy/${CONFIGURATION}-${PLATFORM_NAME}/${FULL_PRODUCT_NAME}" $FINAL_PRODUCT -output $FINAL_PRODUCT 41 | 42 | 43 | 44 | 45 | Don't forget to update templates to include this phase -------------------------------------------------------------------------------- /specifications/iPhoneOS/Specifications/iPhoneOSPackageTypes.xcspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/specifications/iPhoneOS/Specifications/iPhoneOSPackageTypes.xcspec -------------------------------------------------------------------------------- /specifications/iPhoneOS/Specifications/iPhoneOSProductTypes.xcspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/specifications/iPhoneOS/Specifications/iPhoneOSProductTypes.xcspec -------------------------------------------------------------------------------- /specifications/iPhoneSimulator/Specifications/iPhone Simulator PackageTypes.xcspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/specifications/iPhoneSimulator/Specifications/iPhone Simulator PackageTypes.xcspec -------------------------------------------------------------------------------- /specifications/iPhoneSimulator/Specifications/iPhone Simulator ProductTypes.xcspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/specifications/iPhoneSimulator/Specifications/iPhone Simulator ProductTypes.xcspec -------------------------------------------------------------------------------- /templates/Activator Listener.xctemplate/Icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Activator Listener.xctemplate/Icon-small.png -------------------------------------------------------------------------------- /templates/Activator Listener.xctemplate/Icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Activator Listener.xctemplate/Icon-small@2x.png -------------------------------------------------------------------------------- /templates/Activator Listener.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Activator Listener.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Activator Listener.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.activatorListener 9 | Concrete 10 | 11 | Description 12 | This template builds an Activator Listener. 13 | Ancestors 14 | 15 | com.kokoabim.iosopendev.base 16 | com.kokoabim.iosopendev.unitTests 17 | 18 | Targets 19 | 20 | 21 | ProductType 22 | com.apple.product-type.library.dynamic 23 | SharedSettings 24 | 25 | INSTALL_PATH 26 | /Library/MobileSubstrate/DynamicLibraries 27 | DYLIB_CURRENT_VERSION 28 | 1 29 | DYLIB_COMPATIBILITY_VERSION 30 | 1 31 | 32 | BuildPhases 33 | 34 | 35 | Class 36 | Sources 37 | 38 | 39 | Class 40 | Frameworks 41 | 42 | 43 | Class 44 | Headers 45 | 46 | 47 | ShellScript 48 | /opt/iOSOpenDev/bin/iosod --xcbp 49 | ShellPath 50 | /bin/sh 51 | RunOnlyForDeploymentPostprocessing 52 | 53 | Class 54 | ShellScript 55 | 56 | 57 | Frameworks 58 | 59 | Foundation 60 | UIKit 61 | 62 | 63 | 64 | Nodes 65 | 66 | ___PACKAGENAMEASIDENTIFIER___.m 67 | Package/DEBIAN/control:debianControl:section 68 | Package/DEBIAN/control:debianControl:depends 69 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 70 | Package/Library/Activator/Listeners/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___/Info.plist 71 | Package/Library/Activator/Listeners/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___/Icon-small.png 72 | Package/Library/Activator/Listeners/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___/Icon-small@2x.png 73 | 74 | Definitions 75 | 76 | ___PACKAGENAMEASIDENTIFIER___.m 77 | 78 | Beginning 79 | // 80 | // ___FILENAME___ 81 | // ___PACKAGENAME___ 82 | // 83 | // Created by ___FULLUSERNAME___ on ___DATE___. 84 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 85 | // 86 | 87 | // LibActivator by Ryan Petrich 88 | // See https://github.com/rpetrich/libactivator 89 | 90 | #import <Foundation/Foundation.h> 91 | #import <UIKit/UIKit.h> 92 | #import <libactivator/libactivator.h> 93 | 94 | #error iOSOpenDev post-project creation from template requirements (remove these lines after completed) -- \ 95 | Link to libactivator.dylib: \ 96 | (1) go to TARGETS > Build Phases > Link Binary With Libraries and add /opt/iOSOpenDev/lib/libactivator.dylib 97 | 98 | @interface ___FILEBASENAMEASIDENTIFIER___ : NSObject<LAListener, UIAlertViewDelegate> { 99 | @private 100 | UIAlertView *av; 101 | } 102 | @end 103 | 104 | @implementation ___FILEBASENAMEASIDENTIFIER___ 105 | 106 | - (BOOL)dismiss 107 | { 108 | if (av) 109 | { 110 | [av dismissWithClickedButtonIndex:[av cancelButtonIndex] animated:YES]; 111 | return YES; 112 | } 113 | return NO; 114 | } 115 | 116 | - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex 117 | { 118 | } 119 | 120 | - (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event 121 | { 122 | if (![self dismiss]) 123 | { 124 | av = [[UIAlertView alloc] initWithTitle:@"___PACKAGENAME___" message:[event name] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; 125 | [av show]; 126 | [event setHandled:YES]; 127 | } 128 | } 129 | 130 | - (void)activator:(LAActivator *)activator abortEvent:(LAEvent *)event 131 | { 132 | // Called when event is escalated to higher event 133 | [self dismiss]; 134 | } 135 | 136 | - (void)activator:(LAActivator *)activator otherListenerDidHandleEvent:(LAEvent *)event 137 | { 138 | // Called when other listener receives an event 139 | [self dismiss]; 140 | } 141 | 142 | - (void)activator:(LAActivator *)activator receiveDeactivateEvent:(LAEvent *)event 143 | { 144 | // Called when the home button is pressed. 145 | // If showing UI, then dismiss it and call setHandled:. 146 | if ([self dismiss]) 147 | [event setHandled:YES]; 148 | } 149 | 150 | 151 | + (void)load 152 | { 153 | @autoreleasepool 154 | { 155 | [[LAActivator sharedInstance] registerListener:[self new] forName:@"___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___"]; 156 | } 157 | } 158 | 159 | @end 160 | 161 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 162 | 163 | Group 164 | 165 | Package 166 | Library 167 | MobileSubstrate 168 | DynamicLibraries 169 | 170 | Beginning 171 | <?xml version="1.0" encoding="UTF-8"?> 172 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 173 | <plist version="1.0"> 174 | <dict> 175 | <key>Filter</key> 176 | <dict> 177 | <key>Bundles</key> 178 | <array> 179 | <string>com.apple.springboard</string> 180 | </array> 181 | </dict> 182 | </dict> 183 | </plist> 184 | 185 | *:debianControl:section 186 | Section: System 187 | *:debianControl:depends 188 | Depends: firmware (>= 5.0), mobilesubstrate, libactivator 189 | Package/Library/Activator/Listeners/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___/Info.plist 190 | 191 | Group 192 | 193 | Package 194 | Library 195 | Activator 196 | Listeners 197 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 198 | 199 | Beginning 200 | <?xml version="1.0" encoding="UTF-8"?> 201 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 202 | <plist version="1.0"> 203 | <dict> 204 | <key>title</key> 205 | <string>___PACKAGENAME___</string> 206 | <key>description</key> 207 | <string>Go Red Sox!</string> 208 | <key>compatible-modes</key> 209 | <array> 210 | <string>springboard</string> 211 | <string>application</string> 212 | <string>lockscreen</string> 213 | </array> 214 | </dict> 215 | </plist> 216 | 217 | Package/Library/Activator/Listeners/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___/Icon-small.png 218 | 219 | Group 220 | 221 | Package 222 | Library 223 | Activator 224 | Listeners 225 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 226 | 227 | Path 228 | Icon-small.png 229 | 230 | Package/Library/Activator/Listeners/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___/Icon-small@2x.png 231 | 232 | Group 233 | 234 | Package 235 | Library 236 | Activator 237 | Listeners 238 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 239 | 240 | Path 241 | Icon-small@2x.png 242 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /templates/Base.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Base.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Base.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Identifier 6 | com.kokoabim.iosopendev.base 7 | Kind 8 | Xcode.Xcode3.ProjectTemplateUnitKind 9 | Ancestors 10 | 11 | com.apple.dt.unit.iPhoneBase 12 | com.kokoabim.iosopendev.debianPackage 13 | com.kokoabim.iosopendev.preferenceLoader 14 | 15 | Targets 16 | 17 | 18 | Name 19 | ___PACKAGENAME___ 20 | SharedSettings 21 | 22 | ARCHS 23 | 24 | arm64 25 | arm64e 26 | armv7 27 | armv7s 28 | 29 | CODE_SIGN_IDENTITY 30 | 31 | PRODUCT_NAME 32 | $(TARGET_NAME) 33 | iOSOpenDevRespringOnInstall 34 | YES 35 | iOSOpenDevDevice 36 | 192.168.0.0 37 | iOSOpenDevInstallOnProfiling 38 | NO 39 | iOSOpenDevCopyOnBuild 40 | NO 41 | iOSOpenDevInstallOnAnyBuild 42 | NO 43 | 44 | 45 | 46 | Platforms 47 | 48 | com.apple.platform.iphoneos 49 | 50 | Project 51 | 52 | SharedSettings 53 | 54 | TARGETED_DEVICE_FAMILY 55 | 1,2 56 | GCC_WARN_ABOUT_MISSING_PROTOTYPES 57 | YES 58 | GCC_WARN_UNUSED_VARIABLE 59 | YES 60 | GCC_WARN_ABOUT_RETURN_TYPE 61 | YES 62 | GCC_C_LANGUAGE_STANDARD 63 | gnu99 64 | EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES 65 | *.nib *.lproj *.gch (*) .DS_Store CVS .svn .git .hg *.xcodeproj *.xcode *.pbproj *.pbxproj 66 | HEADER_SEARCH_PATHS 67 | $(THEOS)/vendor/include/** 68 | LIBRARY_SEARCH_PATHS 69 | $(THEOS)/vendor/lib/** 70 | THEOS 71 | /opt/theos 72 | IPHONEOS_DEPLOYMENT_TARGET 73 | latest_iphoneos 74 | FRAMEWORK_SEARCH_PATHS 75 | $(SDKROOT)/System/Library/PrivateFrameworks 76 | 77 | SDK 78 | iphoneos 79 | Configurations 80 | 81 | Debug 82 | 83 | VALIDATE_PRODUCT 84 | NO 85 | GCC_OPTIMIZATION_LEVEL 86 | 0 87 | GCC_PREPROCESSOR_DEFINITIONS 88 | DEBUG=1 $(inherited) 89 | GCC_SYMBOLS_PRIVATE_EXTERN 90 | NO 91 | COPY_PHASE_STRIP 92 | NO 93 | GCC_DYNAMIC_NO_PIC 94 | NO 95 | 96 | Release 97 | 98 | COPY_PHASE_STRIP 99 | YES 100 | VALIDATE_PRODUCT 101 | YES 102 | 103 | 104 | 105 | Options 106 | 107 | 108 | Identifier 109 | productName 110 | Required 111 | 112 | Name 113 | Product Name 114 | NotPersisted 115 | 116 | Description 117 | Your new product's name. 118 | EmptyReplacement 119 | ProductName 120 | Type 121 | text 122 | 123 | 124 | Identifier 125 | bundleIdentifierPrefix 126 | Required 127 | 128 | Name 129 | Company Identifier 130 | Description 131 | Your company's bundle identifier prefix. 132 | EmptyReplacement 133 | com.yourcompany 134 | Type 135 | text 136 | 137 | 138 | Identifier 139 | bundleIdentifier 140 | Name 141 | Bundle Identifier 142 | NotPersisted 143 | 144 | Description 145 | Your new product's bundle identifier. 146 | Default 147 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 148 | Type 149 | static 150 | 151 | 152 | Definitions 153 | 154 | *:comments 155 | // 156 | // ___FILENAME___ 157 | // ___PACKAGENAME___ 158 | // 159 | // Created by ___FULLUSERNAME___ on ___DATE___. 160 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 161 | // 162 | 163 | *:import:* 164 | #import "___*___" 165 | 166 | *:*:importFoundation 167 | #import <Foundation/Foundation.h> 168 | 169 | ___PACKAGENAME___-Prefix.pch 170 | 171 | Beginning 172 | // 173 | // Prefix header for all source files of the '___PACKAGENAME___' target in the '___PACKAGENAME___' project 174 | // 175 | 176 | #import <_Prefix/HBLog.h> 177 | 178 | Group 179 | Supporting Files 180 | TargetIndices 181 | 182 | 183 | ___PACKAGENAME___-Prefix.pch:objC 184 | 185 | Beginning 186 | #ifdef __OBJC__ 187 | End 188 | #endif 189 | Indent 190 | 1 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /templates/Cocoa Touch Library.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Cocoa Touch Library.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Cocoa Touch Library.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.cocoaTouchLibrary 9 | Concrete 10 | 11 | Description 12 | This template builds a dynamic or static library that links against the Foundation and UIKit frameworks. 13 | Ancestors 14 | 15 | com.kokoabim.iosopendev.base 16 | com.kokoabim.iosopendev.unitTests 17 | 18 | Targets 19 | 20 | 21 | SharedSettings 22 | 23 | INSTALL_PATH 24 | /usr/lib 25 | GCC_PREFIX_HEADER 26 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 27 | GCC_PRECOMPILE_PREFIX_HEADER 28 | YES 29 | 30 | BuildPhases 31 | 32 | 33 | Class 34 | Sources 35 | 36 | 37 | Class 38 | Frameworks 39 | 40 | 41 | Class 42 | Headers 43 | 44 | 45 | ShellScript 46 | /opt/iOSOpenDev/bin/iosod --xcbp 47 | ShellPath 48 | /bin/sh 49 | RunOnlyForDeploymentPostprocessing 50 | 51 | Class 52 | ShellScript 53 | 54 | 55 | Frameworks 56 | 57 | Foundation 58 | UIKit 59 | 60 | 61 | 62 | Options 63 | 64 | 65 | NotPersisted 66 | 67 | SortOrder 68 | 1 69 | Identifier 70 | cocoaLibraryType 71 | Name 72 | Type 73 | Description 74 | Indicates which type of library to create. 75 | Type 76 | popup 77 | Default 78 | Dynamic 79 | Units 80 | 81 | Dynamic 82 | 83 | 84 | Targets 85 | 86 | 87 | ProductType 88 | com.apple.product-type.library.dynamic 89 | SharedSettings 90 | 91 | DYLIB_COMPATIBILITY_VERSION 92 | 1 93 | DYLIB_CURRENT_VERSION 94 | 1 95 | 96 | 97 | 98 | 99 | 100 | Static 101 | 102 | 103 | Targets 104 | 105 | 106 | ProductType 107 | com.apple.product-type.library.static 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | SortOrder 116 | 1 117 | NotPersisted 118 | 119 | Identifier 120 | executablePrefixLib 121 | Name 122 | Prefix executable with lib 123 | Description 124 | Indicates whether to prefix library executable with lib. 125 | Type 126 | checkbox 127 | Default 128 | true 129 | Units 130 | 131 | true 132 | 133 | 134 | Targets 135 | 136 | 137 | SharedSettings 138 | 139 | EXECUTABLE_PREFIX 140 | lib 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | Nodes 150 | 151 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 152 | ___PACKAGENAMEASIDENTIFIER___.h 153 | ___PACKAGENAMEASIDENTIFIER___.m 154 | Package/DEBIAN/control:debianControl:section 155 | Package/DEBIAN/control:debianControl:depends 156 | Package/usr/lib/0xdeadfa11 157 | 158 | Definitions 159 | 160 | Package/usr/lib/0xdeadfa11 161 | 162 | Group 163 | 164 | Package 165 | usr 166 | lib 167 | 168 | Beginning 169 | 170 | This file was created only to help build the project's group structure, and it can now be deleted. 171 | 172 | Why 0xdeadfa11? See http://developer.apple.com/library/ios/#technotes/tn2151/_index.html. 173 | 174 | ___PACKAGENAMEASIDENTIFIER___.h 175 | 176 | Path 177 | ___PACKAGENAMEASIDENTIFIER___.h 178 | 179 | ___PACKAGENAMEASIDENTIFIER___.m 180 | 181 | Path 182 | ___PACKAGENAMEASIDENTIFIER___.m 183 | 184 | *:debianControl:section 185 | Section: System 186 | *:debianControl:depends 187 | Depends: firmware (>= 5.0) 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /templates/Cocoa Touch Library.xctemplate/___PACKAGENAMEASIDENTIFIER___.h: -------------------------------------------------------------------------------- 1 | // 2 | // ___FILENAME___ 3 | // ___PACKAGENAME___ 4 | // 5 | // Created by ___FULLUSERNAME___ on ___DATE___. 6 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ___FILEBASENAMEASIDENTIFIER___ : NSObject 12 | 13 | @end -------------------------------------------------------------------------------- /templates/Cocoa Touch Library.xctemplate/___PACKAGENAMEASIDENTIFIER___.m: -------------------------------------------------------------------------------- 1 | // 2 | // ___FILENAME___ 3 | // ___PACKAGENAME___ 4 | // 5 | // Created by ___FULLUSERNAME___ on ___DATE___. 6 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 7 | // 8 | 9 | #import "___FILEBASENAME___.h" 10 | 11 | @implementation ___FILEBASENAMEASIDENTIFIER___ 12 | 13 | -(id)init 14 | { 15 | if ((self = [super init])) 16 | { 17 | } 18 | 19 | return self; 20 | } 21 | 22 | @end -------------------------------------------------------------------------------- /templates/Command-line Tool.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Command-line Tool.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Command-line Tool.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.commandLineTool 9 | Concrete 10 | 11 | Description 12 | This template builds a command-line tool. 13 | Ancestors 14 | 15 | com.kokoabim.iosopendev.base 16 | 17 | Targets 18 | 19 | 20 | SharedSettings 21 | 22 | INSTALL_PATH 23 | /usr/bin 24 | 25 | ProductType 26 | com.apple.product-type.tool 27 | BuildPhases 28 | 29 | 30 | Class 31 | Sources 32 | 33 | 34 | Class 35 | Frameworks 36 | 37 | 38 | ShellScript 39 | /opt/iOSOpenDev/bin/iosod --xcbp 40 | ShellPath 41 | /bin/sh 42 | RunOnlyForDeploymentPostprocessing 43 | 44 | Class 45 | ShellScript 46 | 47 | 48 | 49 | 50 | Options 51 | 52 | 53 | SortOrder 54 | 1 55 | NotPersisted 56 | 57 | Identifier 58 | commandLineType 59 | Name 60 | Type 61 | Description 62 | The type of command-line tool to create. 63 | Default 64 | C 65 | Type 66 | popup 67 | Units 68 | 69 | C 70 | 71 | Nodes 72 | 73 | main.c:comments 74 | main.c:include 75 | main.c:main:content 76 | 77 | Definitions 78 | 79 | main.c:include 80 | #include <stdio.h> 81 | 82 | main.c:main:content 83 | // insert code here... 84 | printf("Hello, World!\n"); 85 | 86 | 87 | 88 | C++ 89 | 90 | Nodes 91 | 92 | main.cpp:comments 93 | main.cpp:include 94 | main.cpp:main:content 95 | 96 | Definitions 97 | 98 | main.cpp:include 99 | #include <iostream> 100 | 101 | main.cpp:main:content 102 | // insert code here... 103 | std::cout << "Hello, World!\n"; 104 | 105 | 106 | 107 | Core Data 108 | 109 | Project 110 | 111 | SharedSettings 112 | 113 | GCC_ENABLE_OBJC_GC 114 | required 115 | OTHER_LDFLAGS 116 | 117 | -Wl,-segalign,4000 118 | 119 | 120 | 121 | Targets 122 | 123 | 124 | SharedSettings 125 | 126 | GCC_PRECOMPILE_PREFIX_HEADER 127 | YES 128 | GCC_PREFIX_HEADER 129 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 130 | 131 | Frameworks 132 | 133 | CoreData 134 | Foundation 135 | 136 | 137 | 138 | Nodes 139 | 140 | main.m:comments 141 | main.m:include 142 | main.m:main:content 143 | main.m:coreData 144 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 145 | ___PACKAGENAME___-Prefix.pch:objC:importCoreData 146 | ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld 147 | 148 | Definitions 149 | 150 | main.m:include 151 | NSManagedObjectModel *managedObjectModel(void); 152 | NSManagedObjectContext *managedObjectContext(void); 153 | 154 | main.m:main:content 155 | @autoreleasepool 156 | { 157 | // Create the managed object context 158 | NSManagedObjectContext *context = managedObjectContext(); 159 | 160 | // Custom code here... 161 | // Save the managed object context 162 | NSError *error = nil; 163 | if (![context save:&error]) { 164 | NSLog(@"Error while saving %@", ([error localizedDescription] != nil) ? [error localizedDescription] : @"Unknown Error"); 165 | exit(1); 166 | } 167 | } 168 | 169 | main.m:coreData 170 | NSManagedObjectModel *managedObjectModel() { 171 | 172 | static NSManagedObjectModel *model = nil; 173 | 174 | if (model != nil) { 175 | return model; 176 | } 177 | 178 | NSString *path = [[[NSProcessInfo processInfo] arguments] objectAtIndex:0]; 179 | path = [path stringByDeletingPathExtension]; 180 | NSURL *modelURL = [NSURL fileURLWithPath:[path stringByAppendingPathExtension:@"momd"]]; 181 | model = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 182 | 183 | return model; 184 | } 185 | 186 | NSManagedObjectContext *managedObjectContext() { 187 | 188 | static NSManagedObjectContext *context = nil; 189 | if (context != nil) { 190 | return context; 191 | } 192 | 193 | @autoreleasepool 194 | { 195 | context = [[NSManagedObjectContext alloc] init]; 196 | 197 | NSPersistentStoreCoordinator *coordinator = ___RP___[[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel()]___AR___; 198 | [context setPersistentStoreCoordinator:coordinator]; 199 | 200 | NSString *STORE_TYPE = NSSQLiteStoreType; 201 | 202 | NSString *path = [[[NSProcessInfo processInfo] arguments] objectAtIndex:0]; 203 | path = [path stringByDeletingPathExtension]; 204 | NSURL *url = [NSURL fileURLWithPath:[path stringByAppendingPathExtension:@"sqlite"]]; 205 | 206 | NSError *error; 207 | NSPersistentStore *newStore = [coordinator addPersistentStoreWithType:STORE_TYPE configuration:nil URL:url options:nil error:&error]; 208 | 209 | if (newStore == nil) { 210 | NSLog(@"Store Configuration Failure %@", ([error localizedDescription] != nil) ? [error localizedDescription] : @"Unknown Error"); 211 | } 212 | } 213 | return context; 214 | } 215 | 216 | ___PACKAGENAME___-Prefix.pch:objC:importCoreData 217 | #import <CoreData/CoreData.h> 218 | ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld 219 | 220 | Path 221 | ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld 222 | 223 | 224 | 225 | Core Foundation 226 | 227 | Targets 228 | 229 | 230 | Frameworks 231 | 232 | CoreFoundation 233 | 234 | 235 | 236 | Nodes 237 | 238 | main.c:comments 239 | main.c:include 240 | main.c:main:content 241 | 242 | Definitions 243 | 244 | main.c:include 245 | #include <CoreFoundation/CoreFoundation.h> 246 | 247 | main.c:main:content 248 | // insert code here... 249 | CFShow(CFSTR("Hello, World!\n")); 250 | 251 | 252 | 253 | Core Services 254 | 255 | Targets 256 | 257 | 258 | Frameworks 259 | 260 | CoreServices 261 | 262 | 263 | 264 | Nodes 265 | 266 | main.c:comments 267 | main.c:include 268 | main.c:main:content 269 | 270 | Definitions 271 | 272 | main.c:include 273 | #include <CoreServices/CoreServices.h> 274 | 275 | main.c:main:content 276 | // insert code here... 277 | printf("Hello, World!\n"); 278 | 279 | 280 | 281 | Foundation 282 | 283 | Targets 284 | 285 | 286 | SharedSettings 287 | 288 | GCC_PRECOMPILE_PREFIX_HEADER 289 | YES 290 | GCC_PREFIX_HEADER 291 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 292 | 293 | Frameworks 294 | 295 | Foundation 296 | 297 | 298 | 299 | Nodes 300 | 301 | main.m:comments 302 | main.m:include 303 | main.m:main:content 304 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 305 | 306 | Definitions 307 | 308 | main.m:include 309 | #import <Foundation/Foundation.h> 310 | 311 | main.m:main:content 312 | @autoreleasepool 313 | { 314 | // insert code here... 315 | NSLog(@"Hello, World!"); 316 | } 317 | 318 | 319 | 320 | 321 | 322 | 323 | Nodes 324 | 325 | Package/DEBIAN/control:debianControl:section 326 | Package/DEBIAN/control:debianControl:depends 327 | Package/usr/bin/0xdeadfa11 328 | 329 | Definitions 330 | 331 | Package/usr/bin/0xdeadfa11 332 | 333 | Group 334 | 335 | Package 336 | usr 337 | bin 338 | 339 | Beginning 340 | 341 | This file was created only to help build the project's group structure, and it can now be deleted. 342 | 343 | Why 0xdeadfa11? See http://developer.apple.com/library/ios/#technotes/tn2151/_index.html. 344 | 345 | *:debianControl:section 346 | Section: System 347 | *:debianControl:depends 348 | Depends: firmware (>= 5.0) 349 | *:main 350 | 351 | Beginning 352 | int main (int argc, const char * argv[]) 353 | { 354 | 355 | End 356 | return 0; 357 | } 358 | 359 | Indent 360 | 1 361 | 362 | *:*:importFoundation 363 | #import <Foundation/Foundation.h> 364 | 365 | 366 | 367 | 368 | -------------------------------------------------------------------------------- /templates/Command-line Tool.xctemplate/___PACKAGENAMEASIDENTIFIER___.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /templates/Command-line Tool.xctemplate/___PACKAGENAMEASIDENTIFIER___.xcdatamodeld/___PACKAGENAMEASIDENTIFIER___.xcdatamodel/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | ___PACKAGENAMEASIDENTIFIER___.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/Command-line Tool.xctemplate/___PACKAGENAMEASIDENTIFIER___.xcdatamodeld/___PACKAGENAMEASIDENTIFIER___.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /templates/Debian Package.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Debian Package.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Debian Package.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.debianPackage 9 | Targets 10 | 11 | 12 | SharedSettings 13 | 14 | iOSOpenDevBuildPackageOnAnyBuild 15 | NO 16 | iOSOpenDevUsePackageVersionPList 17 | YES 18 | 19 | 20 | 21 | Nodes 22 | 23 | Package/DEBIAN/control.txt 24 | Package/DEBIAN/control 25 | Package/DEBIAN/control:debianControl 26 | PackageVersion.plist 27 | 28 | Definitions 29 | 30 | Package/DEBIAN/control.txt 31 | 32 | Group 33 | 34 | Package 35 | DEBIAN 36 | 37 | Beginning 38 | 39 | The control file in the same directory as this file is the Debian control file that is needed 40 | to build the project's Debian package that's used by APT repositories like Cydia. 41 | 42 | For more on... 43 | Debian packages, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html. 44 | Debian control files, see http://www.debian.org/doc/debian-policy/ch-controlfields.html. 45 | Cydia packages, see http://www.saurik.com/id/7. 46 | 47 | Note: This file (control.txt) was created only to provide an explaination about the Debian control file. This file can now be deleted. 48 | 49 | Package/DEBIAN/control 50 | 51 | Group 52 | 53 | Package 54 | DEBIAN 55 | 56 | 57 | *:debianControl 58 | 59 | Beginning 60 | Package: ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 61 | Name: ___VARIABLE_productName___ 62 | Version: 0.1-1 63 | Description: 64 | End 65 | Conflicts: 66 | Replaces: 67 | Priority: optional 68 | Architecture: iphoneos-arm 69 | Author: ___FULLUSERNAME___ 70 | dev: 71 | Homepage: 72 | Depiction: 73 | Maintainer: 74 | Icon: 75 | 76 | 77 | Package/DEBIAN/preinst 78 | 79 | Group 80 | 81 | Package 82 | DEBIAN 83 | 84 | Beginning 85 | #!/bin/sh 86 | 87 | # This script is executed BEFORE the Debian package is INSTALLED 88 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 89 | 90 | 91 | Package/DEBIAN/postinst 92 | 93 | Group 94 | 95 | Package 96 | DEBIAN 97 | 98 | Beginning 99 | #!/bin/sh 100 | 101 | # This script is executed AFTER the Debian package is INSTALLED 102 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 103 | 104 | 105 | Package/DEBIAN/prerm 106 | 107 | Group 108 | 109 | Package 110 | DEBIAN 111 | 112 | Beginning 113 | #!/bin/sh 114 | 115 | # This script is executed BEFORE the Debian package is REMOVED 116 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 117 | 118 | 119 | Package/DEBIAN/postrm 120 | 121 | Group 122 | 123 | Package 124 | DEBIAN 125 | 126 | Beginning 127 | #!/bin/sh 128 | 129 | # This script is executed AFTER the Debian package is REMOVED 130 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 131 | 132 | 133 | PackageVersion.plist 134 | 135 | Group 136 | 137 | Supporting Files 138 | 139 | Beginning 140 | <?xml version="1.0" encoding="UTF-8"?> 141 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 142 | <plist version="1.0"> 143 | <dict> 144 | <key>Major</key> 145 | <string>1</string> 146 | <key>Minor</key> 147 | <string>0</string> 148 | <key>BugFix</key> 149 | <string></string> 150 | <key>Stage</key> 151 | <string></string> 152 | <key>PackageRevision</key> 153 | <string>1</string> 154 | </dict> 155 | </plist> 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /templates/Empty Project.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Empty Project.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Empty Project.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.emptyProject 9 | Concrete 10 | 11 | Description 12 | This is an empty project with no files, targets, or build configurations. 13 | ProjectOnly 14 | 15 | Platforms 16 | 17 | com.apple.platform.iphoneos 18 | 19 | Options 20 | 21 | 22 | Identifier 23 | productName 24 | Required 25 | 26 | Name 27 | Product Name 28 | NotPersisted 29 | 30 | Description 31 | Your new product's name. 32 | EmptyReplacement 33 | ProductName 34 | Type 35 | text 36 | 37 | 38 | Project 39 | 40 | SharedSettings 41 | 42 | EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES 43 | *.nib *.lproj *.gch (*) .DS_Store CVS .svn .git .hg *.xcodeproj *.xcode *.pbproj *.pbxproj 44 | HEADER_SEARCH_PATHS 45 | $(iOSOpenDevPath)/include/** 46 | LIBRARY_SEARCH_PATHS 47 | $(iOSOpenDevPath)/lib/** 48 | iOSOpenDevPath 49 | /opt/iOSOpenDev 50 | IPHONEOS_DEPLOYMENT_TARGET 51 | latest_iphoneos 52 | 53 | SDK 54 | iphoneos 55 | Configurations 56 | 57 | Debug 58 | 59 | Release 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /templates/Logos Tweak.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Logos Tweak.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Logos Tweak.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.logosTweak 9 | Concrete 10 | 11 | Description 12 | This template builds a Logos-based Substrate Tweak. 13 | Ancestors 14 | 15 | com.kokoabim.iosopendev.base 16 | com.kokoabim.iosopendev.unitTests 17 | 18 | Targets 19 | 20 | 21 | ProductType 22 | com.apple.product-type.library.dynamic 23 | SharedSettings 24 | 25 | SIMJECT 26 | NO 27 | INSTALL_PATH 28 | /Library/MobileSubstrate/DynamicLibraries 29 | DYLIB_CURRENT_VERSION 30 | 1 31 | DYLIB_COMPATIBILITY_VERSION 32 | 1 33 | GCC_PREFIX_HEADER 34 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 35 | GCC_PRECOMPILE_PREFIX_HEADER 36 | YES 37 | CLANG_ENABLE_OBJC_ARC 38 | YES 39 | ENABLE_BITCODE 40 | NO 41 | OTHER_LDFLAGS 42 | 43 | -Wl,-segalign,4000 44 | 45 | 46 | BuildPhases 47 | 48 | 49 | ShellScript 50 | /opt/iOSOpenDev/bin/iosod --xcbp-logos 51 | ShellPath 52 | /bin/sh 53 | RunOnlyForDeploymentPostprocessing 54 | 55 | Class 56 | ShellScript 57 | 58 | 59 | ShellScript 60 | /opt/iOSOpenDev/bin/iosod --arm64e-legacy-prebuild 61 | ShellPath 62 | /bin/sh 63 | RunOnlyForDeploymentPostprocessing 64 | 65 | Class 66 | ShellScript 67 | 68 | 69 | Class 70 | Sources 71 | 72 | 73 | Class 74 | Frameworks 75 | 76 | 77 | Class 78 | Headers 79 | 80 | 81 | ShellScript 82 | /opt/iOSOpenDev/bin/iosod --arm64e-legacy-postbuild 83 | ShellPath 84 | /bin/sh 85 | RunOnlyForDeploymentPostprocessing 86 | 87 | Class 88 | ShellScript 89 | 90 | 91 | ShellScript 92 | /opt/iOSOpenDev/bin/iosod --simject-helper 93 | ShellPath 94 | /bin/sh 95 | RunOnlyForDeploymentPostprocessing 96 | 97 | Class 98 | ShellScript 99 | 100 | 101 | Frameworks 102 | 103 | Foundation 104 | 105 | 106 | 107 | Nodes 108 | 109 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 110 | ___PACKAGENAMEASIDENTIFIER___.xm 111 | ___PACKAGENAMEASIDENTIFIER___.mm 112 | Package/DEBIAN/control:debianControl:section 113 | Package/DEBIAN/control:debianControl:depends 114 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 115 | 116 | Definitions 117 | 118 | ___PACKAGENAMEASIDENTIFIER___.xm 119 | 120 | Path 121 | ___PACKAGENAMEASIDENTIFIER___.xm 122 | 123 | ___PACKAGENAMEASIDENTIFIER___.mm 124 | 125 | Path 126 | ___PACKAGENAMEASIDENTIFIER___.mm 127 | 128 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 129 | 130 | Group 131 | 132 | Package 133 | Library 134 | MobileSubstrate 135 | DynamicLibraries 136 | 137 | Beginning 138 | <?xml version="1.0" encoding="UTF-8"?> 139 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 140 | <plist version="1.0"> 141 | <dict> 142 | <key>Filter</key> 143 | <dict> 144 | <key>Bundles</key> 145 | <array> 146 | <string>com.apple.springboard</string> 147 | </array> 148 | </dict> 149 | </dict> 150 | </plist> 151 | 152 | *:debianControl:section 153 | Section: System 154 | *:debianControl:depends 155 | Depends: firmware (>= 9.0), mobilesubstrate 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /templates/Logos Tweak.xctemplate/___PACKAGENAMEASIDENTIFIER___.mm: -------------------------------------------------------------------------------- 1 | 2 | // *** DO NOT EDIT THIS FILE! *** 3 | // This file is generated by Logos processing using ___PACKAGENAMEASIDENTIFIER___.xm during each build. 4 | 5 | // Logos by Dustin Howett 6 | // See http://iphonedevwiki.net/index.php/Logos 7 | -------------------------------------------------------------------------------- /templates/Logos Tweak.xctemplate/___PACKAGENAMEASIDENTIFIER___.xm: -------------------------------------------------------------------------------- 1 | 2 | // Logos by Dustin Howett 3 | // See http://iphonedevwiki.net/index.php/Logos 4 | 5 | #error iOSOpenDev post-project creation from template requirements (remove these lines after completed) -- \ 6 | Link to libsubstrate.dylib: \ 7 | (1) go to TARGETS > Build Phases > Link Binary With Libraries and add /opt/theos/vendor/lib/libsubstrate.tbd \ 8 | (2) remove these lines from *.xm files (not *.mm files as they're automatically generated from *.xm files) 9 | 10 | %hook ClassName 11 | 12 | + (id)sharedInstance 13 | { 14 | %log; 15 | 16 | return %orig; 17 | } 18 | 19 | - (void)messageWithNoReturnAndOneArgument:(id)originalArgument 20 | { 21 | %log; 22 | 23 | %orig(originalArgument); 24 | 25 | // or, for exmaple, you could use a custom value instead of the original argument: %orig(customValue); 26 | } 27 | 28 | - (id)messageWithReturnAndNoArguments 29 | { 30 | %log; 31 | 32 | id originalReturnOfMessage = %orig; 33 | 34 | // for example, you could modify the original return value before returning it: [SomeOtherClass doSomethingToThisObject:originalReturnOfMessage]; 35 | 36 | return originalReturnOfMessage; 37 | } 38 | 39 | %end 40 | -------------------------------------------------------------------------------- /templates/ManPage.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/ManPage.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/ManPage.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.manPage 9 | Options 10 | 11 | 12 | SortOrder 13 | 2 14 | Default 15 | false 16 | NotPersisted 17 | 18 | Identifier 19 | includeManPage 20 | Name 21 | Include Man Page 22 | Description 23 | Indicates whether a man page should be included. 24 | Type 25 | checkbox 26 | Units 27 | 28 | true 29 | 30 | 31 | Nodes 32 | 33 | ___PACKAGENAMEASIDENTIFIER___.1 34 | 35 | Targets 36 | 37 | 38 | BuildPhases 39 | 40 | 41 | Class 42 | CopyFiles 43 | DstPath 44 | /usr/share/man/man1/ 45 | DstSubfolderSpec 46 | 0 47 | RunOnlyForDeploymentPostprocessing 48 | YES 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | Definitions 59 | 60 | ___PACKAGENAMEASIDENTIFIER___.1 61 | 62 | Path 63 | ___PACKAGENAMEASIDENTIFIER___.1 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /templates/ManPage.xctemplate/___PACKAGENAMEASIDENTIFIER___.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd ___DATE___ \" DATE 7 | .Dt ___PACKAGENAME___ 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm ___PACKAGENAME___, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/PreferenceLoader Bundle.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.preferenceLoaderBundle 9 | Targets 10 | 11 | 12 | ProductType 13 | com.apple.product-type.bundle 14 | SharedSettings 15 | 16 | GCC_PREFIX_HEADER 17 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 18 | GCC_PRECOMPILE_PREFIX_HEADER 19 | YES 20 | INFOPLIST_FILE 21 | ___PACKAGENAME___/___PACKAGENAME___-Info.plist 22 | WRAPPER_EXTENSION 23 | bundle 24 | INSTALL_PATH 25 | /Library/PreferenceBundles 26 | 27 | BuildPhases 28 | 29 | 30 | Class 31 | Sources 32 | 33 | 34 | Class 35 | Frameworks 36 | 37 | 38 | Class 39 | Headers 40 | 41 | 42 | ShellScript 43 | /opt/iOSOpenDev/bin/iosod --xcbp 44 | ShellPath 45 | /bin/sh 46 | RunOnlyForDeploymentPostprocessing 47 | 48 | Class 49 | ShellScript 50 | 51 | 52 | Frameworks 53 | 54 | Foundation 55 | UIKit 56 | Preferences 57 | 58 | 59 | 60 | Ancestors 61 | 62 | com.kokoabim.iosopendev.base 63 | 64 | Nodes 65 | 66 | ___PACKAGENAMEASIDENTIFIER___-Info.plist 67 | ___PACKAGENAMEASIDENTIFIER___Controller.h 68 | ___PACKAGENAMEASIDENTIFIER___Controller.m 69 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___.plist 70 | Package/Library/PreferenceBundles/___PACKAGENAME___.bundle/___PACKAGENAMEASIDENTIFIER___.plist 71 | Package/Library/PreferenceBundles/___PACKAGENAME___.bundle/___PACKAGENAMEASIDENTIFIER___Icon.png 72 | Package/Library/PreferenceBundles/___PACKAGENAME___.bundle/___PACKAGENAMEASIDENTIFIER___Icon@2x.png 73 | Package/var/mobile/Library/Preferences/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___PACKAGENAMEASIDENTIFIER___.plist 74 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 75 | ___PACKAGENAME___-Prefix.pch:objC:importCocoa 76 | Package/DEBIAN/control:debianControl:section 77 | Package/DEBIAN/control:debianControl:depends 78 | 79 | Definitions 80 | 81 | ___PACKAGENAMEASIDENTIFIER___Controller.h 82 | 83 | Path 84 | ___PACKAGENAMEASIDENTIFIER___Controller.h 85 | 86 | ___PACKAGENAMEASIDENTIFIER___Controller.m 87 | 88 | Path 89 | ___PACKAGENAMEASIDENTIFIER___Controller.m 90 | 91 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___.plist 92 | 93 | Group 94 | 95 | Package 96 | Library 97 | PreferenceLoader 98 | Preferences 99 | 100 | Path 101 | ___PACKAGENAMEASIDENTIFIER___-PreferenceLoader.plist 102 | 103 | Package/Library/PreferenceBundles/___PACKAGENAME___.bundle/___PACKAGENAMEASIDENTIFIER___.plist 104 | 105 | Group 106 | 107 | Package 108 | Library 109 | PreferenceBundles 110 | ___PACKAGENAME___.bundle 111 | 112 | Path 113 | ___PACKAGENAMEASIDENTIFIER___-PreferenceBundles.plist 114 | 115 | Package/Library/PreferenceBundles/___PACKAGENAME___.bundle/___PACKAGENAMEASIDENTIFIER___Icon.png 116 | 117 | Group 118 | 119 | Package 120 | Library 121 | PreferenceBundles 122 | ___PACKAGENAME___.bundle 123 | 124 | Path 125 | ___PACKAGENAMEASIDENTIFIER___Icon.png 126 | 127 | Package/Library/PreferenceBundles/___PACKAGENAME___.bundle/___PACKAGENAMEASIDENTIFIER___Icon@2x.png 128 | 129 | Group 130 | 131 | Package 132 | Library 133 | PreferenceBundles 134 | ___PACKAGENAME___.bundle 135 | 136 | Path 137 | ___PACKAGENAMEASIDENTIFIER___Icon@2x.png 138 | 139 | Package/var/mobile/Library/Preferences/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___PACKAGENAMEASIDENTIFIER___.plist 140 | 141 | Group 142 | 143 | Package 144 | var 145 | mobile 146 | Library 147 | Preferences 148 | 149 | Path 150 | ___PACKAGENAMEASIDENTIFIER___-Preferences.plist 151 | 152 | ___PACKAGENAMEASIDENTIFIER___-Info.plist 153 | 154 | Group 155 | Supporting Files 156 | Path 157 | ___PACKAGENAMEASIDENTIFIER___-Info.plist 158 | 159 | *:debianControl:section 160 | Section: PreferenceBundles 161 | *:debianControl:depends 162 | Depends: firmware (>= 5.0), mobilesubstrate, preferenceloader 163 | 164 | Concrete 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | NSPrincipalClass 22 | ___PACKAGENAMEASIDENTIFIER___Controller 23 | 24 | 25 | -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___-PreferenceBundles.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | title 6 | ___PACKAGENAMEASIDENTIFIER___ 7 | items 8 | 9 | 10 | cell 11 | PSGroupCell 12 | isStaticText 13 | 14 | label 15 | Use Preferences File To Get/Set Value 16 | footerText 17 | Example of how to get/set values directly from/to the preferences (plist) file by not calling any code (just how non-bundles do so). 18 | 19 | 20 | cell 21 | PSSwitchCell 22 | default 23 | 24 | key 25 | SwitchExample 26 | label 27 | Switch 28 | PostNotification 29 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___PACKAGENAMEASIDENTIFIER___.settingsChanged 30 | defaults 31 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___PACKAGENAMEASIDENTIFIER___ 32 | 33 | 34 | cell 35 | PSGroupCell 36 | isStaticText 37 | 38 | label 39 | Use Code To Get Value 40 | footerText 41 | Example of how to get values from code by sending messages to the bundle's principal class. 42 | 43 | 44 | key 45 | TemplateVersionExample 46 | cell 47 | PSTitleValueCell 48 | get 49 | getValueForSpecifier: 50 | label 51 | Template Version 52 | 53 | 54 | defaults 55 | /System/Library/CoreServices/SystemVersion 56 | key 57 | ProductVersion 58 | cell 59 | PSTitleValueCell 60 | get 61 | getValueForSpecifier: 62 | label 63 | OS Version 64 | 65 | 66 | footerText 67 | Example of how to get/set/use values from/to/in code by sending messages to the bundle's principal class. 68 | cell 69 | PSGroupCell 70 | isStaticText 71 | 72 | label 73 | Use Code To Get/Set/Use Value 74 | 75 | 76 | set 77 | setValue:forSpecifier: 78 | get 79 | getValueForSpecifier: 80 | label 81 | Text 82 | PostNotification 83 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___PACKAGENAMEASIDENTIFIER___.settingsChanged 84 | defaults 85 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___PACKAGENAMEASIDENTIFIER___ 86 | key 87 | TextExample 88 | cell 89 | PSEditTextCell 90 | 91 | 92 | footerText 93 | Perform an action by sending messages to the bundle's principal class. 94 | cell 95 | PSGroupCell 96 | isStaticText 97 | 98 | label 99 | Perform Action 100 | 101 | 102 | action 103 | followOnTwitter: 104 | cell 105 | PSButtonCell 106 | label 107 | Follow Kokoabim 108 | 109 | 110 | action 111 | visitWebSite: 112 | cell 113 | PSButtonCell 114 | label 115 | Visit iOSOpenDev.com 116 | 117 | 118 | action 119 | makeDonation: 120 | cell 121 | PSButtonCell 122 | label 123 | Donate to iOSOpenDev 124 | 125 | 126 | footerText 127 | © ___YEAR___ ___ORGANIZATIONNAME___ 128 | cell 129 | PSGroupCell 130 | isStaticText 131 | 132 | label 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___-PreferenceLoader.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | entry 6 | 7 | bundle 8 | ___PACKAGENAMEASIDENTIFIER___ 9 | cell 10 | PSLinkCell 11 | icon 12 | ___PACKAGENAMEASIDENTIFIER___Icon.png 13 | label 14 | ___PACKAGENAMEASIDENTIFIER___ 15 | isController 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___-Preferences.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // ___FILENAME___ 3 | // ___PACKAGENAME___ 4 | // 5 | // Created by ___FULLUSERNAME___ on ___DATE___. 6 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface ___FILEBASENAMEASIDENTIFIER___ : PSListController 14 | { 15 | } 16 | 17 | - (id)getValueForSpecifier:(PSSpecifier*)specifier; 18 | - (void)setValue:(id)value forSpecifier:(PSSpecifier*)specifier; 19 | - (void)followOnTwitter:(PSSpecifier*)specifier; 20 | - (void)visitWebSite:(PSSpecifier*)specifier; 21 | - (void)makeDonation:(PSSpecifier*)specifier; 22 | 23 | @end -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___Controller.m: -------------------------------------------------------------------------------- 1 | // 2 | // ___FILENAME___ 3 | // ___PACKAGENAME___ 4 | // 5 | // Created by ___FULLUSERNAME___ on ___DATE___. 6 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 7 | // 8 | 9 | #import "___FILEBASENAME___.h" 10 | #import 11 | 12 | #define kSetting_Example_Name @"NameOfAnExampleSetting" 13 | #define kSetting_Example_Value @"ValueOfAnExampleSetting" 14 | 15 | #define kSetting_TemplateVersion_Name @"TemplateVersionExample" 16 | #define kSetting_TemplateVersion_Value @"1.0" 17 | 18 | #define kSetting_Text_Name @"TextExample" 19 | #define kSetting_Text_Value @"Go Red Sox!" 20 | 21 | #define kUrl_FollowOnTwitter @"https://twitter.com/kokoabim" 22 | #define kUrl_VisitWebSite @"http://iosopendev.com" 23 | #define kUrl_MakeDonation @"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=56KLKJLXKM9FS" 24 | 25 | #define kPrefs_Path @"/var/mobile/Library/Preferences" 26 | #define kPrefs_KeyName_Key @"key" 27 | #define kPrefs_KeyName_Defaults @"defaults" 28 | 29 | @implementation ___FILEBASENAMEASIDENTIFIER___ 30 | 31 | - (id)getValueForSpecifier:(PSSpecifier*)specifier 32 | { 33 | id value = nil; 34 | 35 | NSDictionary *specifierProperties = [specifier properties]; 36 | NSString *specifierKey = [specifierProperties objectForKey:kPrefs_KeyName_Key]; 37 | 38 | // get 'value' with code only 39 | if ([specifierKey isEqual:kSetting_TemplateVersion_Name]) 40 | { 41 | value = kSetting_TemplateVersion_Value; 42 | } 43 | else if ([specifierKey isEqual:kSetting_Example_Name]) 44 | { 45 | value = kSetting_Example_Value; 46 | } 47 | // ...or get 'value' from 'defaults' plist or (optionally as a default value) with code 48 | else 49 | { 50 | // get 'value' from 'defaults' plist (if 'defaults' key and file exists) 51 | NSMutableString *plistPath = [[NSMutableString alloc] initWithString:[specifierProperties objectForKey:kPrefs_KeyName_Defaults]]; 52 | #if ! __has_feature(objc_arc) 53 | plistPath = [plistPath autorelease]; 54 | #endif 55 | if (plistPath) 56 | { 57 | NSDictionary *dict = (NSDictionary*)[self initDictionaryWithFile:&plistPath asMutable:NO]; 58 | 59 | id objectValue = [dict objectForKey:specifierKey]; 60 | 61 | if (objectValue) 62 | { 63 | value = [NSString stringWithFormat:@"%@", objectValue]; 64 | NSLog(@"read key '%@' with value '%@' from plist '%@'", specifierKey, value, plistPath); 65 | } 66 | else 67 | { 68 | NSLog(@"key '%@' not found in plist '%@'", specifierKey, plistPath); 69 | } 70 | 71 | #if ! __has_feature(objc_arc) 72 | [dict release]; 73 | #endif 74 | } 75 | 76 | // get default 'value' from code 77 | if (!value) 78 | { 79 | if ([specifierKey isEqual:kSetting_Text_Name]) 80 | { 81 | value = kSetting_Text_Value; 82 | } 83 | else if ([specifierKey isEqual:kSetting_Example_Name]) 84 | { 85 | value = kSetting_Example_Value; 86 | } 87 | } 88 | } 89 | 90 | return value; 91 | } 92 | 93 | - (void)setValue:(id)value forSpecifier:(PSSpecifier*)specifier; 94 | { 95 | NSDictionary *specifierProperties = [specifier properties]; 96 | NSString *specifierKey = [specifierProperties objectForKey:kPrefs_KeyName_Key]; 97 | 98 | // use 'value' with code only 99 | if ([specifierKey isEqual:kSetting_Example_Name]) 100 | { 101 | // do something here with 'value'... 102 | } 103 | // ...or save 'value' to 'defaults' plist and (optionally) with code 104 | else 105 | { 106 | // save 'value' to 'defaults' plist (if 'defaults' key exists) 107 | NSMutableString *plistPath = [[NSMutableString alloc] initWithString:[specifierProperties objectForKey:kPrefs_KeyName_Defaults]]; 108 | #if ! __has_feature(objc_arc) 109 | plistPath = [plistPath autorelease]; 110 | #endif 111 | if (plistPath) 112 | { 113 | NSMutableDictionary *dict = (NSMutableDictionary*)[self initDictionaryWithFile:&plistPath asMutable:YES]; 114 | [dict setObject:value forKey:specifierKey]; 115 | [dict writeToFile:plistPath atomically:YES]; 116 | #if ! __has_feature(objc_arc) 117 | [dict release]; 118 | #endif 119 | 120 | NSLog(@"saved key '%@' with value '%@' to plist '%@'", specifierKey, value, plistPath); 121 | } 122 | 123 | // use 'value' with code 124 | if ([specifierKey isEqual:kSetting_Example_Name]) 125 | { 126 | // do something here with 'value'... 127 | } 128 | } 129 | } 130 | 131 | - (id)initDictionaryWithFile:(NSMutableString**)plistPath asMutable:(BOOL)asMutable 132 | { 133 | if ([*plistPath hasPrefix:@"/"]) 134 | *plistPath = [NSString stringWithFormat:@"%@.plist", *plistPath]; 135 | else 136 | *plistPath = [NSString stringWithFormat:@"%@/%@.plist", kPrefs_Path, *plistPath]; 137 | 138 | Class class; 139 | if (asMutable) 140 | class = [NSMutableDictionary class]; 141 | else 142 | class = [NSDictionary class]; 143 | 144 | id dict; 145 | if ([[NSFileManager defaultManager] fileExistsAtPath:*plistPath]) 146 | dict = [[class alloc] initWithContentsOfFile:*plistPath]; 147 | else 148 | dict = [[class alloc] init]; 149 | 150 | return dict; 151 | } 152 | 153 | - (void)followOnTwitter:(PSSpecifier*)specifier 154 | { 155 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kUrl_FollowOnTwitter]]; 156 | } 157 | 158 | - (void)visitWebSite:(PSSpecifier*)specifier 159 | { 160 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kUrl_VisitWebSite]]; 161 | } 162 | 163 | - (void)makeDonation:(PSSpecifier *)specifier 164 | { 165 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kUrl_MakeDonation]]; 166 | } 167 | 168 | - (id)specifiers 169 | { 170 | if (_specifiers == nil) { 171 | _specifiers = [self loadSpecifiersFromPlistName:@"___PACKAGENAMEASIDENTIFIER___" target:self]; 172 | #if ! __has_feature(objc_arc) 173 | [_specifiers retain]; 174 | #endif 175 | } 176 | 177 | return _specifiers; 178 | } 179 | 180 | - (id)init 181 | { 182 | if ((self = [super init])) 183 | { 184 | } 185 | 186 | return self; 187 | } 188 | 189 | #if ! __has_feature(objc_arc) 190 | - (void)dealloc 191 | { 192 | [super dealloc]; 193 | } 194 | #endif 195 | 196 | @end -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon.png -------------------------------------------------------------------------------- /templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/PreferenceLoader Bundle.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon@2x.png -------------------------------------------------------------------------------- /templates/PreferenceLoader.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/PreferenceLoader.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/PreferenceLoader.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.preferenceLoader 9 | Options 10 | 11 | 12 | SortOrder 13 | 2 14 | Default 15 | false 16 | NotPersisted 17 | 18 | Identifier 19 | includePreferenceLoaderSimple 20 | Name 21 | Include Simple PreferenceLoader 22 | Description 23 | Indicates whether a Simple PreferenceLoader (non-bundle) is included. 24 | Type 25 | checkbox 26 | Units 27 | 28 | true 29 | 30 | 31 | Definitions 32 | 33 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___.plist 34 | 35 | Group 36 | 37 | Package 38 | Library 39 | PreferenceLoader 40 | Preferences 41 | 42 | Path 43 | ___PACKAGENAMEASIDENTIFIER___.plist 44 | 45 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon.png 46 | 47 | Group 48 | 49 | Package 50 | Library 51 | PreferenceLoader 52 | Preferences 53 | 54 | Path 55 | ___PACKAGENAMEASIDENTIFIER___Icon.png 56 | 57 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon@2x.png 58 | 59 | Group 60 | 61 | Package 62 | Library 63 | PreferenceLoader 64 | Preferences 65 | 66 | Path 67 | ___PACKAGENAMEASIDENTIFIER___Icon@2x.png 68 | 69 | 70 | Nodes 71 | 72 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___.plist 73 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon.png 74 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon@2x.png 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /templates/PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | entry 6 | 7 | cell 8 | PSLinkCell 9 | icon 10 | ___PACKAGENAMEASIDENTIFIER___Icon.png 11 | label 12 | ___PACKAGENAMEASIDENTIFIER___ 13 | 14 | items 15 | 16 | 17 | cell 18 | PSGroupCell 19 | isStaticText 20 | 21 | label 22 | Text and Secure Cells 23 | 24 | 25 | cell 26 | PSEditTextCell 27 | default 28 | 29 | defaults 30 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 31 | key 32 | EditTextCell1 33 | label 34 | Text 35 | placeholder 36 | Any Text Here 37 | PostNotification 38 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 39 | 40 | 41 | cell 42 | PSSecureEditTextCell 43 | default 44 | 45 | defaults 46 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 47 | key 48 | SecureEditTextCell2 49 | label 50 | Secure 51 | PostNotification 52 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 53 | 54 | 55 | cell 56 | PSGroupCell 57 | footerText 58 | Place text here to provide additional information about the cells above. 59 | 60 | 61 | cell 62 | PSGroupCell 63 | isStaticText 64 | 65 | label 66 | Numeric Cells 67 | 68 | 69 | cell 70 | PSEditTextCell 71 | default 72 | 73 | defaults 74 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 75 | key 76 | EditTextCell3 77 | keyboard 78 | phone 79 | label 80 | Phone 81 | placeholder 82 | Phone Number 83 | PostNotification 84 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 85 | 86 | 87 | cell 88 | PSEditTextCell 89 | default 90 | 91 | defaults 92 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 93 | key 94 | EditTextCel4 95 | keyboard 96 | numbers 97 | label 98 | Numeric 99 | placeholder 100 | Numbers 101 | PostNotification 102 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 103 | 104 | 105 | cell 106 | PSGroupCell 107 | footerText 108 | Place text here to provide additional information about the cells above. 109 | 110 | 111 | cell 112 | PSGroupCell 113 | isStaticText 114 | 115 | label 116 | Switch and Slider Cells 117 | 118 | 119 | cell 120 | PSSwitchCell 121 | default 122 | 123 | defaults 124 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 125 | key 126 | SwitchCell5 127 | label 128 | Switch 129 | PostNotification 130 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 131 | 132 | 133 | cell 134 | PSSliderCell 135 | default 136 | 50 137 | defaults 138 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 139 | key 140 | SliderCell6 141 | min 142 | 1 143 | max 144 | 100 145 | showValue 146 | 147 | PostNotification 148 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 149 | 150 | 151 | cell 152 | PSGroupCell 153 | footerText 154 | Place text here to provide additional information about the cells above. 155 | 156 | 157 | cell 158 | PSGroupCell 159 | isStaticText 160 | 161 | label 162 | List Cell 163 | 164 | 165 | cell 166 | PSLinkListCell 167 | defaults 168 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 169 | key 170 | LinkListCell7 171 | label 172 | List 173 | detail 174 | PSListItemsController 175 | validTitles 176 | 177 | Item 1 178 | Item 2 179 | Item 3 180 | 181 | validValues 182 | 183 | 1 184 | 2 185 | 3 186 | 187 | default 188 | 1 189 | PostNotification 190 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 191 | 192 | 193 | 194 | cell 195 | PSGroupCell 196 | isStaticText 197 | 198 | 199 | 200 | cell 201 | PSGroupCell 202 | footerText 203 | © ___YEAR___ ___ORGANIZATIONNAME___ 204 | 205 | 206 | title 207 | ___PACKAGENAME___ 208 | 209 | 210 | -------------------------------------------------------------------------------- /templates/PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon.png -------------------------------------------------------------------------------- /templates/PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon@2x.png -------------------------------------------------------------------------------- /templates/Unit Tests.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/Unit Tests.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/Unit Tests.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.unitTests 9 | Options 10 | 11 | 12 | SortOrder 13 | 3 14 | NotPersisted 15 | 16 | Identifier 17 | includeUnitTests 18 | Name 19 | Include Unit Tests 20 | Description 21 | Indicates whether a unit test bundle should be included. 22 | Type 23 | checkbox 24 | Units 25 | 26 | true 27 | 28 | 29 | Components 30 | 31 | 32 | Identifier 33 | com.apple.dt.unit.cocoaTouchFrameworkUnitTestBundle 34 | Name 35 | ___PACKAGENAME___Tests 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /templates/XPC Service.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Matchstic/iOSOpenDev/db7fc223cec776fff0f34574b3f8cf7705d0ba56/templates/XPC Service.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /templates/XPC Service.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.kokoabim.iosopendev.xpcService 9 | Concrete 10 | 11 | Description 12 | This template builds an XPC service that runs via a launch daemon. 13 | Ancestors 14 | 15 | com.kokoabim.iosopendev.base 16 | com.kokoabim.iosopendev.unitTests 17 | 18 | Targets 19 | 20 | 21 | ProductType 22 | com.apple.product-type.tool 23 | SharedSettings 24 | 25 | GCC_PRECOMPILE_PREFIX_HEADER 26 | YES 27 | GCC_PREFIX_HEADER 28 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 29 | INSTALL_PATH 30 | /usr/bin 31 | 32 | BuildPhases 33 | 34 | 35 | Class 36 | Sources 37 | 38 | 39 | Class 40 | Frameworks 41 | 42 | 43 | Class 44 | Headers 45 | 46 | 47 | ShellScript 48 | /opt/iOSOpenDev/bin/iosod --xcbp 49 | ShellPath 50 | /bin/sh 51 | RunOnlyForDeploymentPostprocessing 52 | 53 | Class 54 | ShellScript 55 | 56 | 57 | Frameworks 58 | 59 | Foundation 60 | 61 | 62 | 63 | Nodes 64 | 65 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 66 | main.m 67 | Package/DEBIAN/control:debianControl:section 68 | Package/DEBIAN/control:debianControl:depends 69 | Package/Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist 70 | Package/Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist:XPC 71 | Package/DEBIAN/postinst 72 | Package/DEBIAN/prerm 73 | 74 | Definitions 75 | 76 | main.m 77 | 78 | Path 79 | main.m 80 | 81 | Package/Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist 82 | 83 | Beginning 84 | <?xml version="1.0" encoding="UTF-8"?> 85 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 86 | <plist version="1.0"> 87 | <dict> 88 | 89 | End 90 | </dict> 91 | </plist> 92 | Indent 93 | 1 94 | Group 95 | 96 | Package 97 | Library 98 | LaunchDaemons 99 | 100 | TargetIndices 101 | 102 | SubstituteMacros 103 | 104 | 105 | Package/Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist:XPC 106 | <key>Label</key> 107 | <string>___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___</string> 108 | <key>MachServices</key> 109 | <dict> 110 | <key>___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___</key> 111 | <true/> 112 | </dict> 113 | <key>ProgramArguments</key> 114 | <array> 115 | <string>/usr/bin/___PACKAGENAME___</string> 116 | </array> 117 | <key>UserName</key> 118 | <string>mobile</string> 119 | 120 | *:debianControl:section 121 | Section: System 122 | *:debianControl:depends 123 | Depends: firmware (>= 5.0) 124 | Package/DEBIAN/prerm 125 | 126 | Group 127 | 128 | Package 129 | DEBIAN 130 | 131 | Path 132 | prerm 133 | 134 | Package/DEBIAN/postinst 135 | 136 | Group 137 | 138 | Package 139 | DEBIAN 140 | 141 | Path 142 | postinst 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /templates/XPC Service.xctemplate/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // ___FILENAME___ 3 | // ___PACKAGENAME___ 4 | // 5 | // Created by ___FULLUSERNAME___ on ___DATE___. 6 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 7 | // 8 | 9 | // XPC Service: Lightweight helper tool that performs work on behalf of an application. 10 | // see http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingXPCServices.html 11 | 12 | #include // Create a symlink to OSX's SDK. For example, in Terminal run: ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/xpc /opt/iOSOpenDev/include/xpc 13 | #include 14 | 15 | static void ___PACKAGENAMEASIDENTIFIER____peer_event_handler(xpc_connection_t peer, xpc_object_t event) 16 | { 17 | xpc_type_t type = xpc_get_type(event); 18 | if (type == XPC_TYPE_ERROR) { 19 | if (event == XPC_ERROR_CONNECTION_INVALID) { 20 | // The client process on the other end of the connection has either 21 | // crashed or cancelled the connection. After receiving this error, 22 | // the connection is in an invalid state, and you do not need to 23 | // call xpc_connection_cancel(). Just tear down any associated state 24 | // here. 25 | } else if (event == XPC_ERROR_TERMINATION_IMMINENT) { 26 | // Handle per-connection termination cleanup. 27 | } 28 | } else { 29 | assert(type == XPC_TYPE_DICTIONARY); 30 | // Handle the message. 31 | } 32 | } 33 | 34 | static void ___PACKAGENAMEASIDENTIFIER____event_handler(xpc_connection_t peer) 35 | { 36 | // By defaults, new connections will target the default dispatch concurrent queue. 37 | xpc_connection_set_event_handler(peer, ^(xpc_object_t event) { 38 | ___PACKAGENAMEASIDENTIFIER____peer_event_handler(peer, event); 39 | }); 40 | 41 | // This will tell the connection to begin listening for events. If you 42 | // have some other initialization that must be done asynchronously, then 43 | // you can defer this call until after that initialization is done. 44 | xpc_connection_resume(peer); 45 | } 46 | 47 | int main(int argc, const char *argv[]) 48 | { 49 | xpc_connection_t service = xpc_connection_create_mach_service("___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___", 50 | dispatch_get_main_queue(), 51 | XPC_CONNECTION_MACH_SERVICE_LISTENER); 52 | 53 | if (!service) { 54 | NSLog(@"Failed to create service."); 55 | exit(EXIT_FAILURE); 56 | } 57 | 58 | xpc_connection_set_event_handler(service, ^(xpc_object_t connection) { 59 | ___PACKAGENAMEASIDENTIFIER____event_handler(connection); 60 | }); 61 | 62 | xpc_connection_resume(service); 63 | 64 | dispatch_main(); 65 | 66 | // xpc_release(service); 67 | 68 | return EXIT_SUCCESS; 69 | } 70 | -------------------------------------------------------------------------------- /templates/XPC Service.xctemplate/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [[ $1 == upgrade ]]; then 4 | /bin/launchctl unload /Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist 5 | fi 6 | 7 | chown root:wheel /usr/bin/__PACKAGENAME__ 8 | chmod 755 /usr/bin/__PACKAGENAME__ 9 | chown root:wheel /Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist 10 | chmod 644 /Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist 11 | 12 | /bin/launchctl load /Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist 13 | 14 | exit 0 15 | -------------------------------------------------------------------------------- /templates/XPC Service.xctemplate/prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /bin/launchctl unload /Library/LaunchDaemons/___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.plist 4 | 5 | exit 0 6 | --------------------------------------------------------------------------------