文档章节

Writing a SlackBuild script

张俊伟0809
 张俊伟0809
发布于 2014/08/09 06:40
字数 719
阅读 17
收藏 0
点赞 0
评论 0

Setting up build environment

   /home/slackware: The Slackware home directory which is owned by the "packger" group( which root and

user account are the members on the local system.

    /home/slackware/source: which places the whole slackware-source.

    /home/slackware/source/myslackware: This is where puts all packages.

   /home/slackware/source/myslackware/<package> In this directory we build our package

    /home/slackware/packages: where puts all built packages.


Getting started

    Beginning the process of building package with SlackBuild script.

    For this example, we will create a package of latex2html which made website home page.

    creating the directory named <build_environment>/latex2html, getting the most

recent source code release of latex2html and placing it in this directory.

    mkdir <build-environment>/latex2html

    cd <build-environment>/latex2html

 wget http://www.latex2html.org/~latex2ht/current/latex2html-2002-2-1.tar.gz

    touch latex2html.SlackBuild

    touch slack-desc

    Extracting the source code, because we need to look at configure script and late to determine what options we need to pass to it.

    Writing the SlackBuild script

        Initial Setup

            First specifying the interpreter

            #!/bin/sh -e  ('e' option tells shell exit on any error.

            # <you name> revision date yyyy/mm/dd

            # Set initial variables :

             CWD=$(pwd)

            if [ "$TMP" == " " ]; then

               TMP = /tmp

            fi

            # The version which appears in the application's filename

            VERSION = 2012-1-2

        # If the version conflicts with the Slackware package standard
        # The dash character ("-") is not allowed in the VERSION string
        # You can set the PKG_VERSION to something else than VERSION
        PKG_VERSION=2002.2.1 # the version which appears in the package name.

        ARCH=${ARCH:-i486} #The architecture on where your package will biuld
        
        #First digit is the build number. which specifies how many times it has been built,
        #Second string is the short form of authors name, typically three initilas: w
        BUILD=${BUILD: - 1_dvp}
        #The Application's name
        APP=latex2html
        #The installation directory of the package
        PKG=$TMP/package-$APP
        
        #Set SLKCFLAGS, if use old version gcc less than 3.4.x, needing "-mcpu" instead of "mtune"

          if [ "$ARCH" = "i486" ]; then

                SLKCFLAGS = "-02 -match=i486 -mtune=i686"

          elif [ "$ARCH = "x86_64" ]; then

                SLCKFLAGS = "-02 -fPIC"

           fi

        #Exract the source file

        #Deleting the leftover directories id there exists

        rm -fr  $PKG

        mkdir -p $TMP $PKG

        rm -fr $TMP/$APP-$VERSION

        #Change to the $TMP directory

        cd $TMP || exit 1

        #Extract the application source file in TMP

        tar -xzvf $CWD/$APP-$VERSION.tar.gz

        # Change to the Application directory

        cd $APP-$VERSION || exit 1

        chown -R root:root  .

        chmod u+x, go+r-w, a-s .

        #Set configure options

        #If your app  is writen in C++, you will also add line about CXXFLAGS

        CFLAGS="$SLCKFLAGS" \

        ./configure \

        --prefix=/usr \

        --sysconfdir=/etc \

        --localstatedir=/var \

        --with-perl=/usr/bin/perl \

        --enable-eps \

        --enable-gif \

        --enable-png \

        --build=$ARCH-slackware-linux \

        --host=$BUILD-slackware-linux \

        #Compile the source and exit when go wrong

        make || exit

        #Installing everything into the package directory, but exit if go wrong

        make install $PKG || exit

        

        # Install software documentation

        #Create the directory to stored the documentation

        mkdir -p $PKG/usr/doc/$APP-$VERSION

        #Copy documentation to docs directory and change the permission

        cp -a BUGS Changes FAQ INSTALL LICENSE MAINFEST README TODO docs/ $PKG/usr/doc/$APP-$VERSION

        find $PKG/usr/doc/$APP-$VERSION -type  f -exec chmod 644  {} \;

        #We can also place the *.SlackBuild script to the directory

        cat $CWD/$APP.SlackBuild > $PKG/usr/doc/$APP.SlackBuild

        #Create the ./install directory and place the slack-desc in this directory

        mkdir -p $PKG/install

        cp $CWD/slack-desc $PKG/install/slack-desc

        #And doinst.sh to the directory if it exits

        if [ -e doinst.sh.gz ]; then

            zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh

        fi

# Strip some libraries and binaries
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

# Compress man pages if they exist
if [ -d $PKG/usr/man ]; then
 ( cd $PKG/usr/man
 find . -type f -exec gzip -9 {} \;
 for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
 )
fi

# Compress info pages if they exist (and remove the dir file)
if [ -d $PKG/usr/info ]; then
 gzip -9 $PKG/usr/info/*.info
 rm -f $PKG/usr/info/dir
fi

Build the Package

# Build the package
cd $PKG
/sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz


© 著作权归作者所有

共有 人打赏支持
张俊伟0809
粉丝 0
博文 35
码字总数 6255
作品 0
深圳
程序员
JBoss Portlet Bridge 3.3.0.CR1 发布

JBoss Portlet Bridge 3.3.0.CR1 发布了,值得关注的改进有: Upgrade to RichFaces 4.3.4.Final for example portlets. Modify how we remove double encoded ampersand in script urls to......

红薯
2013/11/03
342
0
在浏览器里查看Nginx和PHP-FPM的运行状态

查看Nginx状态 location = /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } curl http://127.0.0.1/nginx_status http://nginx.org/en/docs/http/ngxhttpst......

eechen
2014/12/27
0
1
#!/bin/sh and #!/bin/bash

On Linux and other Unix-like systems you have a choice of multiple shells. The shell is responsible not only for drawing your little prompt, but interpreting your commands, espe......

Oscarfff
2016/03/20
18
0
Xcode Server + Slack = Rockstar Combo for iOS CI/CD

Xcode Server is a Continuous Integration service provided by Apple to analyze, build, test, and archive iOS apps. Xcode Server has been recently inbuilt with Xcode 9, which made......

Shashikant Jagtap
2017/12/12
0
0
zabbix系列zabbix3.4监控nginx

nginx监控要点 需要监控nginx stauts ,使用nginx -V看看是否安装有with-httpstubstatus_module,centos7.x编译安装淘宝tengine-2.1.2](http://blog.51cto.com/yanconggod/1945117) nginx.co......

yanconggod
02/03
0
0
ImageMagick 7.0.7-1 发布,图片处理软件

ImageMagick 7.0.7-1 发布了。ImageMagick 是一个用来创建、编辑、合成图片的软件。它可以读取、转换、写入多种格式的图片。图片切割、颜色替换、各种效果的应用,图片的旋转、组合,文本,直...

达尔文
2017/09/10
1K
2
Configuring Memcached

NewConfiguringServer Square Peg Into Round Hole Updated Jul 14, 2012 by dorma...@rydia.net Commandline Arguments Memcached comes equipped with basic documentation about its comm......

Koma
2016/04/13
0
0
cacti监控不到nginx的状态&cacti升级后监控不到硬盘及内存信息。

/www/netadmin.abc.com/www/htdocs/cacti/scripts/getnginxclientsstatus.pl http://abc.com/NginxStatus/ nginxactive:-1 nginxreading:-1 nginxwriting:-1 nginx_waiting:-1 /www/netadmin......

披着狼皮的羊
2011/03/17
1K
3
system frequently IO writes

First get this script and name it: iodump #!/usr/bin/env perl =pod =head1 NAME iodump - Compute per-PID I/O stats for Linux when iotop/pidstat/iopp are not available. =head1 SYN......

企图穿越
2011/05/04
0
0
自动化端对端测试框架-Protractor How It Works

How It Works Protractor is an end-to-end test framework for AngularJS applications. Protractor is a Node.js program that supports the Jasmine and Mocha test frameworks. Selenium......

dhb_oschina
2016/04/24
29
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

python3.6用的外库遇到的问题

要用到wmi库 pip install wmi 装后不能用还要安装pywin32库。 要用到crypto加密模块安装pip instal pycrypto装后不能用。要安装pycryptodome。...

oisan_
10分钟前
0
0
select, poll, epoll I/O复用介绍

什么是I/O复用? 内核监视多个文件描述符(I/O文件句柄),一旦某个描述符就绪(一般是读就绪或者写就绪),能够通知应用程序进行相应的读写操作。 I/O多路复用又被称为“事件驱动”(比如读写事...

xiaoxlm
11分钟前
0
0
【Spring 系列 给IOC容器添加组件的几种方式总结】

给Spring 注册Bean的几种方式总结。其中使用@Import注解是Spring Boot 完成自动配置的一个核心注解。 1、Spring 中给IOC容器添加组件的几种方式 在Spring的配置文件中,配置Bean(基于XML方式...

HansonReal
12分钟前
3
0
bootstrapTable语言包设置

###方法一引入不同的语言包 <script src="bootstrap-table-zh-CN.js"></script> ###方法二引入全语言包 <script src="bootstrap-table-locale-all.min.js"></script>//然后在初始化前设计默......

momo1987
13分钟前
0
0
Saltstack 常用命令

1、拷贝文件到客户端 # salt 'slaver.test.com' cp.get_file salt://apache.sls /tmp/cp.txt 2、拷贝目录到客户端 # salt 'slaver.test.com' cp.get_dir salt://test /tmp 3、显示存活的客户......

硅谷课堂
13分钟前
0
0
致初学者-如何学好Python这门编程语言?[图]

致初学者-如何学好Python这门编程语言?[图]: 对于很多Python3初学者,往往会面临以下问题:Python2和Python3我该学习哪一个?是否要安装Linux系统学习Python?Python3有各种版本我该安装哪...

原创小博客
16分钟前
1
0
E31---setopt=protected_multilib=false

今天在云服务器上装nginx,需要先安装一些依赖库比如zlib, ,但是安装zlib时候报错。 yum install -y zlib zlib-devel 1 (-y 指的是如果需要选yes no的自动y)下面是报错 Protected multil...

侠客行之石头
20分钟前
0
0
HTTP常见面试题

Http与Https的区别: HTTP 的URL 以http:// 开头,而HTTPS 的URL 以https:// 开头 HTTP 是不安全的,而 HTTPS 是安全的 HTTP 标准端口是80 ,而 HTTPS 的标准端口是443 在OSI 网络模型中,H...

JK_OPERA
22分钟前
0
0
python爬取站长素材网页图片保存到ppt中

网站地址:http://sc.chinaz.com/tupian/index.html 直接上代码: import requestsfrom bs4 import BeautifulSoupfrom pptx import Presentationfrom pptx.util import Inchesimpor......

你为什么不吃药
23分钟前
1
0
Ubuntu 18.04 swap空间的修改

一、准备工作 执行“sudo swapon -s”命令,查看是否已经存在swap file 二、修改swap file # 如果第一步存在swapfile则需要先禁用sudo swapoff /swapfile# 修改swap 空间的大小为2Gs...

Iceberg_XTY
27分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部