summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/packaging/tutorials/basic.mdwn55
1 files changed, 55 insertions, 0 deletions
diff --git a/dev/packaging/tutorials/basic.mdwn b/dev/packaging/tutorials/basic.mdwn
index 395fb58..c98306b 100644
--- a/dev/packaging/tutorials/basic.mdwn
+++ b/dev/packaging/tutorials/basic.mdwn
@@ -437,6 +437,61 @@ You can verify that all files were installed where they should be:
tmp/xmlwf-doc.data/usr/share/man/man1/
tmp/xmlwf-doc.data/usr/share/man/man1/xmlwf.1
+Cleaning Up Installed Files
+---------------------------
+
+There are few things we can do to improve our `build` makefile's `install`
+target.
+
+You may have noticed **oh-installfiles**(1) warn that something hasn't been
+installed:
+
+> oh-installfiles: Warning: Some files have not been installed into packages
+
+With **find**(1), we can see that this is the `libexpat.la` file that GNU
+libtool generated.
+
+ $ find tmp/dest -type f -exec ls -Fd '{}' ';' | sed 's|^tmp/dest||'
+ /usr/lib/core-linux-eglibc/libexpat.la*
+
+We don't need this, and we can simply delete it in the `install` target.
+
+Next, note that some file permissions aren't entirely correct. For example,
+`libexpat.so.1.6.0` is executable, but almost all libraries need not be.
+
+So we can call **oh-fixperms**(1) in our `install` target to automatically set
+correct permissions for us.
+
+Finally, note that the executable and linkable objects are not stripped: they
+contain all of their symbols, including those only needed for debugging.
+
+ $ file tmp/libexpat.1.data/usr/lib/core-linux-eglibc/libexpat.so.1.6.0
+ tmp/libexpat.1.data/usr/lib/core-linux-eglibc/libexpat.so.1.6.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x2d88e36feeb8245bfa2f63f2f0e9a9f8232f6d2c, not stripped
+ $ file tmp/xmlwf.data/usr/bin/xmlwf
+ tmp/xmlwf.data/usr/bin/xmlwf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0xdb5f686930b13b8a5e7519efb446a2da14de9856, not stripped
+
+We can call **oh-strip**(1) in our `install` target to automatically strip
+objects for us.
+
+So our `build` makefile should now look like this:
+
+ #!/usr/bin/make -f
+
+ nop:
+ @:
+
+ build:
+ oh-autoconfigure
+ oh-autobuild
+ touch $@
+
+ install: build
+ oh-autoinstall
+ rm -f 'dest/usr/lib/$(OPK_HOST_ARCH)/libexpat.la'
+ oh-fixperms
+ oh-strip
+ oh-installfiles
+
TODO: Finish.