mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibHTML: Make it possible to build LibHTML on the host.
- "make" builds the normal Serenity libhtml.a - "make -f Makefile.host" builds a test program for the host machine.
This commit is contained in:
parent
04b2082e97
commit
7e1cb86da7
Notes:
sideshowbarker
2024-07-19 13:30:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7e1cb86da7f
12 changed files with 101 additions and 56 deletions
|
@ -31,7 +31,7 @@ template<typename T>
|
|||
struct Traits<T*> {
|
||||
static unsigned hash(const T* p)
|
||||
{
|
||||
return int_hash((dword)p);
|
||||
return int_hash((unsigned)(__PTRDIFF_TYPE__)p);
|
||||
}
|
||||
static void dump(const T* p) { kprintf("%p", p); }
|
||||
};
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
#else
|
||||
#include <stdio.h>
|
||||
#define kprintf printf
|
||||
#define dbgprintf printf
|
||||
#endif
|
||||
|
|
|
@ -9,3 +9,7 @@ int ksprintf(char* buf, const char* fmt, ...);
|
|||
#ifndef USERLAND
|
||||
# define printf dbgprintf
|
||||
#endif
|
||||
|
||||
#ifndef __serenity__
|
||||
#define dbgprintf printf
|
||||
#endif
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#include <AK/Time.h>
|
||||
#include <LibC/errno.h>
|
||||
#include <LibC/fcntl.h>
|
||||
#include <LibC/stdio.h>
|
||||
#include <LibC/stdlib.h>
|
||||
#include <LibC/string.h>
|
||||
#include <LibC/sys/select.h>
|
||||
#include <LibC/sys/socket.h>
|
||||
#include <LibC/sys/time.h>
|
||||
#include <LibC/time.h>
|
||||
#include <LibC/unistd.h>
|
||||
#include <LibCore/CEvent.h>
|
||||
#include <LibCore/CEventLoop.h>
|
||||
#include <LibCore/CLock.h>
|
||||
#include <LibCore/CNotifier.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
//#define CEVENTLOOP_DEBUG
|
||||
//#define DEFERRED_INVOKE_DEBUG
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <LibCore/CFile.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <AK/PrintfImplementation.h>
|
||||
#include <LibCore/CIODevice.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __serenity__
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Types.h>
|
||||
#include <unistd.h>
|
||||
|
@ -109,3 +111,15 @@ private:
|
|||
T m_resource;
|
||||
CLock m_lock;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class CLock {
|
||||
public:
|
||||
CLock() { }
|
||||
~CLock() { }
|
||||
};
|
||||
|
||||
#define LOCKER(x)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/kstdio.h>
|
||||
#include <LibCore/CEvent.h>
|
||||
#include <LibCore/CEventLoop.h>
|
||||
#include <LibCore/CObject.h>
|
||||
|
|
|
@ -1,58 +1,17 @@
|
|||
include ../Makefile.common
|
||||
|
||||
LIBHTML_OBJS = \
|
||||
DOM/Node.o \
|
||||
DOM/ParentNode.o \
|
||||
DOM/Element.o \
|
||||
DOM/Document.o \
|
||||
DOM/Text.o \
|
||||
CSS/Selector.o \
|
||||
CSS/StyleSheet.o \
|
||||
CSS/StyleRule.o \
|
||||
CSS/StyleDeclaration.o \
|
||||
CSS/StyleValue.o \
|
||||
CSS/DefaultStyleSheetSource.o \
|
||||
Parser/HTMLParser.o \
|
||||
Parser/CSSParser.o \
|
||||
Layout/LayoutNode.o \
|
||||
Layout/LayoutText.o \
|
||||
Layout/LayoutBlock.o \
|
||||
Layout/LayoutInline.o \
|
||||
Layout/LayoutDocument.o \
|
||||
Layout/LayoutStyle.o \
|
||||
Frame.o \
|
||||
Dump.o
|
||||
|
||||
GENERATED_SOURCES = \
|
||||
CSS/DefaultStyleSheetSource.cpp
|
||||
|
||||
TEST_OBJS = test.o
|
||||
TEST_PROGRAM = tho
|
||||
|
||||
OBJS = $(LIBHTML_OBJS) $(TEST_OBJS)
|
||||
|
||||
LIBRARY = libhtml.a
|
||||
DEFINES += -DUSERLAND
|
||||
|
||||
all: $(LIBRARY) $(TEST_PROGRAM)
|
||||
all: $(LIBRARY) tho
|
||||
|
||||
CSS/DefaultStyleSheetSource.cpp: CSS/Default.css Scripts/GenerateStyleSheetSource.sh
|
||||
@echo "GENERATE $@"; Scripts/GenerateStyleSheetSource.sh default_stylesheet_source $< > $@
|
||||
include Makefile.shared
|
||||
|
||||
$(TEST_PROGRAM): $(TEST_OBJS) $(LIBRARY)
|
||||
tho: $(TEST_OBJS) $(LIBRARY)
|
||||
$(LD) -o $@ $(LDFLAGS) -L. $(TEST_OBJS) -lhtml -lgui -lcore -lc
|
||||
|
||||
$(LIBRARY): $(LIBHTML_OBJS)
|
||||
@echo "LIB $@"; $(AR) rcs $@ $(LIBHTML_OBJS)
|
||||
|
||||
.cpp.o:
|
||||
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
-include $(OBJS:%.o=%.d)
|
||||
|
||||
clean:
|
||||
@echo "CLEAN"; rm -f $(TEST_PROGRAM) $(LIBRARY) $(OBJS) *.d $(GENERATED_SOURCES)
|
||||
|
||||
install: $(LIBRARY)
|
||||
mkdir -p ../Root/usr/include/LibHTML
|
||||
# Copy headers
|
||||
|
|
20
LibHTML/Makefile.host
Normal file
20
LibHTML/Makefile.host
Normal file
|
@ -0,0 +1,20 @@
|
|||
all: tho
|
||||
|
||||
CXXFLAGS = -W -Wall -O -g -I. -I../ -std=c++17
|
||||
|
||||
EXTRA_OBJS = \
|
||||
../AK/StringImpl.o \
|
||||
../AK/String.o \
|
||||
../AK/StringBuilder.o \
|
||||
../AK/StringView.o \
|
||||
../LibCore/CEventLoop.o \
|
||||
../LibCore/CObject.o \
|
||||
../LibCore/CEvent.o \
|
||||
../LibCore/CIODevice.o \
|
||||
../LibCore/CFile.o
|
||||
|
||||
include Makefile.shared
|
||||
|
||||
tho: $(OBJS)
|
||||
$(CXX) -o $@ $(LDFLAGS) $(OBJS)
|
||||
|
45
LibHTML/Makefile.shared
Normal file
45
LibHTML/Makefile.shared
Normal file
|
@ -0,0 +1,45 @@
|
|||
LIBHTML_OBJS = \
|
||||
DOM/Node.o \
|
||||
DOM/ParentNode.o \
|
||||
DOM/Element.o \
|
||||
DOM/Document.o \
|
||||
DOM/Text.o \
|
||||
CSS/Selector.o \
|
||||
CSS/StyleSheet.o \
|
||||
CSS/StyleRule.o \
|
||||
CSS/StyleDeclaration.o \
|
||||
CSS/StyleValue.o \
|
||||
CSS/DefaultStyleSheetSource.o \
|
||||
Parser/HTMLParser.o \
|
||||
Parser/CSSParser.o \
|
||||
Layout/LayoutNode.o \
|
||||
Layout/LayoutText.o \
|
||||
Layout/LayoutBlock.o \
|
||||
Layout/LayoutInline.o \
|
||||
Layout/LayoutDocument.o \
|
||||
Layout/LayoutStyle.o \
|
||||
Frame.o \
|
||||
Dump.o
|
||||
|
||||
GENERATED_SOURCES = \
|
||||
CSS/DefaultStyleSheetSource.cpp
|
||||
|
||||
TEST_OBJS = test.o
|
||||
TEST_PROGRAM = tho
|
||||
|
||||
OBJS = $(EXTRA_OBJS) $(LIBHTML_OBJS) $(TEST_OBJS)
|
||||
|
||||
LIBRARY = libhtml.a
|
||||
DEFINES += -DUSERLAND
|
||||
|
||||
CSS/DefaultStyleSheetSource.cpp: CSS/Default.css Scripts/GenerateStyleSheetSource.sh
|
||||
@echo "GENERATE $@"; Scripts/GenerateStyleSheetSource.sh default_stylesheet_source $< > $@
|
||||
|
||||
.cpp.o:
|
||||
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
-include $(OBJS:%.o=%.d)
|
||||
|
||||
clean:
|
||||
@echo "CLEAN"; rm -f $(TEST_PROGRAM) $(LIBRARY) $(OBJS) *.d $(GENERATED_SOURCES)
|
||||
|
|
@ -80,7 +80,6 @@ NonnullRefPtr<StyleSheet> parse_css(const String& css)
|
|||
|
||||
auto parse_declaration = [&] {
|
||||
consume_whitespace();
|
||||
|
||||
};
|
||||
|
||||
auto parse_declarations = [&] {
|
||||
|
|
Loading…
Reference in a new issue