adapterremoval icon indicating copy to clipboard operation
adapterremoval copied to clipboard

[feature request] Add support for GNU make's staged install via DESTDIR flag

Open kbipinkumar opened this issue 1 year ago • 1 comments

i am trying to package adapterremoval for Bioarchlinux project. arch build system makes use of GNU make's staged install process to create packages.

adapterremoval's Makefile currently do not contain $(DESTDIR) variable needed for staged install. currently we are modifying Makefile with following patch.

install: build/$(PROG)
 	@echo $(COLOR_GREEN)"Installing AdapterRemoval .."$(COLOR_END)
 	@echo $(COLOR_GREEN)"  .. binary into ${PREFIX}/bin/"$(COLOR_END)
-	$(QUIET) $(MKDIR) ${PREFIX}/bin/
-	$(QUIET) $(INSTALLEXE) build/$(PROG) ${PREFIX}/bin/
+	$(QUIET) $(MKDIR) $(DESTDIR)${PREFIX}/bin/
+	$(QUIET) $(INSTALLEXE) build/$(PROG) $(DESTDIR)${PREFIX}/bin/
 
 	@echo $(COLOR_GREEN)"  .. man-page into ${PREFIX}/share/man/man1/"$(COLOR_END)
-	$(QUIET) $(MKDIR) ${PREFIX}/share/man/man1/
-	$(QUIET) $(INSTALLDOC) $(PROG).1 ${PREFIX}/share/man/man1/
+	$(QUIET) $(MKDIR) $(DESTDIR)${PREFIX}/share/man/man1/
+	$(QUIET) $(INSTALLDOC) $(PROG).1 $(DESTDIR)${PREFIX}/share/man/man1/
 
 	@echo $(COLOR_GREEN)"  .. README into ${PREFIX}/share/adapterremoval/"$(COLOR_END)
-	$(QUIET) $(MKDIR) ${PREFIX}/share/adapterremoval/
-	$(QUIET) $(INSTALLDOC) README.md ${PREFIX}/share/adapterremoval/
+	$(QUIET) $(MKDIR) $(DESTDIR)${PREFIX}/share/doc/adapterremoval/
+	$(QUIET) $(INSTALLDOC) README.md $(DESTDIR)${PREFIX}/share/doc/adapterremoval/
 
 	@echo $(COLOR_GREEN)"  .. examples into ${PREFIX}/share/adapterremoval/examples/"$(COLOR_END)
-	$(QUIET) $(MKDIR) ${PREFIX}/share/adapterremoval/examples/
-	$(QUIET) $(INSTALLDAT) examples/*.* ${PREFIX}/share/adapterremoval/examples/
+	$(QUIET) $(MKDIR) $(DESTDIR)${PREFIX}/share/adapterremoval/examples/
+	$(QUIET) $(INSTALLDAT) examples/*.* $(DESTDIR)${PREFIX}/share/adapterremoval/examples/
 
 static: build/$(LIBNAME).a

with the patch applied adapterremoval can be installed to a temporary staging directory for packaging purpose.

is it possible to add $(DESTDIR) flags to Makefile in future releases? This will ease the packaging process for all downstream distributions.

kbipinkumar avatar Apr 02 '23 05:04 kbipinkumar

Hi,

As far as I can tell, you should already be able to accomplish what you want simply by setting the PREFIX variable. You could for example do

make install PREFIX=${DESTDIR}

But do let me know if I've misunderstood what you need.

Cheers

MikkelSchubert avatar Apr 02 '23 08:04 MikkelSchubert