slang: revert parallelized build
[ipfire-2.x.git] / lfs / grub
1 ###############################################################################
2 #                                                                             #
3 # IPFire.org - A linux based firewall                                         #
4 # Copyright (C) 2007-2018  IPFire Team  <info@ipfire.org>                     #
5 #                                                                             #
6 # This program is free software: you can redistribute it and/or modify        #
7 # it under the terms of the GNU General Public License as published by        #
8 # the Free Software Foundation, either version 3 of the License, or           #
9 # (at your option) any later version.                                         #
10 #                                                                             #
11 # This program is distributed in the hope that it will be useful,             #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
14 # GNU General Public License for more details.                                #
15 #                                                                             #
16 # You should have received a copy of the GNU General Public License           #
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
18 #                                                                             #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER        = 2.02
28
29 THISAPP    = grub-$(VER)
30 DL_FILE    = $(THISAPP).tar.xz
31 DL_FROM    = $(URL_IPFIRE)
32 DIR_APP    = $(DIR_SRC)/$(THISAPP)
33 TARGET     = $(DIR_INFO)/$(THISAPP)
34 SUP_ARCH   = aarch64 x86_64 i586
35
36 # Build for which platforms?
37 ifeq "$(BUILD_ARCH)" "i586"
38         BUILD_PC = 1
39 endif
40
41 ifeq "$(BUILD_ARCH)" "x86_64"
42         BUILD_PC = 1
43 endif
44
45 BUILD_EFI = $(EFI)
46
47 DIR_APP_PC  = $(DIR_APP)-pc
48 DIR_APP_EFI = $(DIR_APP)-efi
49
50 # Don't use our CFLAGS for boot code
51 export HOST_CFLAGS  = $(CFLAGS)
52 export HOST_LDFLAGS = $(LDFLAGS)
53
54 CONFIGURE_ARGS = \
55         --prefix=/usr \
56         --sysconfdir=/etc \
57         --disable-werror
58
59 ###############################################################################
60 # Top-level Rules
61 ###############################################################################
62
63 objects = $(DL_FILE) \
64         unifont-7.0.03.pcf.gz
65
66 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
67 unifont-7.0.03.pcf.gz = $(DL_FROM)/unifont-7.0.03.pcf.gz
68
69 $(DL_FILE)_MD5 = 8a4a2a95aac551fb0fba860ceabfa1d3
70 unifont-7.0.03.pcf.gz_MD5 = f6903ac8c1caeeb30c1e9a2975028401
71
72 install : $(TARGET)
73
74 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
75
76 download :$(patsubst %,$(DIR_DL)/%,$(objects))
77
78 md5 : $(subst %,%_MD5,$(objects))
79
80 ###############################################################################
81 # Downloading, checking, md5sum
82 ###############################################################################
83
84 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
85         @$(CHECK)
86
87 $(patsubst %,$(DIR_DL)/%,$(objects)) :
88         @$(LOAD)
89
90 $(subst %,%_MD5,$(objects)) :
91         @$(MD5)
92
93 ###############################################################################
94 # Installation Details
95 ###############################################################################
96
97 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
98         @$(PREBUILD)
99         @rm -rf $(DIR_APP) $(DIR_APP_EFI) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
100
101         cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-2.02_disable_vga_fallback.patch
102         cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-2.02-xfs-accept-filesystem-with-sparse-inodes.patch
103
104         # Install unifont
105         cp -v $(DIR_DL)/unifont-7.0.03.pcf.gz $(DIR_APP)/unifont.pcf.gz
106
107 ifeq "$(BUILD_EFI)" "1"
108         cp -r $(DIR_APP) $(DIR_APP_EFI)
109         cd $(DIR_APP_EFI) && ./configure $(CONFIGURE_ARGS) \
110                 --with-platform=efi CFLAGS= LDFLAGS=
111         cd $(DIR_APP_EFI) && make $(MAKETUNING)
112         cd $(DIR_APP_EFI) && make install
113 endif
114
115 ifeq "$(BUILD_PC)" "1"
116         cp -r $(DIR_APP) $(DIR_APP_PC)
117         cd $(DIR_APP_PC) && ./configure $(CONFIGURE_ARGS) \
118                 --with-platform=pc CFLAGS= LDFLAGS=
119         cd $(DIR_APP_PC) && make $(MAKETUNING)
120         cd $(DIR_APP_PC) && make install
121
122         # Install empty configuration file
123         -mkdir -pv /boot/grub
124         touch /boot/grub/grub.cfg
125 endif
126
127         # Install background image
128         -mkdir -pv /boot/grub
129         install -m 644 $(DIR_SRC)/config/grub2/splash.png /boot/grub/splash.png
130
131         # Install default configuration
132         -mkdir -pv /etc/default
133         install -m 644 $(DIR_SRC)/config/grub2/default /etc/default/grub
134
135         @rm -rf $(DIR_APP) $(DIR_APP_PC) $(DIR_APP_EFI)
136         @$(POSTBUILD)