a6ee52e6d887b397108d3402c38b0fb4b2d1c876
[pkgsrc.git] / wip / grub2-current / Makefile
1 # $NetBSD$
2 #
3
4 DISTNAME=               grub-bazaar-snapshot
5 PKGNAME=                grub2-${TODAY}
6 CATEGORIES=             sysutils
7
8 MAINTAINER=             gregoire.sutre@gmail.com
9 HOMEPAGE=               http://www.gnu.org/software/grub/grub-2.en.html
10 COMMENT=                GRand Unified Bootloader, version 2 (development snapshot)
11 LICENSE=                gnu-gpl-v3
12
13 PKG_DESTDIR_SUPPORT=    user-destdir
14
15 #
16 # XXX: Linux-*-powerpc and others?
17 #
18 ONLY_FOR_PLATFORM=      *-*-i386 *-*-x86_64
19
20 PKG_SYSCONFSUBDIR=      ${PKGBASE}
21
22 USE_TOOLS+=             autoconf automake gettext-m4
23 USE_TOOLS+=             gmake bison makeinfo
24 GNU_CONFIGURE=          yes
25 CONFIGURE_ARGS+=        --sysconfdir=${PKG_SYSCONFDIR}
26 CONFIGURE_ARGS+=        --program-transform-name=s,grub,grub2,
27 CONFIGURE_ARGS+=        --enable-grub-fstest
28 CONFIGURE_ARGS+=        --disable-efiemu
29 CONFIGURE_ARGS+=        --disable-grub-emu-usb
30 CONFIGURE_ARGS+=        --disable-grub-emu-pci
31 INFO_FILES=             yes
32
33 EGDIR=                  ${PREFIX}/share/examples/${PKGBASE}
34
35 # The modified Makefile installs all configuration scripts in ${EGDIR}.
36 MAKE_ENV+=              EGDIR=${EGDIR}
37
38 .include "../../mk/bsd.prefs.mk"
39
40 EGFILES=                00_header 05_pkgsrc_theme 30_os-prober 40_custom
41 .if ${OPSYS} == "FreeBSD"
42 EGFILES+=               10_kfreebsd
43 .elif ${OPSYS} == "Linux"
44 EGFILES+=               10_linux
45 .elif ${OPSYS} == "NetBSD"
46 EGFILES+=               10_netbsd
47 .endif
48 .for file in ${EGFILES}
49 CONF_FILES_PERMS+=      ${EGDIR}/${file} ${PKG_SYSCONFDIR}/${file} ${ROOT_USER} ${ROOT_GROUP} 0755
50 .endfor
51 CONF_FILES+=            ${EGDIR}/README ${PKG_SYSCONFDIR}/README
52 CONF_FILES+=            ${EGDIR}/default.conf.sample ${PKG_SYSCONFDIR}/default.conf
53
54 TODAY!=                 ${DATE} -u +'%Y%m%d'
55
56 # GRUB 2 current development trunk requires a recent version of gcc.
57 GCC_REQD=               4.3
58
59 #
60 # GRUB 2's configure script sets the variables `target_cpu' and `platform',
61 # which are used to define the location of library directory.  We must take
62 # this into account for PLIST.  The following mimics the behavior of the
63 # configure script.  Our job is simpler as we only accept i386 and x86_64
64 # (see definition of ONLY_FOR_PLATFORM above).
65 #
66 GRUB_TARGET_CPU=        ${MACHINE_ARCH}
67 .if ${LOWER_VENDOR} == "apple"
68 GRUB_PLATFORM=          efi
69 .else
70 GRUB_PLATFORM=          pc
71 .endif
72 .if ${GRUB_TARGET_CPU} == "x86_64" && ${GRUB_PLATFORM} == "pc"
73 GRUB_TARGET_CPU=        i386
74 .endif
75 PLIST_SUBST+=           GRUB_TARGET_CPU=${GRUB_TARGET_CPU}
76 PLIST_SUBST+=           GRUB_PLATFORM=${GRUB_PLATFORM}
77
78 #
79 # The following substitutions adjust the configuration paths:
80 # - $sysconfdir/grub.d is replaced by $sysconfdir in scripts, and by $EGDIR
81 #   in Makefile.in.
82 # - $sysconfdir/default/grub is replaced by $sysconfdir/default.conf in
83 #   scripts.
84 # - DEFAULT_DIRECTORY is adjusted in include/grub/emu/misc.h.
85 #
86 SUBST_CLASSES+=                 fix-paths-1 fix-paths-2 fix-paths-3
87 SUBST_STAGE.fix-paths-1=        pre-configure
88 SUBST_MESSAGE.fix-paths-1=      Fixing configuration paths in makefile.
89 SUBST_FILES.fix-paths-1=        Makefile.in
90 SUBST_SED.fix-paths-1=          -e 's,\$$(sysconfdir)/grub.d,\$$(EGDIR),g'
91 SUBST_STAGE.fix-paths-2=        pre-configure
92 SUBST_MESSAGE.fix-paths-2=      Fixing configuration paths in util/grub-mkconfig.in.
93 SUBST_FILES.fix-paths-2=        util/grub-mkconfig.in
94 SUBST_SED.fix-paths-2=          -e 's,\$${sysconfdir}/grub.d,\$${sysconfdir},g'
95 SUBST_SED.fix-paths-2+=         -e 's,\$${sysconfdir}/default/grub,\$${sysconfdir}/default.conf,g'
96 SUBST_STAGE.fix-paths-3=        pre-configure
97 SUBST_MESSAGE.fix-paths-3=      Fixing default directory in include/grub/emu/misc.h.
98 SUBST_FILES.fix-paths-3=        include/grub/emu/misc.h
99 SUBST_SED.fix-paths-3=          -e 's,"/grub","/grub2",g'
100 SUBST_SED.fix-paths-3+=         -e 's,"/boot/grub","/boot/grub2",g'
101
102 # This package uses help2man to generate man pages.
103 BUILD_DEPENDS+=         help2man>=1.36:../../converters/help2man
104
105 # A recent version of flex is required to build.
106 BUILD_DEPENDS+=         flex>=2.5.35:../../devel/flex
107
108 post-install:
109         ${INSTALL_DATA} ${FILESDIR}/default.conf ${DESTDIR}${EGDIR}/default.conf.sample
110         ${INSTALL_SCRIPT} ${FILESDIR}/05_pkgsrc_theme ${DESTDIR}${EGDIR}/05_pkgsrc_theme
111
112 # Options for this package
113 .include "options.mk"
114
115 # Helper file to access the bazaar repository, download translations and font
116 # files, and generate the configure script with autogen.sh.
117 .include "download.mk"
118
119 .include "../../devel/gettext-lib/buildlink3.mk"
120 .include "../../mk/bsd.pkg.mk"