[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
zh:slackware:slackbuild_scripts [2023/04/03 07:42 (UTC)] – [概述] dom_kitalzh:slackware:slackbuild_scripts [2023/04/03 09:10 (UTC)] (当前版本) – [创建SlackBuild脚本] dom_kital
行 1: 行 1:
-<note warning>本页面目前由dom_kital进行翻译,如有疑或建议联系dom_kital@outlook.com</note>+<note important>目前(2023年)国内能访SlackBuild脚本的公共仓库,看下方扩展链接</note>
 ====== SlackBuild 脚本 ====== ====== SlackBuild 脚本 ======
  
行 8: 行 8:
 从源代码创建Slackware包的基本过程可以总结如下,然个别差异应具体问题具体分析 从源代码创建Slackware包的基本过程可以总结如下,然个别差异应具体问题具体分析
  
-  - 解压源码压缩包 (通常为以 .tar.gz or .tar.bz2 结尾) 至某一“工作目录下 +   解压源码压缩包 (.tar.gz or .tar.bz2 文件) 至安装目录下 
-  创建名为''slack-desc'' 文件,并以正确的格式描述该软件 +   * 创建名为''slack-desc'' 文件,并以正确的格式描述该软件 
-  如有需要,可自行配置源码或为其打上补丁 +   * 如有需要,可自行配置源码或为其打上补丁 
-  编译/构建源代码生成可执行二进制文件(binary) +   * 编译/构建源代码生成可执行二进制文件(binary) 
-  将程序安装至某临时目录 +   * 将程序安装至某临时目录 
-<note tip>这个步骤可能有点棘手,这取决于构建系统的"make-install"(或类似功能)是如何工作的。\\ 在标准GNU Makefile中,传递给 "make-install命令的"DESTDIR"变量应该足够了。\\ 在不支持该选项的非标准Makefile和构建系统中,这可能涉及修补"Makefile"(或类似文件)或编辑构建系统的构建配置。</note> +<note tip>这个步骤可能有点棘手,这取决于构建系统的''make-install''(或类似功能)是如何工作的。\\ 在标准GNU Makefile中,传递给''make-install''命令的 ''DESTDIR'' 变量应该足够了。\\ 在不支持该选项的非标准Makefile和构建系统中,这可能涉及修补''Makefile''(或类似文件)或编辑构建系统的构建配置。</note> 
-  复制程序的文档或其它必要文件(包括安装后所需脚本)复制到安装目录中的相应子目录中。 +   * 复制程序的技术文档或其它必要文件(包括安装后所需脚本)复制到安装目录中的相应子目录中。 
-<note tip>这些位置应该遵循Slackware用来存储包管理器安装的应用程序的默认目录结构,即 "/usr/"目录下。</note>  +<note tip>这些位置应该遵循Slackware用来存储包管理器安装的应用程序的默认目录结构,即 ''/usr/''目录下。</note>  
-  使用临时目录(安装位置)中的"makepkg"实用工具创建一个Slackware软件包,然后可以使用"installpkg"实用工具进行安装。+   * 使用临时目录(安装位置)中的''makepkg''实用工具创建一个Slackware软件包,然后可以使用''installpkg''实用工具进行安装。
  
-虽然上面的步骤可以自行完成,但这个过程很繁琐且复杂且需要输入很多命令。通过shell脚本实现自动化安装,用户还可以与整个社区共享流程,使用和修改现有的SlackBuild脚本将同一程序升级到新版本也是很有必要的。 +虽然上面的步骤可以手动完成,但这个过程很繁琐,且需要输入很多命令。通过shell脚本实现自动化安装,用户还可以与整个社区共享流程,使用和修改现有的SlackBuild脚本将同一程序升级到新版本也是很有必要的。 
-===== Creating SlackBuild scripts =====+=====  创建SlackBuild脚本  =====
  
-A good hands-on tutorial on creating a SlackBuild script can be found [[http://www.slackwiki.com/Writing_A_SlackBuild_Script|here]], and there are also a few [[http://slackbuilds.org/templates/|templates]] available to get a feeling for what is needed from a script.+欲求优质的SlackBuild打包教程可访问 [[http://www.slackwiki.com/Writing_A_SlackBuild_Script|此处]], 这里还有些 [[http://slackbuilds.org/templates/|模板]] 可供您参考或使用。
  
-However, software may be written in different programming languages, use different build systems, or may even simply be written in an interpreted programming language with no obvious way to "install" it. In such cases, many steps involved in writing a SlackBuild script will differ from the standard way. Blindly copying and pasting commands from other SlackBuild scripts may or may not work.+然而不同的软件可能由不同的语言编译或直接解释(解释型语言)而来,因此''安装过程''并无定法,上面概述并不能概括出所有软件的安装方法,仍需按实际情况来更改脚本内容。请不要盲目地复制粘贴其它SlackBuild脚本,其运行结果是未知的(<del>俺寻思可以</del>)。
  
-It is recommended that anybody who wishes to write a SlackBuild script, study and understand the build system of a software project before attempting to write a SlackBuild script for it. A degree of proficiency in writing shell scripts is also a definite benefit, as it is the practice to use Bourne shell compatible scripts for SlackBuilds. Ideally, simple C projects which use the standard GNU Make system is a good way to start practicing writing SlackBuild scripts. +建议所有SlackBuild作者,在尝试为软件项目编写SlackBuild脚本之前,应先研究并了解其软件的构建系统。 其次,应当熟练掌握shell脚本语法或其它Bash类语法,在Slackware社区中,大多数人常采用Bash语法。理想情况下,使用标准GNU Make系统的简单C项目是开始练习编写SlackBuild脚本的好方法。 
-<note tip>For new script writers, it is a good idea to perform the above steps manually to create the package from source, before actually writing a SlackBuild script. This reduces the chances of bugs and unexpected behaviour in the script.</note> +<note tip>于新手而言,在实际编写SlackBuild脚本之前,应达成上述要求以减少了脚本中出现错误和意外行为的几率。</note>
- +
-Submitting SlackBuild scripts to a public repository such as http://www.slackbuilds.org may additionally require adherence to certain conventions and coding standards. For instance, it would be necessary for the script to determine the target architecture at runtime rather than hard-coding it into the script. These standards attempt to make SlackBuild scripts as portable as possible.+
  
 +将SlackBuild脚本提交到公共存储库,例如http://www.slackbuilds.org可能另需遵守某些约定和编码标准。 \\ 例如,脚本有必要在运行时(runtime)确定目标体系结构,而不是将其硬编码(hard-code)到脚本中。这些标准试图使SlackBuild脚本尽可能地具有可移植性。
  
 ===== SlackBuild 自动生成器===== ===== SlackBuild 自动生成器=====
行 35: 行 34:
 这里有些工具也许能辅助你创建SlackBuild脚本,具体如下所示: 这里有些工具也许能辅助你创建SlackBuild脚本,具体如下所示:
  
-  * [[http://alien.slackbook.org/AST/ | Alien's SlackBuild Toolkit (AST)]] \\ 基于web实现的“向导”工具 by [[wiki:user:alienbob|Eric Hameleers]]+  * [[http://alien.slackbook.org/AST/ | Alien's SlackBuild Toolkit (AST)]] \\ 基于web实现的“向导打包工具 by [[wiki:user:alienbob|Eric Hameleers]]
   * [[http://www.dawoodfall.net/slackbuilds/noversion/mkslack/ | mkslack]] \\ SlackBuild生成脚本 by David Woodfall   * [[http://www.dawoodfall.net/slackbuilds/noversion/mkslack/ | mkslack]] \\ SlackBuild生成脚本 by David Woodfall
  
行 42: 行 41:
   * SlackBuilds 仓库 - http://www.slackbuilds.org/   * SlackBuilds 仓库 - http://www.slackbuilds.org/
   * SlackBuild 模板 - http://slackbuilds.org/templates/   * SlackBuild 模板 - http://slackbuilds.org/templates/
 +  国内能访问的SlackBuild公共存储库:
 +    * SlackBuilds荷兰仓库 - https://slackware.nl/slackbuilds.org/
 +    * SlackBuilds英国仓库 - https://www.slackware.uk/slackbuilds.org
 +    * Alienbob的git仓库 - https://git.slackware.nl/slackbuilds
 +    * SlackwareCN社区仓库 - https://github.com/slackwarecn 
  
- +===== 原著者 ===== 
-===== Sources ===== +  * 最初由  [[wiki:user:vharishankar|V.Harishankar]] 为 ''SlackDocs Wiki'' 项目撰写
-  * Originally written by  [[wiki:user:vharishankar|V.Harishankar]] for the SlackDocs Wiki Project+
  
 <!-- Please do not change anything below this line--> <!-- Please do not change anything below this line-->
 {{tag>slackware slackbuild}} {{tag>slackware slackbuild}}
 zh:slackware:slackbuild_scripts ()