ogotoh/spaln

Build issue under arch linux: support for `DESTDIR` flags in `make install`

kbipinkumar opened this issue · 5 comments

i am trying to build and package spaln for BioArchlinux project. i have ran into issues at the actual package creation step. Arch Linux build script relies on gnu make's staged install process to make packages, typically using commands as below

make PREFIX=/usr
make DESTDIR="${pkgdir}"/ install

where pkgdir represents a fakeroot environment into which make will install the files

the build process for spaln doesn't seem to use destdir flags. so my option is to manually copy binaries and any associated libraries into fakeroot for creating installation archive. is it possible to add support for DESTDIR flags so that build/packaging process can automated?

furthermore, the versioning used in tags is causing issues with version checker script used by build server of bioarchlinux project to fetch newest releases as and when released by upstream. for instance, despite 2.4.13f being the latest release the presence of character 'f' causes nvchecker to think its same as version 2.4.13 and fetches the latter. i know there must be specific workflow reason for the project to use characters in versioning. however, it would be of great help if the version numbers only used numbers. for instance 2.4.13.0 for the initial release and 2.4.13.1 for 2.4.13a and as such.

i was able to add support for DESTDIR flag using the attached patch. it would be great if the same can be incorporated into future releases.
destdir.patch

Dear kbipinkumar,

Thank you for your advice. Even in the present setting, you don’t need to manually copy binaries and other files by running ./configure with appropriate options. For example,

$ ./configure --exec_prefix=/usr/pkgdir/install/bin --table_dir=/usr/pkgdir/install/table …
$ make
$ sudo make install

Please run
../configure –help
for more details.

However, it might more convenient if can override PREFIX and DESTDIR at the runtime of make. I want it my homework to modify Makefile.in to incorporate such functionality.

Osamu,

Thank you for your advice. Even in the present setting, you don’t need to manually copy binaries and other files by running ./configure with appropriate options. For example,

$ ./configure --exec_prefix=/usr/pkgdir/install/bin --table_dir=/usr/pkgdir/install/table … $ make $ sudo make install

thanks for the suggestion. i have used this is workaround initially. however, most Linux distros in their packaging guidelines discourage use of staging directory being used as part of --prefix in the compilation step. rather it should be used with make install step as make DESTDIR="${pkgdir}"/ install

As spaln's Makefile.in was simple i was able to add $(DESTDIR) function to it using following patch

--- a/Makefile.in	2023-01-11 17:27:09.000000000 +0530
+++ b/Makefile.in	2023-02-26 23:12:50.488085410 +0530
@@ -53,16 +53,16 @@
 	tar cvf Sources.tar $$Pnm
 
 install:
-	test -d $(exec_prefix) || mkdir -p $(exec_prefix)
-	cp $(PROG) $(exec_prefix)
-	test -d $(table_dir) || mkdir -p $(table_dir)
+	test -d $(DESTDIR)$(exec_prefix) || mkdir -p $(DESTDIR)$(exec_prefix)
+	cp $(PROG) $(DESTDIR)$(exec_prefix)
+	test -d $(DESTDIR)$(table_dir) || mkdir -p $(DESTDIR)$(table_dir)
 	@if test "$(table_dir)" != "$(PWD)/../table"; then \
-		cp -pfR ../table/* $(table_dir); \
+		cp -pfR ../table/* $(DESTDIR)$(table_dir); \
 	fi
-	./makmdm $(table_dir)
-	test -d $(alndbs_dir) || mkdir -p $(alndbs_dir)
+	./makmdm $(DESTDIR)$(table_dir)
+	test -d $(DESTDIR)$(alndbs_dir) || mkdir -p $(DESTDIR)$(alndbs_dir)
 	@if test "$(alndbs_dir)" != "$(PWD)/../seqdb"; then \
-		cp -pfR ../seqdb/????* $(alndbs_dir); \
+		cp -pfR ../seqdb/????* $(DESTDIR)$(alndbs_dir); \
 	fi
 
 uninstall uninst:

Using this patch, the installation can be done using

$ CXX=g++ CFLAGS="-O2" ./configure --exec_prefix=/usr/bin --table_dir=/usr/share/spaln/table --alndbs_dir=/usr/share/spaln/seqdb --use_zlib=1
$ make
$ make DESTDIR="${pkgdir}"/ install # For installation to staging directory
or
$ make install # For local installation

Also look into below request as well

the versioning used in tags is causing issues with version checker script used by build server of bioarchlinux project to fetch newest releases as and when released by upstream. for instance, despite 2.4.13f being the latest release the presence of character 'f' causes nvchecker to think its same as version 2.4.13 and fetches the latter. i know there must be specific workflow reason for the project to use characters in versioning. however, it would be of great help if the version numbers only used numbers. for instance 2.4.13.0 for the initial release and 2.4.13.1 for 2.4.13a and as such.

Thank you very much for your many usufull suggenstions.

I will incorporate your suggestions in future releases. Also, I will try to correct the tag numbers, which are presently irregular in part.

Osamu,