2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2010,2012,2013 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
21 #include <grub/util/misc.h>
22 #include <grub/i18n.h>
23 #include <grub/term.h>
24 #include <grub/macho.h>
25 #include <grub/util/install.h>
35 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
36 #pragma GCC diagnostic ignored "-Wmissing-declarations"
38 #pragma GCC diagnostic error "-Wmissing-prototypes"
39 #pragma GCC diagnostic error "-Wmissing-declarations"
51 static struct argp_option options
[] = {
52 {"input32", '3', N_("FILE"), 0,
53 N_("set input filename for 32-bit part."), 0},
54 {"input64", '6', N_("FILE"), 0,
55 N_("set input filename for 64-bit part."), 0},
56 {"output", 'o', N_("FILE"), 0,
57 N_("set output filename. Default is STDOUT"), 0},
58 {"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
63 argp_parser (int key
, char *arg
, struct argp_state
*state
)
65 /* Get the input argument from argp_parse, which we
66 know is a pointer to our arguments structure. */
67 struct arguments
*arguments
= state
->input
;
72 arguments
->input64
= xstrdup (arg
);
75 arguments
->input32
= xstrdup (arg
);
79 arguments
->output
= xstrdup (arg
);
83 arguments
->verbosity
++;
87 return ARGP_ERR_UNKNOWN
;
93 static struct argp argp
= {
94 options
, argp_parser
, N_("[OPTIONS]"),
95 N_("Glue 32-bit and 64-bit binary into Apple universal one."),
100 main (int argc
, char *argv
[])
102 struct arguments arguments
;
104 grub_util_host_init (&argc
, &argv
);
106 /* Check for options. */
107 memset (&arguments
, 0, sizeof (struct arguments
));
108 if (argp_parse (&argp
, argc
, argv
, 0, 0, &arguments
) != 0)
110 fprintf (stderr
, "%s", _("Error in parsing command line arguments\n"));
114 if (!arguments
.input32
|| !arguments
.input64
)
116 fprintf (stderr
, "%s", _("Missing input file\n"));
120 grub_util_glue_efi (arguments
.input32
,