mesa: build libglsl, standalone compiler didn't works

git-svn-id: svn://kolibrios.org@4518 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2014-01-23 11:18:35 +00:00
parent c7be7bd71e
commit 5c6d4ddc5a
2 changed files with 121 additions and 14 deletions

View File

@ -3,7 +3,7 @@ EGL = egl
CC = gcc
CFLAGS_OPT = -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U_MSC_VER -O2 -march=i686 -msse2
CFLAGS_OPT = -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U_MSC_VER -Os
CFLAGS_OPT+= -fomit-frame-pointer -mno-ms-bitfields
CFLAGS = -c $(CFLAGS_OPT)
@ -12,7 +12,8 @@ LDFLAGS = -nostdlib -shared -s --image-base 0 -T ../newlib/dll.lds --out-implib
STRIP = $(PREFIX)strip
INCLUDES= -I./include -I../libdrm -I../libdrm/include/drm -I./src/egl/main -I./src/gbm/backends/dri -I./src/gbm/main -I../newlib/include
INC_MESA= -I../newlib/include -I./include -I./src -I./src/glsl -I./src/mesa -I./src/mapi
INC_EGL= -I../newlib/include -I./include -I../libdrm -I../libdrm/include/drm -I./src/egl/main -I./src/gbm/backends/dri -I./src/gbm/main
LIBPATH:= -L../../lib
@ -49,12 +50,104 @@ EGL_SRC = \
src/gbm/main/backend.c \
src/gbm/main/gbm.c \
$(NULL)
GLSL_SRC = \
src/glsl/glcpp/glcpp-lex.c \
src/glsl/glcpp/glcpp-parse.c \
src/glsl/glcpp/pp.c \
src/glsl/ast_array_index.cpp \
src/glsl/ast_expr.cpp \
src/glsl/ast_function.cpp \
src/glsl/ast_to_hir.cpp \
src/glsl/ast_type.cpp \
src/glsl/builtin_function.cpp \
src/glsl/builtin_types.cpp \
src/glsl/builtin_variables.cpp \
src/glsl/glsl_lexer.cpp \
src/glsl/glsl_parser.cpp \
src/glsl/glsl_parser_extras.cpp \
src/glsl/glsl_symbol_table.cpp \
src/glsl/glsl_types.cpp \
src/glsl/hir_field_selection.cpp \
src/glsl/ir.cpp \
src/glsl/ir_basic_block.cpp \
src/glsl/ir_builder.cpp \
src/glsl/ir_clone.cpp \
src/glsl/ir_constant_expression.cpp \
src/glsl/ir_expression_flattening.cpp \
src/glsl/ir_function.cpp \
src/glsl/ir_function_can_inline.cpp \
src/glsl/ir_function_detect_recursion.cpp \
src/glsl/ir_hierarchical_visitor.cpp \
src/glsl/ir_hv_accept.cpp \
src/glsl/ir_import_prototypes.cpp \
src/glsl/ir_print_visitor.cpp \
src/glsl/ir_reader.cpp \
src/glsl/ir_rvalue_visitor.cpp \
src/glsl/ir_set_program_inouts.cpp \
src/glsl/ir_validate.cpp \
src/glsl/ir_variable_refcount.cpp \
src/glsl/link_functions.cpp \
src/glsl/link_interface_blocks.cpp \
src/glsl/link_uniform_block_active_visitor.cpp \
src/glsl/link_uniform_blocks.cpp \
src/glsl/link_uniform_initializers.cpp \
src/glsl/link_uniforms.cpp \
src/glsl/link_varyings.cpp \
src/glsl/linker.cpp \
src/glsl/loop_analysis.cpp \
src/glsl/loop_controls.cpp \
src/glsl/loop_unroll.cpp \
src/glsl/lower_clip_distance.cpp \
src/glsl/lower_discard.cpp \
src/glsl/lower_discard_flow.cpp \
src/glsl/lower_if_to_cond_assign.cpp \
src/glsl/lower_instructions.cpp \
src/glsl/lower_jumps.cpp \
src/glsl/lower_mat_op_to_vec.cpp \
src/glsl/lower_named_interface_blocks.cpp \
src/glsl/lower_noise.cpp \
src/glsl/lower_output_reads.cpp \
src/glsl/lower_packed_varyings.cpp \
src/glsl/lower_packing_builtins.cpp \
src/glsl/lower_texture_projection.cpp \
src/glsl/lower_ubo_reference.cpp \
src/glsl/lower_variable_index_to_cond_assign.cpp \
src/glsl/lower_vec_index_to_cond_assign.cpp \
src/glsl/lower_vec_index_to_swizzle.cpp \
src/glsl/lower_vector.cpp \
src/glsl/lower_vector_insert.cpp \
src/glsl/opt_algebraic.cpp \
src/glsl/opt_array_splitting.cpp \
src/glsl/opt_constant_folding.cpp \
src/glsl/opt_constant_propagation.cpp \
src/glsl/opt_constant_variable.cpp \
src/glsl/opt_copy_propagation.cpp \
src/glsl/opt_copy_propagation_elements.cpp \
src/glsl/opt_dead_builtin_varyings.cpp \
src/glsl/opt_dead_code.cpp \
src/glsl/opt_dead_code_local.cpp \
src/glsl/opt_dead_functions.cpp \
src/glsl/opt_flatten_nested_if_blocks.cpp \
src/glsl/opt_flip_matrices.cpp \
src/glsl/opt_function_inlining.cpp \
src/glsl/opt_if_simplification.cpp \
src/glsl/opt_noop_swizzle.cpp \
src/glsl/opt_redundant_jumps.cpp \
src/glsl/opt_structure_splitting.cpp \
src/glsl/opt_swizzle_swizzle.cpp \
src/glsl/opt_tree_grafting.cpp \
src/glsl/ralloc.c \
src/glsl/s_expression.cpp \
src/glsl/strtod.c \
$(NULL)
EGL_OBJS = $(patsubst %.c, %.o, $(EGL_SRC))
EGL_OBJS = $(patsubst %.c, %.o, $(EGL_SRC))
GLSL_OBJS = $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(GLSL_SRC)))
# targets
all:$(EGL).dll
all:$(EGL).dll libglsl.a
$(EGL).dll: $(EGL_OBJS) Makefile
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ egl.def $(EGL_OBJS) $(LIBS)
@ -62,8 +155,21 @@ $(EGL).dll: $(EGL_OBJS) Makefile
# sed -e "s/ @[^ ]*//" egl1.def > egl.def
mv -f $@ ../../bin
mv -f lib$(EGL).dll.a ../../lib
libglsl.a : $(GLSL_OBJS) Makefile
ar cvrs libglsl.a $(GLSL_OBJS)
mv -f libglsl.a ../../lib
src/glsl/glcpp/%.o : src/glsl/glcpp/%.c Makefile
$(CC) $(CFLAGS) -std=c99 $(MESA_DEFS) $(INC_MESA) -o $@ $<
src/glsl/%.o : src/glsl/%.c Makefile
$(CC) $(CFLAGS) -std=c99 $(MESA_DEFS) $(INC_MESA) -o $@ $<
%.o : %.c Makefile
$(CC) $(CFLAGS) $(MESA_DEFS) $(EGL_DEFS) $(INCLUDES) -o $@ $<
$(CC) $(CFLAGS) $(MESA_DEFS) $(EGL_DEFS) $(INC_EGL) -o $@ $<
%.o : %.cpp Makefile
$(CC) $(CFLAGS) $(MESA_DEFS) $(INC_MESA) -o $@ $<

View File

@ -104,10 +104,10 @@ load_text_file(void *ctx, const char *file_name)
}
int glsl_es = 0;
int dump_ast = 0;
int dump_hir = 0;
int dump_lir = 0;
int do_link = 0;
int dump_ast = 1;
int dump_hir = 1;
int dump_lir = 1;
int do_link = 1;
const struct option compiler_opts[] = {
{ "glsl-es", 0, &glsl_es, 1 },
@ -161,13 +161,14 @@ main(int argc, char **argv)
struct gl_context *ctx = &local_ctx;
int c;
int idx = 0;
while ((c = getopt_long(argc, argv, "", compiler_opts, &idx)) != -1)
/* empty */ ;
int idx = 0;
int optind =1;
// while ((c = getopt_long(argc, argv, "", compiler_opts, &idx)) != -1)
// /* empty */ ;
if (argc <= optind)
usage_fail(argv[0]);
// if (argc <= optind)
// usage_fail(argv[0]);
initialize_context(ctx, (glsl_es) ? API_OPENGLES2 : API_OPENGL_COMPAT);