Skip to content

Commit 226ee63

Browse files
committed
native build
1 parent e6744f9 commit 226ee63

File tree

3 files changed

+234
-0
lines changed

3 files changed

+234
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 System233
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,6 @@ if [ -n "$ENABLE_LIBJXL" ]; then
106106
./build-cmake-dep.sh libjxl -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_BUNDLE_LIBPNG=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_STATIC=$JPEGXL_STATIC
107107
fi
108108

109+
# libvpx AR=lib ARFLAGS= CC=cl CXX=cl LD=link STRIP=false ./configure --as=yasm --disable-optimizations --disable-dependency-tracking --disable-runtime-cpu-detect --disable-thumb --disable-neon
110+
109111
./build-ffmpeg.sh FFmpeg $FF_ARGS

patches/libvpx.patch

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
diff --git a/build/make/Makefile b/build/make/Makefile
2+
index 658b37617..0178828ad 100644
3+
--- a/build/make/Makefile
4+
+++ b/build/make/Makefile
5+
@@ -76,10 +76,16 @@ TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
6+
quiet:=$(if $(or $(verbose), $(V)),, yes)
7+
qexec=$(if $(quiet),@)
8+
9+
+ifeq ($(CONFIG_MSVS),yes)
10+
+ LIB_EXT_NAME:=lib
11+
+else
12+
+ LIB_EXT_NAME:=a
13+
+endif
14+
+
15+
# Cancel built-in implicit rules
16+
%: %.o
17+
%.asm:
18+
-%.a:
19+
+%.$(LIB_EXT_NAME):
20+
%: %.cc
21+
22+
#
23+
@@ -175,7 +181,7 @@ $(BUILD_PFX)%.c.d: %.c
24+
$(BUILD_PFX)%.c.o: %.c
25+
$(if $(quiet),@echo " [CC] $@")
26+
$(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
27+
- $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
28+
+ $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -Fo: $@ $<
29+
30+
$(BUILD_PFX)%.cc.d: %.cc
31+
$(if $(quiet),@echo " [DEP] $@")
32+
@@ -185,7 +191,7 @@ $(BUILD_PFX)%.cc.d: %.cc
33+
$(BUILD_PFX)%.cc.o: %.cc
34+
$(if $(quiet),@echo " [CXX] $@")
35+
$(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
36+
- $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
37+
+ $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -Fo: $@ $<
38+
39+
$(BUILD_PFX)%.cpp.d: %.cpp
40+
$(if $(quiet),@echo " [DEP] $@")
41+
@@ -195,7 +201,7 @@ $(BUILD_PFX)%.cpp.d: %.cpp
42+
$(BUILD_PFX)%.cpp.o: %.cpp
43+
$(if $(quiet),@echo " [CXX] $@")
44+
$(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
45+
- $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
46+
+ $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -Fo: $@ $<
47+
48+
$(BUILD_PFX)%.asm.d: %.asm
49+
$(if $(quiet),@echo " [DEP] $@")
50+
@@ -224,7 +230,7 @@ $(BUILD_PFX)%.S.o: %.S
51+
$(BUILD_PFX)%.c.S: %.c
52+
$(if $(quiet),@echo " [GEN] $@")
53+
$(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
54+
- $(qexec)$(CC) -S $(CFLAGS) -o $@ $<
55+
+ $(qexec)$(CC) -S $(CFLAGS) -Fo: $@ $<
56+
57+
.PRECIOUS: %.asm.S
58+
$(BUILD_PFX)%.asm.S: %.asm
59+
@@ -240,12 +246,12 @@ ifeq ($(HAVE_GNU_STRIP),yes)
60+
# when given --strip-unneeded. Using nm and awk to identify globals and
61+
# keep them caused command line length issues under mingw and segfaults in
62+
# test_libvpx were observed under OS/2: simply use --strip-debug.
63+
-%.a: %_g.a
64+
+%.$(LIB_EXT_NAME): %_g.$(LIB_EXT_NAME)
65+
$(if $(quiet),@echo " [STRIP] $@ < $<")
66+
$(qexec)$(STRIP) --strip-debug \
67+
-o $@ $<
68+
else
69+
-%.a: %_g.a
70+
+%.$(LIB_EXT_NAME): %_g.$(LIB_EXT_NAME)
71+
$(if $(quiet),@echo " [CP] $@ < $<")
72+
$(qexec)cp $< $@
73+
endif
74+
@@ -282,13 +288,13 @@ define linker_template
75+
$(1): $(filter-out -%,$(2))
76+
$(1):
77+
$(if $(quiet),@echo " [LD] $$@")
78+
- $(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
79+
+ $(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -out:$$@ $(2) $(3) $$(extralibs))
80+
endef
81+
define linkerxx_template
82+
$(1): $(filter-out -%,$(2))
83+
$(1):
84+
$(if $(quiet),@echo " [LD] $$@")
85+
- $(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
86+
+ $(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -Fo: $$@ $(2) $(3) $$(extralibs))
87+
endef
88+
# make-3.80 has a bug with expanding large input strings to the eval function,
89+
# which was triggered in some cases by the following component of
90+
@@ -311,7 +317,7 @@ define archive_template
91+
# for creating them.
92+
$(1):
93+
$(if $(quiet),@echo " [AR] $$@")
94+
- $(qexec)$$(AR) $$(ARFLAGS) $$@ $$^
95+
+ $(qexec)$$(AR) $$(ARFLAGS) -out:$$@ $$^
96+
endef
97+
98+
# Don't use -Wl,-z,defs with Clang's sanitizers.
99+
@@ -338,7 +344,7 @@ $(1):
100+
$(qexec)$$(LD) -shared $$(LDFLAGS) \
101+
$(NO_UNDEFINED) \
102+
-Wl,-soname,$$(SONAME) \
103+
- -Wl,--version-script,$$(EXPORTS_FILE) -o $$@ \
104+
+ -Wl,--version-script,$$(EXPORTS_FILE) -out:$$@ \
105+
$$(filter %.o,$$^) $$(extralibs)
106+
endef
107+
108+
@@ -351,7 +357,7 @@ $(1):
109+
$(qexec)$$(LD) -dynamiclib $$(LDFLAGS) \
110+
-exported_symbols_list $$(EXPORTS_FILE) \
111+
-Wl,-headerpad_max_install_names,-compatibility_version,1.0,-current_version,$$(VERSION_MAJOR) \
112+
- -o $$@ \
113+
+ -out:$$@ \
114+
$$(filter %.o,$$^) $$(extralibs)
115+
endef
116+
117+
@@ -362,7 +368,7 @@ define dll_template
118+
$(1):
119+
$(if $(quiet),@echo " [LD] $$@")
120+
$(qexec)$$(LD) -Zdll $$(LDFLAGS) \
121+
- -o $$@ \
122+
+ -out:$$@ \
123+
$$(filter %.o,$$^) $$(extralibs) $$(EXPORTS_FILE)
124+
endef
125+
126+
@@ -421,7 +427,7 @@ clean::
127+
LIBS=$(call enabled,LIBS)
128+
.libs: $(LIBS)
129+
@touch $@
130+
-$(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
131+
+$(foreach lib,$(filter %_g.$(LIB_EXT_NAME),$(LIBS)),$(eval $(call archive_template,$(lib))))
132+
$(foreach lib,$(filter %so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR).$(SO_VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
133+
$(foreach lib,$(filter %$(SO_VERSION_MAJOR).dylib,$(LIBS)),$(eval $(call dl_template,$(lib))))
134+
$(foreach lib,$(filter %$(SO_VERSION_MAJOR).dll,$(LIBS)),$(eval $(call dll_template,$(lib))))
135+
diff --git a/build/make/configure.sh b/build/make/configure.sh
136+
index d1d89aa69..155c43c54 100644
137+
--- a/build/make/configure.sh
138+
+++ b/build/make/configure.sh
139+
@@ -302,33 +302,33 @@ check_cc() {
140+
log check_cc "$@"
141+
cat >${TMP_C}
142+
log_file ${TMP_C}
143+
- check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}
144+
+ check_cmd ${CC} ${CFLAGS} "$@" -c -Fo: ${TMP_O} ${TMP_C}
145+
}
146+
147+
check_cxx() {
148+
log check_cxx "$@"
149+
cat >${TMP_CC}
150+
log_file ${TMP_CC}
151+
- check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC}
152+
+ check_cmd ${CXX} ${CXXFLAGS} "$@" -c -Fo: ${TMP_O} ${TMP_CC}
153+
}
154+
155+
check_cpp() {
156+
log check_cpp "$@"
157+
cat > ${TMP_C}
158+
log_file ${TMP_C}
159+
- check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C}
160+
+ check_cmd ${CC} ${CFLAGS} "$@" -E -Fo: ${TMP_O} ${TMP_C}
161+
}
162+
163+
check_ld() {
164+
log check_ld "$@"
165+
check_cc $@ \
166+
- && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs}
167+
+ && check_cmd ${LD} ${LDFLAGS} "$@" -out:${TMP_X} ${TMP_O} ${extralibs}
168+
}
169+
170+
check_lib() {
171+
log check_lib "$@"
172+
check_cc $@ \
173+
- && check_cmd ${LD} ${LDFLAGS} -o ${TMP_X} ${TMP_O} "$@" ${extralibs}
174+
+ && check_cmd ${LD} ${LDFLAGS} -out:${TMP_X} ${TMP_O} "$@" ${extralibs}
175+
}
176+
177+
check_header(){
178+
@@ -551,7 +551,7 @@ STRIP=${STRIP}
179+
180+
CFLAGS = ${CFLAGS}
181+
CXXFLAGS = ${CXXFLAGS}
182+
-ARFLAGS = -crs\$(if \$(quiet),,v)
183+
+ARFLAGS = ${ARFLAGS}
184+
LDFLAGS = ${LDFLAGS}
185+
ASFLAGS = ${ASFLAGS}
186+
extralibs = ${extralibs}
187+
diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh
188+
index 1e1db05bb..0ba1d590d 100755
189+
--- a/build/make/gen_msvs_vcxproj.sh
190+
+++ b/build/make/gen_msvs_vcxproj.sh
191+
@@ -311,7 +311,8 @@ generate_vcxproj() {
192+
tag_content RootNamespace ${name}
193+
tag_content Keyword ManagedCProj
194+
if [ $vs_ver -ge 12 ] && [ "${platforms[0]}" = "ARM" ]; then
195+
- tag_content AppContainerApplication true
196+
+ :
197+
+ # tag_content AppContainerApplication true
198+
# The application type can be one of "Windows Store",
199+
# "Windows Phone" or "Windows Phone Silverlight". The
200+
# actual value doesn't matter from the libvpx point of view,
201+
@@ -319,8 +320,8 @@ generate_vcxproj() {
202+
# The PlatformToolset field needs to be set in sync with this;
203+
# for Windows Store and Windows Phone Silverlight it should be
204+
# v120 while it should be v120_wp81 if the type is Windows Phone.
205+
- tag_content ApplicationType "Windows Store"
206+
- tag_content ApplicationTypeRevision 8.1
207+
+ # tag_content ApplicationType "Windows Store"
208+
+ # tag_content ApplicationTypeRevision 8.1
209+
fi
210+
if [ "${platforms[0]}" = "ARM64" ]; then
211+
# Require the first Visual Studio version to have ARM64 support.

0 commit comments

Comments
 (0)