Its a good note on working with RPMS and how to get started in C programming.
What is DWM?
The dwm is a windows manager on Linux. Its advantage is having a window environment, without a mouse and allows easy rearranging of windows across the screen. Here is an example on Nautilus with 2 ST terminals.Each window can be expanded across other windows as shown below.
Installation, build and finally creating the required rpm will create the minimum files and folders as shown below.
Step 1: Install C compiler and minimum libraries
$ sudo yum install gcc gcc-c++ kernel-devel kernel-header make rxvt-unicode
This will include the following packages;
cpp.x86_64 0:4.8.5-28.el7_5.1
gcc-gfortran.x86_64 0:4.8.5-28.el7_5.1
gcc-gnat.x86_64 0:4.8.5-28.el7_5.1
gcc-objc.x86_64 0:4.8.5-28.el7_5.1
gcc-objc++.x86_64 0:4.8.5-28.el7_5.1
libgcc.i686 0:4.8.5-28.el7_5.1
libgcc.x86_64 0:4.8.5-28.el7_5.1
libgfortran.x86_64 0:4.8.5-28.el7_5.1
libgnat.x86_64 0:4.8.5-28.el7_5.1
libgnat-devel.x86_64 0:4.8.5-28.el7_5.1
libgomp.x86_64 0:4.8.5-28.el7_5.1
libobjc.x86_64 0:4.8.5-28.el7_5.1
libquadmath.x86_64 0:4.8.5-28.el7_5.1
libquadmath-devel.x86_64 0:4.8.5-28.el7_5.1
libstdc++.i686 0:4.8.5-28.el7_5.1
libstdc++.x86_64 0:4.8.5-28.el7_5.1
libstdc++-devel.x86_64 0:4.8.5-28.el7_5.1
Alternatively is to install the whole development tools suite. This can be done with the command
yum groupinstall "Development Tools" --setopt=group_package_types=mandatory,default,optional
Step 2: Test C environment
Create a file hello.c with following contents1: #include<stdio.h>
2: int main()
3: {
4: int a, b, c;
5: printf("Enter two numbers to add: ");
6: scanf("%d %d",&a,&b);
7: c = a + b;
8: printf("The sum is %d\n",c);
9: return 0;
10: }
Open the command line terminal (CLI), compile and run
$ gcc hello.c -o programSum
$ ./programSum
Hint: For larger projects, it will compile faster with ccache. E.g.
$ ccache gcc hello.c -o programSum
Step 3: Install graphical development libraries
Applications that is graphical in nature mostly are group as X11. In order to create some sense of uniformity in the chaos world of Linux, LSB is a standard adopted and through which the use of these libraries ensure better compatibilities of an application across an Linux systems.- libXft is a runtime library. In this case to use the X Free Type Library where drawing of fonts and the application window is defined by LSBfor X11.
- libXinerama is a library to support desktops that run across multiple displays on X11. It is more common to use RandR which does the similar work in more modern applications. In modern systems, libXinerama is an interface to RandR library.
- fontpackages-devel contains templates and macros used to create font packages. The initial problem many years ago is that there were no standard to package fonts. This fedora project library reduces poor quality implementations and allow application developers to focus on their applications better.
sudo yum install -y libXft-devel libXinerama-devel fontpackages-devel
Step 4: Retrieve the source with SRPMS
Create a file getdwm.sh with following contents1: # Download archives from Fedora 22 repository.
2: SOURCE=http://archives.fedoraproject.org/pub/archive/fedora
3: F26=${SOURCE}/linux/releases/26
4: wget ${F26}/Everything/source/tree/Packages/d/dwm-6.1-4.fc26.src.rpm
5: wget ${F26}/Everything/source/tree/Packages/d/dmenu-4.7-1.fc26.src.rpm
6: wget ${F26}/Everything/source/tree/Packages/t/terminus-fonts-4.40-6.fc26.src.rpm
7: wget ${F26}/Everything/source/tree/Packages/s/st-0.7-2.fc26.src.rpm
Save the file and execute.
$ chmod u+x getdwm.sh
$ ./getdwm.sh
Hint: to edit the dwm source, extract the SRPMS then extract dwm-6.1.tar.gz
$ rpm -i dwm-6.1-4.fc26.src.rpm
$ cd ~/rpmbuild/SOURCES
The package dwm-6.1.tar.gz contain the files;
1: BUGS
2: config.def.h
3: config.mk
4: drw.c
5: drw.h
6: dwm.1
7: dwm.c
8: dwm.png
9: LICENSE
10: Makefile
11: README
12: TODO
13: transient.c
14: util.c
15: util.h
Step 4. Build packages and install
$ rpmbuild --rebuild dwm-6.1-4.fc26.src.rpm$ rpmbuild --rebuild dmenu-4.7-1.fc26.src.rpm
$ rpmbuild --rebuild terminus-fonts-4.40-6.fc26.src.rpm
$ rpmbuild --rebuild st-0.7-2.fc26.src.rpm
$ cd ~/rpmbuild/RPMS/SPECS/
$ rpmbuild -ba st.spec
$ cd ~/rpmbuild/RPMS/noarch/
$ sudo yum localinstall -y terminus-fonts-4.40-6.el7.centos.noarch.rpm terminus-fonts-console-4.40-6.el7.centos.noarch.rpm
$ cd ~/rpmbuild/RPMS/x86_64/
$ sudo yum localinstall -y dwm-6.1-4.el7.centos.x86_64.rpm dwm-user-6.1-4.el7.centos.x86_64.rpm dmenu-4.7-1.el7.centos.x86_64.rpm st-0.7-2.el7.centos.x86_64.rpm st-user-0.7-2.el7.centos.x86_64.rpm
The dwm is installed at /usr/bin/dwm and the session is created in a file /usr/share/xsessions/dwm.desktop.
Logout and choose dwm as the window manager to login. Alternatively in xstartup, change the desktop manager to use dwm.
Troubleshoot
If any of the library is not detected during a run or build, ensure that its in the
linux system's path. This can be done by
- Add a file to /etc/ld.so.conf.d that contains path to the library (mine defaults to /usr/lib64/)
1: $ ldd `which dwm`
2: linux-vdso.so.1 => (0x00007ffd1b1b0000)
3: libX11.so.6 => /lib64/libX11.so.6 (0x00007fbf79baf000)
4: libXinerama.so.1 => /lib64/libXinerama.so.1 (0x00007fbf799ac000)
5: libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007fbf7976e000)
6: libXft.so.2 => /lib64/libXft.so.2 (0x00007fbf79558000)
7: libc.so.6 => /lib64/libc.so.6 (0x00007fbf79195000)
8: libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fbf78f6c000)
9: libdl.so.2 => /lib64/libdl.so.2 (0x00007fbf78d68000)
10: libXext.so.6 => /lib64/libXext.so.6 (0x00007fbf78b56000)
11: libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007fbf788af000)
12: libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fbf78685000)
13: libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fbf78469000)
14: libXrender.so.1 => /lib64/libXrender.so.1 (0x00007fbf7825d000)
15: /lib64/ld-linux-x86-64.so.2 (0x000056545bb82000)
16: libXau.so.6 => /lib64/libXau.so.6 (0x00007fbf78059000)
References
http://dwm.suckless.org/tutorial/https://www.hiroom2.com/2016/09/01/install-dwm/#sec-1-3
http://ratfactor.com/dwm.html
https://rhunter.org/blog/2012/04/17/dwm-a-tutorial-for-beginners/
https://wiki.centos.org/HowTos/RebuildSRPM
No comments:
Post a Comment