PiSiDo, the packager
Here, I will explain how to make Pardus install packages, called pisi. PiSiDo is a pisi package creation tool for the Pardus. It aims ease package creation to beginners. You can get packaged versions and source code from PiSiDo project site.
Parts of the PiSiDo
Menu : You can find most of the actions at the toolbar. But you should check the menu for hidden ones.
Toolbar : There are three toolbars. One for operations like opening special directories, other for showing or hiding docked windows, and the last one for application and packaging help. I suggest you to open all dock windows for now. As you see like the image above.
Main Package Fields :These are the first section of the required steps. You can define structural information of the package. You should fill all of them whenever you can. If you skip one of required field in here or other places, you probably get a message to fill them and stops building.
There are some special circumstances in here. First of them is Package Name. Package name will be a collection point of your build files as a directory int the specified workspace. Also, you will see a auto copmlete list, if you have preexisting build files. If you select an entry from this list PiSiDo will try to import build files.
Actions Dock Window : In here, we should write a Python script which will define behavioral definition of the packaging steps and define the install files. Pisi packaging system uses some special Python classes which called Actions API. There is a tool button on the toolbar to open the official documentation site. PiSiDo have some templates to ease this step for common build environments. Just select and see what I mean.
History Dock Window : One of the required field is a history entry. You need only one, but you should add for each update to make clear what you did at the past.
Installs Dock Window : Here, we will define which files goes where after installing. There is a default entry which mark all files will goes to under root (it’s not there for now due to a bug. It should compile successful, even empty). You can fill left list with refresh button after a successful build. And than you can mark the files and directories.
Aditionals And Patches Dock Windows : You can put your special files like *.desktop starter files and patch files for code changes at the files directory which is at the build directory. These are optional.
Build Dock Windows : You can find the commands at the last step in the build process . At the beginning of the creation, try to make build files with Only Build Files command. After creating the build files successfully, you can try Build All command. If something is wrong, you will get an error at the command line. Carefully track the process and errors, fix the problem -like adding a missing build dependency, and try to build it again.
Making A Package
Here, I will show how to make a pisi package with PiSiDo. I have randomly chosen a software from KDE Apps that was Minimum Profit. It is a text editor for programmers. Here is a screenshot of the application.
First, we will download the source from the web site, unpack it and search for a README and INSTALL file. After extracting, we see there is only README and it says we can install it with these commands:
$ ./config.sh $ make # make install
We will only try first two steps. If it successfully configure and compile, we can start packaging it. First I will install base development packages to be able to make a compilation (bold ones are my inputs):
$ sudo pisi it -c system.devel
Than, I will try to run configure script with default values:
huseyinkozan@pc mp-5.2.1 $ ./config.sh Configuring... Looking for MPDM... OK (./mpdm) Configuring MPDM... Testing for win32... No Testing for unix-like glob.h... OK Testing for regular expressions... OK (using system one) Testing for unistd.h... OK Testing for sys/types.h... OK Testing for sys/wait.h... OK Testing for sys/stat.h... OK Testing for pwd.h... OK Testing for chown()... OK Testing for gettext... OK Testing for iconv... OK Testing for wcwidth()... OK Testing for file canonicalization... canonicalize_file_name() Testing for nanosleep()... OK Testing for POSIX threads... OK Testing for POSIX semaphores... OK Testing if Grutatxt is installed... No Testing if mp_doccer is installed... which: no mp_doccer in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/bin:/opt/sun-jre/bin) which: no mp-doccer in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/bin:/opt/sun-jre/bin) No Looking for MPSL... OK (./mpsl) Testing for win32... No Testing for ncursesw... OK (ncursesw) Testing for transparency support in curses... OK Testing for wget_wch()... OK Testing for KDE4... Disabled Testing for Qt4... Package QtGui was not found in the pkg-config search path. Perhaps you should add the directory containing `QtGui.pc' to the PKG_CONFIG_PATH environment variable No package 'QtGui' found Package QtGui was not found in the pkg-config search path. Perhaps you should add the directory containing `QtGui.pc' to the PKG_CONFIG_PATH environment variable No package 'QtGui' found No Testing for GTK... No Testing for msgfmt... OK Configured drivers: ncursesw Type 'make' to build Minimum Profit.
As you see, we only get little errors. From here, we can investigate what we can do. Now, I will install qt-devel and gtk2-devel and try to configure again.
$ sudo pisi it qt-devel gtk2-devel .... huseyinkozan@pc mp-5.2.1 $ ./config.sh Configuring... Looking for MPDM... OK (./mpdm) Looking for MPSL... OK (./mpsl) Testing for win32... No Testing for ncursesw... OK (ncursesw) Testing for transparency support in curses... OK Testing for wget_wch()... OK Testing for KDE4... Disabled Testing for Qt4... OK Testing for GTK... Disabled Testing for msgfmt... OK Configured drivers: qt4 ncursesw Type 'make' to build Minimum Profit
GTK does not detected. This is not a problem, because we have a Qt support for graphic environment. Now, lets look at the parameters of the configure script.
huseyinkozan@pc mp-5.2.1 $ ./config.sh --help
Available options:
--prefix=PREFIX Installation prefix (/usr/local).
--without-curses Disable curses (text) interface detection.
--without-gtk Disable GTK interface detection.
--without-win32 Disable win32 interface detection.
--with-kde4 Enable KDE4 interface detection.
--without-qt4 Disable Qt4 interface detection.
--without-unix-glob Disable glob.h usage (use workaround).
--with-included-regex Use included regex code (gnu_regex.c).
--with-pcre Enable PCRE library detection.
--without-gettext Disable gettext usage.
--without-iconv Disable iconv usage.
--without-wcwidth Disable system wcwidth() (use workaround).
--with-null-hash Tell MPDM to use a NULL hashing function.
--mingw32 Build using the mingw32 compiler.
--debian Build for Debian ('make deb').
Environment variables:
CC C Compiler.
AR Library Archiver.
CFLAGS Compile flags (i.e., -O3).
WINDRES MS Windows resource compiler.
We can use some of these parameters to get optimal solution for us. As a note, whenever I need info about the terms that I don’t know, I used search engine and pisi search command. Like this:
huseyinkozan@pc ~ $ pisi sr pcre pcre++ - C++ interface for PCRE library libpcre - Perl-compatible regular expression library libpcre-devel - Development files for libpcre pcre++-devel - Development files for pcre++
As you can see, PCRE is related with regular expression library. So, I will not enable it, because it is not complaining about it. It should probably use it from system (gnu_regex.c). The last shape should be like this:
huseyinkozan@pc mp-5.2.1 $ ./config.sh --prefix=/usr --without-gtk --without-win32 Configuring... Looking for MPDM... OK (./mpdm) Looking for MPSL... OK (./mpsl) Testing for win32... Disabled Testing for ncursesw... OK (ncursesw) Testing for transparency support in curses... OK Testing for wget_wch()... OK Testing for KDE4... Disabled Testing for Qt4... OK Testing for GTK... Disabled Testing for msgfmt... OK Configured drivers: qt4 ncursesw Type 'make' to build Minimum Profit.
Now, lets do a make.
huseyinkozan@pc mp-5.2.1 $ LC_ALL="en_US" make gcc -g -Wall -I. `cat config.cflags` -c mp_core.c moc -o mpv_qt4.moc mpv_qt4.cpp g++ -g -Wall -I. `cat config.cflags` -c mpv_qt4.cpp gcc -g -Wall -I. `cat config.cflags` -c mpv_curses.c ( cd ./mpdm; make ) make[1]: Entering directory `/home/huseyinkozan/indirilenler/mp-5.2.1/mpdm' gcc -g -Wall `cat config.cflags` -c mpdm_v.c gcc -g -Wall `cat config.cflags` -c mpdm_a.c gcc -g -Wall `cat config.cflags` -c mpdm_h.c gcc -g -Wall `cat config.cflags` -c mpdm_d.c gcc -g -Wall `cat config.cflags` -c mpdm_s.c gcc -g -Wall `cat config.cflags` -c mpdm_f.c gcc -g -Wall `cat config.cflags` -c mpdm_r.c gcc -g -Wall `cat config.cflags` -c mpdm_t.c gcc -g -Wall `cat config.cflags` -c gnu_regex.c ar rv libmpdm.a mpdm_v.o mpdm_a.o mpdm_h.o mpdm_d.o mpdm_s.o mpdm_f.o mpdm_r.o mpdm_t.o gnu_regex.o ar: creating libmpdm.a a - mpdm_v.o a - mpdm_a.o a - mpdm_h.o a - mpdm_d.o a - mpdm_s.o a - mpdm_f.o a - mpdm_r.o a - mpdm_t.o a - gnu_regex.o make[1]: Leaving directory `/home/huseyinkozan/indirilenler/mp-5.2.1/mpdm' ( cd ./mpsl; make ) make[1]: Entering directory `/home/huseyinkozan/indirilenler/mp-5.2.1/mpsl' cc `cat config.cflags` -c mpsl_c.c cc `cat config.cflags` -c lex.yy.c -o mpsl_l.o cc `cat config.cflags` -c mpsl_m.c cc `cat config.cflags` -c y.tab.c -o mpsl_y.o cc `cat config.cflags` -c mpsl_f.c cc `cat config.cflags` -c mpsl_d.c ar rv libmpsl.a mpsl_c.o mpsl_l.o mpsl_m.o mpsl_y.o mpsl_f.o mpsl_d.o ar: creating libmpsl.a a - mpsl_c.o a - mpsl_l.o a - mpsl_m.o a - mpsl_y.o a - mpsl_f.o a - mpsl_d.o cc -L. -lmpsl `cat config.ldflags` -o mpsl ../mpdm/libmpdm.a(mpdm_t.o): In function `mpdm_new_semaphore': /home/huseyinkozan/indirilenler/mp-5.2.1/mpdm/mpdm_t.c:190: undefined reference to `sem_init' ../mpdm/libmpdm.a(mpdm_t.o): In function `mpdm_semaphore_wait': /home/huseyinkozan/indirilenler/mp-5.2.1/mpdm/mpdm_t.c:220: undefined reference to `sem_wait' ../mpdm/libmpdm.a(mpdm_t.o): In function `mpdm_semaphore_post': /home/huseyinkozan/indirilenler/mp-5.2.1/mpdm/mpdm_t.c:243: undefined reference to `sem_post' ../mpdm/libmpdm.a(mpdm_t.o): In function `mpdm_exec_thread': /home/huseyinkozan/indirilenler/mp-5.2.1/mpdm/mpdm_t.c:323: undefined reference to `pthread_create' collect2: ld returned 1 exit status make[1]: *** [mpsl] Error 1 make[1]: Leaving directory `/home/huseyinkozan/indirilenler/mp-5.2.1/mpsl' make: *** [mpsl/libmpsl.a] Error 2
I added LC_ALL=”en_US” to change error output language. You don’t need this, just do a make. If we track the error, it starts with an undefined reference to `sem_init’ error in the mdpm/mpdm_t.c, at line 190. From now on, we are diving into the code. Lets see what we have at that line:
#ifdef CONFOPT_POSIXSEMS
sem_t s;
if (sem_init(&s, 0, init_value) == 0) {
size = sizeof(s);
ptr = (char *) &s;
}
#endif
Compiler can not find sem_init reference. So, how can we get rid of it ? Lets find where sem_init and CONFOPT_POSIXSEMS is defined and what are these for. At lines 42 to 44, we have :
#ifdef CONFOPT_POSIXSEMS #include <semaphore.h> #endif
Do we have this header. Lets check.
huseyinkozan@pc ~ $ ls /usr/include/semaphore.h -l -rw-r--r-- 1 root root 2472 Ağu 15 20:05 /usr/include/semaphore.h
Yes we have it. So, where sem_init defined ? I will use Kate text editor (comes with kdesdk) to find this string in files. I found it in config.h. Thats used for POSIX semaphore testing. If we don’t get any error during the configure, our header may be an old version or any other problems. After checking the sem_init at the /usr/include/semaphore.h it seems problem is not here.
Now, lets change our direction to configure.h script and its produces file; Makefile. In the configure.h, most of the stuff is preparing the compilation steps. It define some variables to what is going to be done. In the Makefile, the actual compiling steps is being done. If we check the error agian (you can do a make clean and than make again whenever you want to retry), we see this line before the error:
cc -L. -lmpsl `cat config.ldflags` -o mpsl
The error was about sem_init reference. After trying to add a -lpthread to mpsl/Makefile at line 63 and recompile, voila
It may take a long time while trying, if you don’t know about how things works. Usually, some trial and error helpful. Now, lets run our compiled application.
huseyinkozan@pc mp-5.2.1 $ ./mp-5 File 'mp_core.mpsl' not found in INC
And use the search engine with “File ‘mp_core.mpsl’ not found in INC“, we find here that we should install it to run. Because, application searches its files in the /usr[/local]/share/mp-5 directory.
So far, we all know how to successfully compile our application. Lets do a package for it. First we will fill the main fields from the left, and a initial history field.
As you see, I filled SHA1 value with ones. After running a Build All command, I got the SHA1 value from the command line with this command:
$ sha1sum /var/cache/pisi/archives/mp-5.2.1.tar.gz
After filling the right SHA1 value, give it a try again. Now, we have build files in the workspace/mp directory. Lets see them:
huseyinkozan@pc mp $ tree -a . ├── actions.py ├── files └── pspec.xml 1 directory, 2 files
The pspec.xml file had created with PiSiDo fields that we filled. Now, we will define build steps with actions.py file from the Actions Dock Window. The most proper template is Auto for us. Actually, we will make some modifications on it. We can read and delete unnecessary comment lines.
During the inspection, we know how to do the build steps. First run configuration script, than change mpsl/Makefile, and than run the make command. In the Actions API, there are lots of classes and functions to ease these steps. Some of the basic structure are preexists in the templates.
From now on, you are on your own with tha Actions API ![]()
Read the documentation, look at the example build files from official development packages and try some trial and error approach. Here is the last shape of the actions.py content:
After a successful build, we can mark the installed files.
It’s time install our package.
And run the application.
If you try to find a menu entry in the KDE, you can not. Because th Minimum Profit does not have any menu item. So, we should create one for us. There is a mp.png in the main directory of the source tarball. Copy it to workspace/mp/files directory. And find how to create *.desktop file from internet. I will made it to KDE. Right click on to the my desktop and create a new shortcut with a pixmap in the others section. After right click and open with an editor and edit it :
[Desktop Entry] Comment[tr]=Programcının Metin Düzenleyicisi Comment=Progrmmers Text editor Exec=/usr/bin/mp-5 GenericName[tr]=Programcının Metin Düzenleyicisi GenericName=Progrmmers Text editor Icon=/usr/share/pixmaps/mp.png MimeType= Name[tr]=Minimum Profit Name=Minimum Profit Path= StartupNotify=true Terminal=false TerminalOptions= Type=Application X-DBUS-ServiceName= X-DBUS-StartupType= X-KDE-SubstituteUID=false X-KDE-Username= Categories=Qt;KDE;Development;
You can find examples from your own KDE menu. Just right click it, select a menu item, drag it to your desktop, and open it with an editor. I have two files in the files directory, now.
huseyinkozan@pc files $ cd /home/huseyinkozan/mp huseyinkozan@pc mp $ tree -a . ├── actions.py ├── files │ ├── mp.desktop │ └── mp.png └── pspec.xml 1 directory, 4 files
Now,I will refresh and Aditional Dock Window. The image file should go into the /usr/share/pixmaps and the shortcut file should go into the /usr/share/applications directories to work our menu item properly.
After a rebuild, we should add the /usr/share/applications and /usr/share/pixmaps directories to Installs Dock Windows. And repeat the build step to get package created. We can see the package contents with lspisi command
huseyinkozan@pc ~ $ lspisi mp-5.2.1-1-p11-i686.pisi /usr/bin/mp-5 /usr/bin/mpsl /usr/share/applications/mp.desktop /usr/share/doc/mp-5/AUTHORS /usr/share/doc/mp-5/COPYING /usr/share/doc/mp-5/README ...
We have a new menu item in the Development section of the KDE menu. You can find build files from http://www.pardususer.de/index.php?action=repository&dir=/playground/huseyinkozan/mp and pisi packages from PardusUser.de repository.
Hope this guide helps to make more pisi packages.







It’s a very usefull tutorial ^^^^^ Thank you!!
Great .. pisido rocks