Welcome to the Tiny Core Linux Wiki at tinycorelinux.net!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:creating_extensions [2015/09/20 06:25]
Misalf
wiki:creating_extensions [2017/09/27 06:52] (current)
JustinCB
Line 62: Line 62:
 export LDFLAGS="-Wl,-O1" export LDFLAGS="-Wl,-O1"
 </code> </code>
 +It is OK to use lower architectures in -march and -mtune than the recommended(-march=i386 is OK, and -mtune=i586 and -mtune=i486 and -mtune=i386), however it is not OK to use higher architectures in -march and not recommended to use higher architectures in -mtune (eg. -march=i586).  
  
 Suggested compiler flags on x86_64 (for compatibility; see also [[http://forum.tinycorelinux.net/index.php/topic,14397.0.html|the forum thread]]): Suggested compiler flags on x86_64 (for compatibility; see also [[http://forum.tinycorelinux.net/index.php/topic,14397.0.html|the forum thread]]):
Line 84: Line 85:
  
 Flags Not-allowed (good performance, but likely won't work on other machines): Flags Not-allowed (good performance, but likely won't work on other machines):
-<code bash>-march=native -mtune=native +<code bash>-march=native -mtune=native</code>
-</code>+
  
 On x86_64, [[http://forum.tinycorelinux.net/index.php/topic,14397.0.html|Juanito has suggested]] that additional flags may help reduce size, but this may break some builds: On x86_64, [[http://forum.tinycorelinux.net/index.php/topic,14397.0.html|Juanito has suggested]] that additional flags may help reduce size, but this may break some builds:
Line 106: Line 106:
 </code> </code>
  
-Note: "-j3" is meant for a 2 processor system.  The general guideline is -jN where N is 1 more than the total number of processors available.+Note: "-j3" is meant for a 2 processor system.  The general guideline is -jN where N is 1 more than the total number of processors available, unless you are on a system that supports hyperthreading(which means that the each of the physical processors acts like 2 virtual processors[because the processor does multitasking and so can run 2 processes "at once"]) If your system uses hyperthreading, use the number of physical plus the number of virtual processors(usually twice the physical processors).  
  
 Create/update a date marker just in case your app doesn't support DESTDIR: Create/update a date marker just in case your app doesn't support DESTDIR:
Line 130: Line 130:
 ===== All extension creators please note =====  ===== All extension creators please note ===== 
  
-If you don't need a startup script, then skip the next section. The TC system will create empty tce.installed/package_name files. You can ask for help IRC or on the tce Q&A if you are having issues getting your script working ok.  You may wish to see how others have done it, for x86 see http://www.tinycorelinux.net/4.x/x86/tcz/src/  +If you don't need a startup script, then skip the next section. The TC system will create empty tce.installed/package_name files. You can ask for help IRC or on the tce Q&A if you are having issues getting your script working OK.  You may wish to see how others have done it, for x86 see http://www.tinycorelinux.net/8.x/x86/tcz/src/ or whatever version you have(If you have a newer or older version, replace 8.x with the version you have and/or x86 with your architecture).  
  
 == gutmensch provides the following set of rules: == == gutmensch provides the following set of rules: ==
Line 142: Line 142:
   * [/usr/local]/etc/init.d/xyz scripts are usually system services and not user based services,   * [/usr/local]/etc/init.d/xyz scripts are usually system services and not user based services,
   * ----so the simple set here is: check for root user, if not, just fail.    * ----so the simple set here is: check for root user, if not, just fail. 
 +Most of the time(but not always) this is done automatically by the install script.  
  
 Optional: Optional:
   * If app/service can be run as a normal user (not as root!), make sure your init, start or extensions scripts    * If app/service can be run as a normal user (not as root!), make sure your init, start or extensions scripts 
   * ---are able to handle this. For example, query the $TCUSER variable and set the permissions accordingly when    * ---are able to handle this. For example, query the $TCUSER variable and set the permissions accordingly when 
-  * ---installing the extension. Or reconfigure the software so that it defaults to user writeable directories like $HOME, /tmp, etc.  +  * ---installing the extension. Or reconfigure the software so that it defaults to user writable directories like $HOME, /tmp, etc.  
  
  
Line 153: Line 154:
   * Checkout the checkroot() helper function in /etc/init.d/tc-functions e.g. Try to use sudo in scripts as least as possible.     * Checkout the checkroot() helper function in /etc/init.d/tc-functions e.g. Try to use sudo in scripts as least as possible.  
 reference  http://forum.tinycorelinux.net/index.php/topic,14988.msg85727.html#msg85727 reference  http://forum.tinycorelinux.net/index.php/topic,14988.msg85727.html#msg85727
- 
-== aus9 writes: == 
-  * There are many ways to build extensions. If you prefer the build script way, it is easy to build root:root by running the script as root. Extensions can not be loaded by root powers, so change your script to the following method, you can drop the .tcz off each nameX.tcz     
-  
-<code bash> 
-su -c 'tce-load -i name1 name2' tc 
-</code>     
- 
-  * To use wget as a normal user without leaving root try loading submitqc4 which autoloads wget then run 
- 
-<code bash> 
-su -c '/usr/local/bin/wget -nc http://www.some-site/download/filename.tar.gz -O /tmp/tarball-name.tar.gz' tc 
-</code> 
- 
-  * The wget.tcz is useful when you can't verify certificate so you can add  --no-check-certificate into that last command, while busybox's wget might struggle.   
-  * When you check permissions sym links will show up as 777 which I have been advised is normal behaviour. 
- 
  
 ===== Adding Custom Startup Scripts =====    ===== Adding Custom Startup Scripts =====   
Line 284: Line 268:
 It is easy to leave out a required dependency from your .dep file. Do use base norestore, and check the dependencies in particular.   It is easy to leave out a required dependency from your .dep file. Do use base norestore, and check the dependencies in particular.  
  
-If you are planning on submitting your extension for inclusion in the repository, you should run the [[http://forum.tinycorelinux.net/index.php?topic=2475.0|extension audit script]] as well. The script is now available as an extension called submitqc.tcz. (Remember that if you want to download the script from the forum, you need to be logged in to see the links.)   +If you are planning on submitting your extension for inclusion in the repository,  you should run the extension auditing script, which is in the repository as  submitqc.tcz .
- +
-=====  Submission =====    +
 =====  Separation =====   =====  Separation =====  
  
-Smaller extensions reduce 'bloat' in Tiny Core. To help out:   * move translations and other locale data into a locale extension (myprogram-locale.tcz)   * move documentation and help files into a doc extension (myprogram-doc.tcz)   * rather than including docs in your extension, use the info file to list official online docs.  +Smaller extensions reduce 'bloat' in Tiny Core. To help out:    
 +  * move translations and other locale data into a locale extension (myprogram-locale.tcz)    
 +  * move documentation and help files into a doc extension (myprogram-doc.tcz)    
 +  * rather than including docs in your extension, use the info file to list official online docs.   
 +  * move headers and static libraries to a dev extension(myprogram-dev.tcz)
  
 ===== Required Files =====   ===== Required Files =====  
Line 298: Line 283:
   * a list of its contents (.tcz.list)    * a list of its contents (.tcz.list) 
   * an md5 sum (.tcz.md5.txt)    * an md5 sum (.tcz.md5.txt) 
-  * an info file describing its contents (.tcz.info) - this content is standardized. [[http://distro.ibiblio.org/tinycorelinux/4.x/x86/tcz/|Visit the repository for examples]]. +  * an info file describing its contents (.tcz.info) - this content is standardized. [[http://distro.ibiblio.org/tinycorelinux/8.x/x86/tcz/|Visit the repository for examples]](The link is to the 8.x repository.  If you have a different version, follow the link, and then replace 8.x with whatever version you have[but only the major release eg. 7.x 9.x, not the minor release eg. 8.0, 7.2]). Also see the example below.
   * a dependency list, if necessary (.tcz.dep)    * a dependency list, if necessary (.tcz.dep) 
   * If the source is under the GPL license, include the source as well.     * If the source is under the GPL license, include the source as well.  
-  * a .tcz.zsync (autogenerated with submitqc4 +  * a .tcz.zsync (autogenerated by submitqc)
  
 It is not required, but certainly recommended, that you include any additional build instructions in a plain text file for future reference, mentioning such things as which extensions are required to build the package and what compile flags were used. This can be done in a file named "build-dep". For example, the build-dep file for urxvt looks like this:  It is not required, but certainly recommended, that you include any additional build instructions in a plain text file for future reference, mentioning such things as which extensions are required to build the package and what compile flags were used. This can be done in a file named "build-dep". For example, the build-dep file for urxvt looks like this: 
Line 341: Line 326:
                 Compiled for TC 4.x                                  Compiled for TC 4.x                 
                 ----                    ----   
-                PPI Compatible +                PPI Compatible
 Change-log:     2012/00/01 First version, 0.1 Change-log:     2012/00/01 First version, 0.1
                 2012/01/01 Short change description                  2012/01/01 Short change description 
Line 347: Line 332:
 </code>   </code>  
  
-If the package contains a program, the best choice for its name is the bin name (this will ensure that program start directly if you load package ondemand)Alternatively, it is better to use suffixes on standard name of content instead of prefixes to customize the package name because in the main type of research in appbrowser (&quot;search&quot;) you can only omit final letters. e.g., if the package name is gold_eggs, if I search eggs I do not find it, if I search Gold I find it (case is not important).  +If the package contains a program, the best choice for its name is the bin name (this will ensure that program start directly if you load package ondemand[but you need to make an executable shell script usr/local/tcz.installed/<bin_name> for that to work{make the script then do   chmod +x usr/local/tcz.installed/&lt;bin_name&gt;}])
  
-In field "Comments" string "PPI Compatible" (if the package is compatible with "Persistent Personal Installation" mode, usually if we have used /usr/local directory as a installation prefix) seems no longer to be specified since this type of operation has been removed from 4.x  +In field "Comments" string "PPI Compatible" (if the package is compatible with "Persistent Personal Installation" mode, usually if we have used /usr/local directory as a installation prefix) seems no longer to be specified since this type of operation has been removed from 4.x and later.  Of course, it doesn't break anything to add PPI Compatible, but it can be kind of confusing since it was removed 4 major releases ago!  
  
 ===== .tcz.dep example =====    ===== .tcz.dep example =====   
Line 358: Line 343:
  
 <code> <code>
-apple.tcz banana.tcz +apple.tcz 
 +banana.tcz 
 </code>   </code>  
  
Line 369: Line 355:
 </code>     </code>    
  
-If package has **no dependencies** do not submit any file but in email please alert tcz checker that there are no dependencies.     +If package has **no dependencies** do not submit any file but in email please alert tcz checker that there are no dependencies.  You can also create an empty .tcz.dep file if your extension has no dependencies.  
  
-=====  Send to =====  +=====  Submitting =====  
  
-Have you run the [[http://forum.tinycorelinux.net/index.php?topic=2475.0|extension audit script]to test your extension? If so, create a gzip archive. For example, if all the required files are in one directory, the command would look like this:  +Have you run the extension audit script(submitqcx[where x is the major release of tinycore that you haveor submitqc) to test your extension? If so, create a gzip archive. For example, if all the required files are in one directory, the command would look like this:  
  
 <code bash> <code bash>
 tar zcf extension.tar.gz * tar zcf extension.tar.gz *
 </code>   </code>  
 +
 +Or, alternatively, if you have temporary directories in the directory you put the extensions in, you can use this code(and want more compression):
 +
 +<code bash>
 +tar -cf extension.tar *.tcz*
 +gzip -9 extension.tar
 +</code>
  
 Send the resulting extension.tar.gz file to **tcesubmit _at_ gmail _dot_ com**.   Send the resulting extension.tar.gz file to **tcesubmit _at_ gmail _dot_ com**.  
Print/export