/[baselayout]/trunk/Makefile
Gentoo

Contents of /trunk/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2911 - (hide annotations) (download)
Mon Sep 24 12:09:43 2007 UTC (6 years, 6 months ago) by uberlord
File size: 3356 byte(s)
Split our rc commands out into general use vs service commands
1 uberlord 2547 # baselayout Makefile
2     # Copyright 2006-2007 Gentoo Foundation
3     # Distributed under the terms of the GNU General Public License v2
4     #
5     # We've moved the installation logic from Gentoo ebuild into a generic
6     # Makefile so that the ebuild is much smaller and more simple.
7     # It also has the added bonus of being easier to install on systems
8     # without an ebuild style package manager.
9    
10     SUBDIRS = conf.d etc init.d man net sh share src
11    
12     NAME = baselayout
13 uberlord 2895 VERSION = 2.0.0_rc5
14 uberlord 2547
15     PKG = $(NAME)-$(VERSION)
16    
17     ifeq ($(OS),)
18     OS=$(shell uname -s)
19     ifneq ($(OS),Linux)
20     OS=BSD
21     endif
22     endif
23    
24 uberlord 2895 BASE_DIRS = $(RC_LIB)/init.d $(RC_LIB)/tmp
25 uberlord 2547 KEEP_DIRS = /boot /home /mnt /root \
26     /usr/local/bin /usr/local/sbin /usr/local/share/doc /usr/local/share/man \
27     /var/lock /var/run
28    
29     ifeq ($(OS),Linux)
30     KEEP_DIRS += /dev /sys
31     NET_LO = net.lo
32     endif
33     ifneq ($(OS),Linux)
34     NET_LO = net.lo0
35     endif
36    
37     TOPDIR = .
38     include $(TOPDIR)/default.mk
39    
40     install::
41     # These dirs may not exist from prior versions
42     for x in $(BASE_DIRS) ; do \
43     $(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
44     touch $(DESTDIR)$$x/.keep || exit $$? ; \
45     done
46     # Don't install runlevels if they already exist
47     if ! test -d $(DESTDIR)/etc/runlevels ; then \
48     (cd runlevels; $(MAKE) install) ; \
49     test -d runlevels.$(OS) && (cd runlevels.$(OS); $(MAKE) install) ; \
50     $(INSTALL_DIR) $(DESTDIR)/etc/runlevels/single || exit $$? ; \
51     $(INSTALL_DIR) $(DESTDIR)/etc/runlevels/nonetwork || exit $$? ; \
52     fi
53 uberlord 2895 ln -snf ../../$(RC_LIB)/sh/net.sh $(DESTDIR)/etc/init.d/$(NET_LO) || exit $$?
54     ln -snf ../../$(RC_LIB)/sh/functions.sh $(DESTDIR)/etc/init.d || exit $$?
55 uberlord 2547 # Handle lib correctly
56     if test $(LIB) != "lib" ; then \
57 uberlord 2895 sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$? ; \
58     rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak ; \
59 uberlord 2911 sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$? ; \
60     rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak ; \
61 uberlord 2547 fi
62    
63     layout:
64     # Create base filesytem layout
65     for x in $(KEEP_DIRS) ; do \
66     $(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
67     touch $(DESTDIR)$$x/.keep || exit $$? ; \
68     done
69     # Special dirs
70     install -m 0700 -d $(DESTDIR)/root || exit $$?
71     touch $(DESTDIR)/root/.keep || exit $$?
72     install -m 1777 -d $(DESTDIR)/var/tmp || exit $$?
73     touch $(DESTDIR)/var/tmp/.keep || exit $$?
74     install -m 1777 -d $(DESTDIR)/tmp || exit $$?
75     touch $(DESTDIR)/tmp/.keep || exit $$?
76     # FHS compatibility symlinks stuff
77     ln -snf /var/tmp $(DESTDIR)/usr/tmp || exit $$?
78     ln -snf share/man $(DESTDIR)/usr/local/man || exit $$?
79    
80 vapier 2601 diststatus:
81 uberlord 2547 if test -d .svn ; then \
82     svnfiles=`svn status 2>&1 | egrep -v '^(U|P)'` ; \
83     if test "x$$svnfiles" != "x" ; then \
84     echo "Refusing to package tarball until svn is in sync:" ; \
85     echo "$$svnfiles" ; \
86     echo "make distforce to force packaging" ; \
87     exit 1 ; \
88     fi \
89     fi
90    
91     distforce:
92 vapier 2600 rm -rf /tmp/$(PKG)
93 vapier 2601 cp -pPR . /tmp/$(PKG)
94 uberlord 2653 $(MAKE) -C /tmp/$(PKG) clean
95     (find /tmp/$(PKG) -type d -name .svn -exec rm -rf {} \; 2>/dev/null; exit 0)
96 vapier 2601 tar -C /tmp -cvjpf /tmp/$(PKG).tar.bz2 $(PKG)
97     rm -rf /tmp/$(PKG)
98 uberlord 2602 ls -l /tmp/$(PKG).tar.bz2
99 vapier 2601
100     distit:
101     rm -rf /tmp/$(PKG)
102 vapier 2599 svn export . /tmp/$(PKG)
103 uberlord 2653 $(MAKE) -C /tmp/$(PKG) clean
104 uberlord 2547 tar -C /tmp -cvjpf /tmp/$(PKG).tar.bz2 $(PKG)
105 vapier 2600 rm -rf /tmp/$(PKG)
106 uberlord 2602 ls -l /tmp/$(PKG).tar.bz2
107 uberlord 2547
108 vapier 2601 dist: diststatus distit
109 uberlord 2547
110 vapier 2601 .PHONY: layout dist distforce distit diststatus
111 vapier 2599
112 uberlord 2547 # vim: set ts=4 :

  ViewVC Help
Powered by ViewVC 1.1.20