XBMC Community Forum
[PATCH] Small patch to provide DESTDIR support to easily make RPM builds - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Development (/forumdisplay.php?fid=93)
+--- Thread: [PATCH] Small patch to provide DESTDIR support to easily make RPM builds (/showthread.php?tid=34516)



[PATCH] Small patch to provide DESTDIR support to easily make RPM builds - anubisg1 - 2008-07-02 20:05

hi, i created that small patch to allow DESTDIR support and than an easy rpm build.

Code:
diff -uNr old-XBMC/Makefile.in XBMC/Makefile.in
--- old-XBMC/Makefile.in    2008-07-02 12:43:09.000000000 +0200
+++ XBMC/Makefile.in    2008-07-02 19:14:46.000000000 +0200
@@ -97,33 +97,33 @@
    $(MAKE) -C tools/XBMCTex/

install-bin: all # developement convenience target
-    sudo cp xbmc.bin $(prefix)/share/xbmc
+    sudo cp xbmc.bin $(DESTDIR)$(prefix)/share/xbmc

install: all install-datas
-    @echo "Copying XBMC binary to $(prefix)/share/xbmc/xbmc.bin"
-    @cp xbmc.bin $(prefix)/share/xbmc/xbmc.bin
-    @mkdir -p $(prefix)/bin
-    @cp tools/Linux/xbmc.sh $(prefix)/bin/xbmc
-    @chmod 755 $(prefix)/bin/xbmc
+    @echo "Copying XBMC binary to $(DESTDIR)$(prefix)/share/xbmc/xbmc.bin"
+    @cp xbmc.bin $(DESTDIR)$(prefix)/share/xbmc/xbmc.bin
+    @mkdir -p $(DESTDIR)$(prefix)/bin
+    @cp tools/Linux/xbmc.sh $(DESTDIR)$(prefix)/bin/xbmc
+    @chmod 755 $(DESTDIR)$(prefix)/bin/xbmc
    @echo "Copying support and legal files,,,"
-    @cp README.linux LICENSE.GPL *.txt xbmc-xrandr $(prefix)/share/xbmc/
+    @cp README.linux LICENSE.GPL *.txt xbmc-xrandr $(DESTDIR)$(prefix)/share/xbmc/
    @echo "Done!"
    @echo "You can run XBMC with the command 'xbmc'"

install-datas: XBMCTex
-    @echo "Creating target directories in $(prefix)/share/xbmc"
-    @find language media screensavers scripts skin sounds userdata visualisations system -type d -not -iregex ".*svn.*" -exec mkdir -p $(prefix)/share/xbmc/"{}" \; -printf " -- %f                           \r"
-    @echo "Copying system files to $(prefix)/share/xbmc"
+    @echo "Creating target directories in $(DESTDIR)$(prefix)/share/xbmc"
+    @find language media screensavers scripts skin sounds userdata visualisations system -type d -not -iregex ".*svn.*" -exec mkdir -p $(DESTDIR)$(prefix)/share/xbmc/"{}" \; -printf " -- %f                           \r"
+    @echo "Copying system files to $(DESTDIR)$(prefix)/share/xbmc"
    @# Arch independent files
-    @find language media screensavers scripts sounds userdata visualisations system -regextype posix-extended -type f -not -iregex ".*svn.*|.*\.so|.*\.dll" -exec cp "{}" $(prefix)/share/xbmc/"{}" \; -printf " -- %f                           \r"
+    @find language media screensavers scripts sounds userdata visualisations system -regextype posix-extended -type f -not -iregex ".*svn.*|.*\.so|.*\.dll" -exec cp "{}" $(DESTDIR)$(prefix)/share/xbmc/"{}" \; -printf " -- %f                           \r"
    @# Arch dependent files
-    @find system -regextype posix-extended -type f -not -iregex ".*svn.*" -iregex ".*@ARCH@.*" -exec cp "{}" $(prefix)/share/xbmc/"{}" \; -printf " -- %f                           \r"
+    @find system -regextype posix-extended -type f -not -iregex ".*svn.*" -iregex ".*@ARCH@.*" -exec cp "{}" $(DESTDIR)$(prefix)/share/xbmc/"{}" \; -printf " -- %f                           \r"
    @# PM3
-    @find skin -regextype posix-extended -type f -not -iregex ".*svn.*|.*\.png|.*\.gif" -exec cp '{}' $(prefix)/share/xbmc/'{}' \; -printf " -- %f                            \r"
+    @find skin -regextype posix-extended -type f -not -iregex ".*svn.*|.*\.png|.*\.gif" -exec cp '{}' $(DESTDIR)$(prefix)/share/xbmc/'{}' \; -printf " -- %f                            \r"

uninstall:
    @echo "Removing XBMC..."
-    @rm -rf $(prefix)/share/xbmc $(prefix)/bin/xbmc
+    @rm -rf $(DESTDIR)$(prefix)/share/xbmc $(DESTDIR)$(prefix)/bin/xbmc
    @echo "Done!"

include Makefile.include

hope to be usefull


- althekiller - 2008-07-02 21:06

Since we don't officially support any RPM based distros, I can't see applying this in its current form. HOWEVER, if you were to provide a patch that implements a new make target (ie. rpm-dist) such that running "make rpm-dist" would do whatever is necessary and then spit out a .rpm, I think we could find a place for it.


- anubisg1 - 2008-07-03 01:19

that patch does not provides nothig special just add the "DESTDIR" variable.

with that one you could install every where you whant..

i.e.

make DESTDIR=/home/myhome/xbmc install

that will install xbmc in /home/myhome/xbmc like it was the root one...

so instead have:

/usr/bin/xbmc
/usr/share/xbmc/*

you'll have

/home/myhome/xbmc/usr/bin/xbmc
/home/myhome/xbmc/usr/share/xbmc/*


destdir is used lots when building rpm because spec tag %makeinstall is the same to write

make DESTDIR=$RPM_BUILD_ROOT install


nothing else.


- wattazoum - 2008-07-03 07:18

This patch is meaningless if you consider doing the same thing using $(prefix)

Code:
make prefix=/home/myhome/xbmc install

which will produce
Code:
/home/myhome/xbmc/bin
/home/myhome/xbmc/share/xbmc

Anyway, be careful about that. You should use
Code:
./configure --prefix=/home/myhome/xbmc
make install

which will also install in
Code:
/home/myhome/xbmc/bin
/home/myhome/xbmc/share/xbmc

but you will be able to run it from /home/myhome/xbmc/bin .
In the first case, if you do :
Code:
./configure --prefix=/usr
make prefix=/home/myhome/xbmc install

you won't be able to run it from /home/myhome/xbmc/bin, cause it has been configured to be run from /usr/bin . if you're trying to do packaging I think you can understand in which case this is useful.