forked from XQuartz/XQuartz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·1130 lines (931 loc) · 44.8 KB
/
compile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh -x -e
# Note that the build system needs to be macOS 11.3 or newer, Intel or Apple Silicon
#
# Before building, be sure to checkout sources and configure the system:
#
# 1) Install the latest version of Xcode.
#
# 2) Use the the "install-or-update-macports.sh" script to install autoconf, automake,
# pkgconfig, glibtool, and meson to ${BUILD_TOOLS_PREFIX_STD} and cmake to
# ${BUILD_TOOLS_PREFIX_CMAKE}.
#
# 3) Make sure the ${BUILD_TOOLS_PREFIX_*}/{lib,share}/pkgconfig directories are moved
# aside or they will interfere. The "install-or-update-macports.sh" script will
# manage these directories for you, moving them aside on completion and back on
# future updates.
#
# 4) Setup authentication for notarytool with one of the following options:
# 4a) Create an app-specific password for notarytool at appleid.apple.com. Save this as pkg/notarytool.user and pkg/notarytool.password
# 4b) Create an API Key as documented at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api
# Save this as pkg/notarytool.user and pkg/notarytool.password
#
# 5) Add credential files to the pkg sundirectory:
# pkg/notarytool.* (see #4 above)
# pkg/sparkle_dsa_priv.pem
# pkg/sparkle_eddsa_priv.key
# pkg/github.token (see https://docs.github.com/en/articles/creating-an-access-token-for-command-line-use)
# pkg/github.user
#
# 6) Ensure the macOS keychain contains the private key for our Developer ID certificates
#
# To update a submodule to a newer version, just checkout the appropriate
# branch in the submodule and then commit the changed hash at the top level.
PREFIX=/opt/X11
BUILD_TOOLS_PREFIX_STD="/opt/buildX11"
BUILD_TOOLS_PREFIX_CMAKE="/opt/buildX11-cmake"
APPLICATION_PATH=/Applications/Utilities
IDENTIFIER_PREFIX=org.xquartz
CODESIGN_ASC_PROVIDER="NA574AWV7E"
CODESIGN_IDENTITY_APP="Developer ID Application: Apple Inc. - XQuartz (${CODESIGN_ASC_PROVIDER})"
CODESIGN_IDENTITY_PKG="Developer ID Installer: Apple Inc. - XQuartz (${CODESIGN_ASC_PROVIDER})"
APPLICATION_VERSION=2.8.61
APPLICATION_VERSION_STRING=2.8.6_beta2
SPARKLE_PUBLIC_EDKEY="pgjiBdCBJJg1rSqFR3GtMPXaRKcU9Jjeh6OqfkH4j+8="
if [ "${APPLICATION_VERSION_STRING}" != "${APPLICATION_VERSION_STRING/alpha/}" ] ; then
SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle-r1/alpha.xml"
elif [ "${APPLICATION_VERSION_STRING}" != "${APPLICATION_VERSION_STRING/beta/}" ] ; then
SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle-r1/beta.xml"
elif [ "${APPLICATION_VERSION_STRING}" != "${APPLICATION_VERSION_STRING/rc/}" ] ; then
SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle-r1/rc.xml"
else
SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle-r1/release.xml"
fi
SANITIZER_LIB_DIR_SRC=$(echo $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)
SANITIZER_CFLAGS="-fsanitize=address"
SANITIZER_LIBS="libclang_rt.asan_osx_dynamic.dylib"
SANITIZER_LIB_DIR="${PREFIX}/lib/sanitizers"
SANITIZER_LDFLAGS="-Wl,-rpath,${SANITIZER_LIB_DIR}"
for dylib in ${SANITIZER_LIBS} ; do
SANITIZER_LDFLAGS="${SANITIZER_LDFLAGS} -Wl,${SANITIZER_LIB_DIR}/${dylib}"
done
if [ "${APPLICATION_VERSION_STRING}" != "${APPLICATION_VERSION_STRING/alpha/}" ] ; then
# Alpha builds use ASan
SANITIZER_CONFIGS="EXEC LIB"
OPT_CFLAGS="-O0 -fno-optimize-sibling-calls -fno-omit-frame-pointer"
# ASan requires use to not use -D_FORTIFY_SOURCE=2, or it can lead to false-positives
HARDENING_CFLAGS="-fstack-protector-all"
export MACOSX_DEPLOYMENT_TARGET=10.10
elif [ "${APPLICATION_VERSION_STRING}" != "${APPLICATION_VERSION_STRING/beta/}" ] ; then
# Beta builds use ASan for the main executables
SANITIZER_CONFIGS="EXEC"
# Beta builds use full stack protection and disable optimizations
OPT_CFLAGS="-O0 -fno-optimize-sibling-calls -fno-omit-frame-pointer"
HARDENING_CFLAGS="-fstack-protector-all"
export MACOSX_DEPLOYMENT_TARGET=10.10
else
# Release-candidate and Release builds
OPT_CFLAGS="-Os"
HARDENING_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2"
export MACOSX_DEPLOYMENT_TARGET=10.9
fi
ARCHS_EXEC="arm64 x86_64"
ARCHS_LIB="${ARCHS_EXEC}"
ARCHS_LIB_BINCOMPAT_2_7="x86_64"
if [ -d "/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk" ] ; then
SDKROOT_i386="/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk"
ARCHS_LIB="${ARCHS_LIB} i386"
ARCHS_LIB_BINCOMPAT_2_7="${ARCHS_LIB_BINCOMPAT_2_7} i386"
else
echo "This build will not be distributable due to lack of i386 support."
fi
DEBUG_CFLAGS="-g3 -gdwarf-2"
MAKE="gnumake"
MAKE_OPTS="V=1 -j$(sysctl -n hw.activecpu)"
BASE_DIR=$(pwd)
PRODUCTS_DIR=${BASE_DIR}/products
mkdir -p ${PRODUCTS_DIR}
DESTDIR=${PRODUCTS_DIR}/XQuartz.dest
PKG_ROOT=${PRODUCTS_DIR}/XQuartz.signed
SYM_ROOT=${PRODUCTS_DIR}/XQuartz.symbols
WARNING_CFLAGS="-Werror=unguarded-availability-new -Werror=objc-method-access"
# Don't let startx use openssl from /opt/buildX11 (https://github.com/XQuartz/XQuartz/issues/29)
export ac_cv_path_OPENSSL=/usr/bin/openssl
# timespec_get() was added in macOS 10.15
export ac_cv_func_timespec_get=no
# clock_gettime was added in macOS 10.12
export ac_cv_func_clock_gettime=no
# mkostemp was added in macOS 10.12
export ac_cv_func_mkostemp=no
export XMLTO=${BUILD_TOOLS_PREFIX_STD}/bin/xmlto
export ASCIIDOC=${BUILD_TOOLS_PREFIX_STD}/bin/asciidoc
export DOXYGEN=${BUILD_TOOLS_PREFIX_STD}/bin/doxygen
export FOP=${BUILD_TOOLS_PREFIX_STD}/bin/fop
export FOP_OPTS="-Xmx2048m -Djava.awt.headless=true"
export GROFF=${BUILD_TOOLS_PREFIX_STD}/bin/groff
export PS2PDF=${BUILD_TOOLS_PREFIX_STD}/bin/ps2pdf
export PATH="${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PKG_CONFIG_PATH="${PREFIX}/share/pkgconfig:${PREFIX}/lib/pkgconfig"
export FONTPATH="${PREFIX}/share/fonts/misc/,${PREFIX}/share/fonts/TTF/,${PREFIX}/share/fonts/OTF,${PREFIX}/share/fonts/Type1/,${PREFIX}/share/fonts/75dpi/:unscaled,${PREFIX}/share/fonts/100dpi/:unscaled,${PREFIX}/share/fonts/75dpi/,${PREFIX}/share/fonts/100dpi/,/Library/Fonts,${PREFIX}/share/system_fonts"
export ACLOCAL="aclocal -I ${PREFIX}/share/aclocal -I ${BUILD_TOOLS_PREFIX_STD}/share/aclocal"
die() {
echo "${@}" >&2
exit 1
}
first() {
local all="${@}"
echo "${all%% *}"
}
last() {
local all="${@}"
echo "${all##* }"
}
has() {
local target=${1}
shift || return 1
for s in "${@}"; do
if [ "${target}" == "${s}" ] ; then
return 0
fi
done
return 1
}
remove() {
local target=${1}
local result=""
shift || return 0
for s in "${@}"; do
if [ "${target}" != "${s}" ] ; then
result="${result:+${result} }${s}"
fi
done
echo "${result}"
}
setup_environment() {
local config=${1}
shift
local archs=${@}
local arch_flags="-target fat-apple-macos${MACOSX_DEPLOYMENT_TARGET}"
local sdkdir
for arch in ${archs} ; do
arch_flags="${arch_flags} -arch ${arch}"
done
if has i386 ${archs} ; then
sdkdir=${SDKROOT_i386}
fi
export CPPFLAGS="-I${PREFIX}/include -F${APPLICATION_PATH}/XQuartz.app/Contents/Frameworks -DFAIL_HARD"
export CFLAGS="${sdkdir:+-isysroot ${sdkdir}} ${arch_flags} ${OPT_CFLAGS} ${DEBUG_CFLAGS} ${HARDENING_CFLAGS} ${WARNING_CFLAGS}"
export LDFLAGS="${sdkdir:+-isysroot ${sdkdir}} ${arch_flags} -L${PREFIX}/lib -F${APPLICATION_PATH}/XQuartz.app/Contents/Frameworks"
if ! has i386 ${archs} && has ${config} ${SANITIZER_CONFIGS}; then
export CFLAGS="${CFLAGS} ${SANITIZER_CFLAGS}"
export LDFLAGS="${LDFLAGS} ${SANITIZER_LDFLAGS}"
fi
export CXXFLAGS="${CFLAGS}"
export OBJCFLAGS="${CFLAGS}"
# These are all the same now, but could be conditionalized in the future
export CC="/usr/bin/clang"
export CXX="/usr/bin/clang++"
export OBJC="/usr/bin/clang"
# meson is strict about it's toolchain names, especially relevant when cross-compiling.
# The machine doing the building is the build machine, and the tools
# it uses for the build are CC_FOR_BUILD/CXX_FOR_BUILD
# https://mesonbuild.com/Reference-tables.html#Environment-variables-per-machine
export CC_FOR_BUILD="${CC}"
export CXX_FOR_BUILD="${CXX}"
# For static analysis if we want to do it
#SCAN_BUILD="scan-build-mp-10 -v -V -o clang.d --use-cc=${CC} --use-c++=${CXX}"
}
do_patches() {
local patchdir="${1}"
if [ -d "${patchdir}" -a ! -f "${patchdir}/applied" ] ; then
for patch in "${patchdir}"/* ; do
patch -p1 < "${patch}" || die "Unable to apply patch ${patch}"
done
touch "${patchdir}/applied"
fi
}
# Precondition for all do_*_build():
# $1 is the module to build
#
# Postcondition:
# Object files are left in place.
# Content is installed to DESTDIR and the live filesystem.
#
# Options:
# SCAN_BUILD can be set for static analysis
# SKIP_CLEAN can be set to YES
# SKIP_AUTORECONF can be set to YES
do_autotools_build() {
local project_dir="${BASE_DIR}/${1}"
local config=${2}
local variable="ARCHS_${config}"
local archs=${!variable}
local patches_dir="${project_dir}.patches"
local confopt_file="${project_dir}.confopt"
[ -f "${confopt_file}" ] || confopt_file=/dev/null
cd "${project_dir}" || die "Could not change directory to ${project_dir}"
export PATH="${PREFIX}/bin:${BUILD_TOOLS_PREFIX_STD}/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PROJECT=$(basename $(pwd))
do_patches "${patches_dir}"
case ${PROJECT} in
xterm)
;;
*)
if [ ! -f configure -o "${SKIP_AUTORECONF}" != "YES" ] ; then
# With more recent tools, the m4 directory isn't created and is an error if not present... /shrug
mkdir -p m4
autoreconf -fvi || die "Unable to autoreconf in $(pwd)"
fi
;;
esac
# Cleanup the universal hack directories
sudo rm -rf "${DESTDIR}".lipo.*
if ! has i386 ${archs} ; then
# x86_64 and arm64 can always be built together
do_autotools_build_sub fat ${confopt_file} ${config} ${archs}
elif ! has arm64 ${archs} && ! has ${config} ${SANITIZER_CONFIGS} ; then
# i386 and x86_64 can be built together (against the older SDK) if we
# don't also need an arm64 slice (eg: legacy bincompat dylibs)
do_autotools_build_sub fat ${confopt_file} ${config} ${archs}
else
# We need to build an x86_64 slice along with i386 in order for it to execute on Apple Silico Macs
do_autotools_build_sub noarm "${confopt_file}" ${config} $(remove arm64 ${archs})
do_autotools_build_sub no32 "${confopt_file}" ${config} $(remove i386 ${archs})
do_lipo noarm i386 no32 "$(remove i386 ${archs})"
fi
case ${PROJECT} in
libXaw8|libXp|libXevie|libXfontcache|libxkbui|libXTrap|libXxf86misc)
# These projects exist for bincompat reasons only. Only ship libraries
sudo rm -rf "${DESTDIR}.lipo.fat${PREFIX}/"{bin,include,share,lib/pkgconfig}
for f in ${DESTDIR}.lipo.fat${PREFIX}/lib/* ; do
[ -h "${f}" ] && sudo rm "${f}"
done
;;
esac
# Remove LC_RPATHs that the compiler adds for sanitizers (we set our own)
find "${DESTDIR}.lipo.fat" -type f | while read file ; do
if /usr/bin/file "${file}" | grep -q "Mach-O" ; then
if has ${config} ${SANITIZER_CONFIGS} ; then
sudo install_name_tool -delete_rpath "${SANITIZER_LIB_DIR_SRC}" "${file}" >& /dev/null || true
fi
fi
done
sudo ditto "${DESTDIR}.lipo.fat" "${DESTDIR}"
sudo ditto "${DESTDIR}.lipo.fat" /
# Cleanup the universal hack directories
sudo rm -rf "${DESTDIR}".lipo.*
export PATH="${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
do_autotools_build_sub() {
local set=$1
shift
local confopt_file=${1}
shift
local config=${1}
shift
local archs=${@}
setup_environment ${config} ${archs} || die "Failed to setup environment"
${SCAN_BUILD} ./configure --prefix=${PREFIX} --disable-static --enable-docs --enable-devel-docs --enable-builddocs --with-doxygen --with-xmlto --with-fop $(eval echo $(cat "${confopt_file}")) || die "Could not configure in $(pwd)"
[[ "${SKIP_CLEAN}" == "YES" ]] || ${MAKE} clean || die "Unable to make clean in $(pwd)"
${SCAN_BUILD} ${MAKE} ${MAKE_OPTS} || die "Could not make in $(pwd)"
sudo ${MAKE} install DESTDIR=${DESTDIR}.lipo.${set} || die "Could not make install in $(pwd)"
# Prune the .la files that we don't want
sudo rm -f ${DESTDIR}.lipo.${set}${PREFIX}/lib/*.la
}
# Lipo out multiple ${DESTDIR}.<set> into ${DESTDIR}.fat
# do_lipo <set 1> <archs 1> [... <set n> <archs n>]
do_lipo() {
local sets=""
local archs=""
local input_files=""
# Thin out our sets to just the archs we want from each set.
# This is because we can have x86_64 in both i386+x86_64 and arm64+x86_64
while true ; do
set=$1
shift || break
archs=$1
shift || die "Invalid usage of do_lipo"
sets="${sets} ${set}"
pushd "${DESTDIR}.lipo.${set}"
find . -type f | while read file ; do
if /usr/bin/file "${file}" | grep -q "Mach-O" ; then
for arch in $(lipo -archs "${file}") ; do
if ! has ${arch} ${archs} ; then
sudo lipo -remove ${arch} -output ${file}.lipo_result ${file} || die "lipo failed to remove ${arch} from ${file}"
sudo mv ${file}.lipo_result ${file} || die "failed to move lipo result back"
fi
done
fi
done
popd
done
# Now lipo everything together
sudo cp -a "${DESTDIR}.lipo.$(first ${sets})" "${DESTDIR}.lipo.fat"
pushd "${DESTDIR}.lipo.fat"
find . -type f | while read file ; do
if /usr/bin/file "${file}" | grep -q "Mach-O" ; then
unset input_files
for set in ${sets} ; do
input_files="${input_files} ${DESTDIR}.lipo.${set}/${file}"
done
sudo lipo -create -output "${file}" ${input_files} || die "lipo failed to create ${file}"
fi
done
}
do_meson_build() {
local project_dir="${BASE_DIR}/${1}"
local config=${2}
local variable="ARCHS_${config}"
local archs=${!variable}
local patches_dir="${project_dir}.patches"
local confopt_file="${project_dir}.confopt"
local meson_cross_dir="${BASE_DIR}/meson_support/meson/cross"
[ -f "${confopt_file}" ] || confopt_file=/dev/null
cd "${project_dir}" || die "Could not change directory to ${project_dir}"
export PATH="${PREFIX}/bin:${BUILD_TOOLS_PREFIX_STD}/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PROJECT=$(basename $(pwd))
do_patches "${patches_dir}"
# Cleanup the universal hack directories
sudo rm -rf "${DESTDIR}".lipo.*
# We need to do this hacky dance because of a bug in meson.
# We need to configure meson as a cross compiler to build arm64 from x86_64
# See https://mesonbuild.com/Cross-compilation.html
# https://github.com/mesonbuild/meson/issues/8206
for arch in ${archs} ; do
setup_environment ${config} ${arch} || die "Failed to setup environment"
meson build.${arch} -Dprefix=${PREFIX} $(eval echo $(cat "${confopt_file}")) --cross-file ${meson_cross_dir}/${arch}-darwin-xquartz || die "Could not configure in $(pwd)"
ninja --verbose -C build.${arch} || die "Failed to compile in $(pwd)"
sudo DESTDIR="${DESTDIR}.lipo.${arch}" ninja --verbose -C build.${arch} install || die "Failed to install in $(pwd)"
# Meson removes the LC_RPATH that we asked for. This hack re-adds it
# cf: https://github.com/mesonbuild/meson/issues/11109
if has ${config} ${SANITIZER_CONFIGS} ; then
find "${DESTDIR}.lipo.${arch}" -type f | while read file ; do
if /usr/bin/file "${file}" | grep -q "Mach-O" ; then
sudo install_name_tool -add_rpath "${SANITIZER_LIB_DIR}" "${file}"
fi
done
fi
# Prune the .la files that we don't want
sudo rm -f "${DESTDIR}.lipo.${arch}${PREFIX}/lib"/*.la
done
if [ "$(last ${archs})" == "$(first ${archs})" ] ; then
sudo cp -a "${DESTDIR}.lipo.$(first ${archs})" "${DESTDIR}.lipo.fat"
else
local lipo_args=""
for arch in ${archs} ; do
lipo_args="${lipo_args} ${arch} ${arch}"
done
do_lipo ${lipo_args}
fi
sudo ditto "${DESTDIR}.lipo.fat" "${DESTDIR}"
sudo ditto "${DESTDIR}.lipo.fat" /
# Cleanup the universal hack directories
sudo rm -rf "${DESTDIR}".lipo.*
export PATH="${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
do_cmake_build() {
local project_dir="${BASE_DIR}/${1}"
local config=${2}
local variable="ARCHS_${config}"
local archs=${!variable}
local patches_dir="${project_dir}.patches"
local confopt_file="${project_dir}.confopt"
[ -f "${confopt_file}" ] || confopt_file=/dev/null
cd "${project_dir}" || die "Could not change directory to ${project_dir}"
export PATH="${PREFIX}/bin:${BUILD_TOOLS_PREFIX_CMAKE}/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PROJECT=$(basename $(pwd))
do_patches "${patches_dir}"
# Cleanup the universal hack directories
sudo rm -rf "${DESTDIR}".lipo.*
for arch in ${archs} ; do
setup_environment ${config} ${arch} || die "Failed to setup environment"
mkdir -p "${project_dir}/build.${arch}" || die "Failed to create build directory: ${project_dir}/build.${arch}"
cd "${project_dir}/build.${arch}" || die "Could not change directory to ${project_dir}/build.${arch}"
if [ "${arch}" == "i386" ] ; then
sdkdir=${SDKROOT_i386}
else
sdkdir=$(xcrun --show-sdk-path)
fi
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_NAME_DIR="${PREFIX}/lib" \
-DCMAKE_OSX_ARCHITECTURES="${arch}" \
-DCMAKE_OSX_SYSROOT="${sdkdir}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
$(eval echo $(cat "${confopt_file}")) .. || die "Could not configure in $(pwd)"
${SCAN_BUILD} ${MAKE} ${MAKE_OPTS} VERBOSE=1 || die "Could not make in $(pwd)"
sudo ${MAKE} install DESTDIR=${DESTDIR}.lipo.${arch} VERBOSE=1 || die "Could not make install in $(pwd)"
# Prune the .la files that we don't want
sudo rm -f "${DESTDIR}.lipo.${arch}${PREFIX}/lib"/*.la
done
if [ "$(last ${archs})" == "$(first ${archs})" ] ; then
sudo cp -a "${DESTDIR}.lipo.$(first ${archs})" "${DESTDIR}.lipo.fat"
else
local lipo_args=""
for arch in ${archs} ; do
lipo_args="${lipo_args} ${arch} ${arch}"
done
do_lipo ${lipo_args}
fi
sudo ditto "${DESTDIR}.lipo.fat" "${DESTDIR}"
sudo ditto "${DESTDIR}.lipo.fat" /
# Cleanup the universal hack directories
sudo rm -rf "${DESTDIR}".lipo.*
export PATH="${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
do_checks() {
find "${DESTDIR}" -type f | while read file ; do
if /usr/bin/file "${file}" | grep -q "Mach-O" ; then
if otool -L "${file}" | grep -q "/opt/local" ; then
die "=== ${file} links against an invalid library ==="
fi
if otool -L "${file}" | grep -q "/usr/local" ; then
die "=== ${file} links against an invalid library ==="
fi
if otool -L "${file}" | grep -q "${BUILD_TOOLS_PREFIX_STD}" ; then
die "=== ${file} links against an invalid library ==="
fi
if otool -L "${file}" | grep -q "${BUILD_TOOLS_PREFIX_CMAKE}" ; then
die "=== ${file} links against an invalid library ==="
fi
# Ignore Sparkle since it handles back deployment properly
[ "${file/Sparkle/}" != "${file}" ] && continue
# Ignore mesa for now
[ "${file/swrast_dri.so/}" != "${file}" ] && continue
[ "${file/libOSMesa/}" != "${file}" ] && continue
# Ignore sanitizers
[ "${file/asan/}" != "${file}" ] && continue
[ "${file/ubsan/}" != "${file}" ] && continue
[ "${file/tsan/}" != "${file}" ] && continue
# Ignore libepoll. It uses clock_gettime / CLOCK_MONOTONIC, which was added in macOS 10.12
# libepoll is being added to support wayland development, and we'll probably bump the minimum
# supported version of macOS by the time that actually ships.
[ "${file/epoll}" != "${file}" ] && continue
# Ignore _voucher* symbols (mig) and symbols from libc++ and libobjc that the compiler might have added
if nm -arch x86_64 -m "${file}" | grep -v "_voucher" | grep -v "darwin_check_fd_set_overflow" | grep -v "_pthread_attr_set_qos_class_np" | grep -v "_pthread_mutexattr" | grep -v "from libc++" | grep -v "from libobjc" | grep -q "(undefined) weak external" ; then
die "=== ${file} has a weak link ==="
fi
fi
done
}
do_remove_legacy_protos() {
sudo rm -rf ${DESTDIR}${PREFIX}/include/X11/PM
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/evieproto.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xtrapbits.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xf86rushstr.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xcalibrateproto.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xf86mscstr.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xtrapddmi.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/lgewire.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/Xeviestr.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xtraplib.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/windowswm.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/fontcachstr.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xf86misc.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/fontcache.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xtrapemacros.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/Printstr.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/Print.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/windowswmstr.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xtrapproto.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xf86rush.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xtraplibp.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xcalibratewire.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/xtrapdi.h
sudo rm -f ${DESTDIR}${PREFIX}/include/X11/extensions/fontcacheP.h
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/trapproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/xcalibrateproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/xproxymngproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/fontcacheproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/evieproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/printproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/xf86rushproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/lg3dproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/windowswmproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/pkgconfig/xf86miscproto.pc
sudo rm -f ${DESTDIR}${PREFIX}/share/man/man7/Xprint.7
}
do_strip_sign_dsyms() {
if [ -d "${PKG_ROOT}" ] ; then
sudo rm -rf "${PKG_ROOT}"
fi
if [ -d "${SYM_ROOT}" ] ; then
sudo rm -rf "${SYM_ROOT}"
fi
sudo ditto "${DESTDIR}" "${PKG_ROOT}"
sudo mkdir -p "${SYM_ROOT}"
sudo chown -R root:wheel "${PKG_ROOT}"
find "${PKG_ROOT}/opt/X11" -type f | while read file ; do
if /usr/bin/file "${file}" | grep -q "Mach-O" ; then
sudo dsymutil --out="${SYM_ROOT}"/$(basename "${file}").dSYM "${file}"
sudo cp "${file}" "${SYM_ROOT}"
if [ -z "${SANITIZER_CONFIGS}" ] ; then
sudo strip -S "${file}"
fi
sudo codesign -s "${CODESIGN_IDENTITY_APP}" --digest-algorithm=sha1,sha256 --force --preserve-metadata=entitlements,requirements,flags --identifier "org.xquartz.$(basename "${file}")" --options runtime "${file}"
fi
done
find "${PKG_ROOT}/Applications" -type f | while read file ; do
if /usr/bin/file "${file}" | grep -q "Mach-O" ; then
sudo dsymutil --out="${SYM_ROOT}"/$(basename "${file}").dSYM "${file}"
sudo cp "${file}" "${SYM_ROOT}"
if [ -z "${SANITIZER_CONFIGS}" ] ; then
sudo strip -S "${file}"
fi
fi
done
sudo codesign -s "${CODESIGN_IDENTITY_APP}" --digest-algorithm=sha1,sha256 --deep --force --preserve-metadata=identifier,entitlements,requirements,flags --options runtime "${PKG_ROOT}${APPLICATION_PATH}"/XQuartz.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app
sudo codesign -s "${CODESIGN_IDENTITY_APP}" --digest-algorithm=sha1,sha256 --deep --force --preserve-metadata=identifier,entitlements,requirements,flags --options runtime "${PKG_ROOT}${APPLICATION_PATH}"/XQuartz.app/Contents/Frameworks/Sparkle.framework
sudo codesign -s "${CODESIGN_IDENTITY_APP}" --digest-algorithm=sha1,sha256 --deep --force --preserve-metadata=identifier,entitlements,requirements,flags --options runtime --entitlements ${BASE_DIR}/XQuartz-entitlements.plist "${PKG_ROOT}${APPLICATION_PATH}"/XQuartz.app
}
do_sym_tarball() {
OUTPUT_TARBALL="${BASE_DIR}"/XQuartz-${APPLICATION_VERSION_STRING}.dSYMS.tar.bz2
cd "${SYM_ROOT}"
tar cjf "${OUTPUT_TARBALL}" .
cd "${BASE_DIR}"
}
do_pkg() {
PKG_CONFIG_ROOT="${BASE_DIR}"/pkg
PKG_COMPONENT_PLIST="${PKG_CONFIG_ROOT}"/XQuartzComponent.plist
PKG_REQUIREMENTS_PLIST="${PKG_CONFIG_ROOT}"/XQuartzRequirements.plist
PKG_DISTRIBUTION_PLIST="${PKG_CONFIG_ROOT}"/XQuartzDistribution.plist
PKG_OUTPUT="${BASE_DIR}"/XQuartz-${APPLICATION_VERSION_STRING}.pkg
# Initial configuration created like this and then manually edited:
# pkgbuild --analyze --root "${DESTDIR}" "${PKG_COMPONENT_PLIST}"
pkgbuild --sign "${CODESIGN_IDENTITY_PKG}" --scripts "${PKG_CONFIG_ROOT}"/scripts --root "${PKG_ROOT}" --install-location / --component-plist "${PKG_COMPONENT_PLIST}" "${PKG_CONFIG_ROOT}"/XQuartzComponent.pkg
# Initial configuration created like this and then manually edited:
# productbuild --synthesize --product "${PKG_REQUIREMENTS_PLIST}" --package "${PKG_CONFIG_ROOT}"/XQuartzComponent.pkg "${PKG_DISTRIBUTION_PLIST}"
productbuild --sign "${CODESIGN_IDENTITY_PKG}" --distribution "${PKG_DISTRIBUTION_PLIST}" --resources "${PKG_CONFIG_ROOT}"/resources --package-path "${PKG_CONFIG_ROOT}" "${PKG_OUTPUT}"
rm "${PKG_CONFIG_ROOT}"/XQuartzComponent.pkg
}
do_notarize() {
PKG="${BASE_DIR}"/XQuartz-${APPLICATION_VERSION_STRING}.pkg
NOTARYTOOL_USER_FILE="${BASE_DIR}"/pkg/notarytool.user
NOTARYTOOL_PASS_FILE="${BASE_DIR}"/pkg/notarytool.password
NOTARYTOOL_APIKEY_FILE="${BASE_DIR}"/pkg/notarytool.apiKey
NOTARYTOOL_APIISSUER_FILE="${BASE_DIR}"/pkg/notarytool.apiIssuer
# <rdar://problem/52532145> Latest XQuartz is not notarized
if [ -f "${NOTARYTOOL_APIKEY_FILE}" -a -f "${NOTARYTOOL_APIISSUER_FILE}" ] ; then
NOTARYTOOL_AUTH="--key $(cat "${NOTARYTOOL_APIKEY_FILE}") --issuer $(cat "${NOTARYTOOL_APIISSUER_FILE}")"
elif [ -f "${NOTARYTOOL_USER_FILE}" -a -f "${NOTARYTOOL_PASS_FILE}" ] ; then
NOTARYTOOL_AUTH="--apple-id $(cat "${NOTARYTOOL_USER_FILE}") --password $(cat "${NOTARYTOOL_PASS_FILE}")"
fi
if [ -n "${NOTARYTOOL_AUTH}" ] ; then
xcrun notarytool submit --wait ${NOTARYTOOL_AUTH} --team-id "${CODESIGN_ASC_PROVIDER}" "${PKG}"
xcrun stapler staple "${PKG}"
# Check the disk image with:
# spctl --assess --type open --context context:primary-signature --verbose "${PKG}"
fi
}
do_dist() {
PKG="${BASE_DIR}"/XQuartz-${APPLICATION_VERSION_STRING}.pkg
SYM_TARBALL="${BASE_DIR}"/XQuartz-${APPLICATION_VERSION_STRING}.dSYMS.tar.bz2
openssl sha256 "${PKG}" > "${PKG}".sha256sum
openssl sha512 "${PKG}" > "${PKG}".sha512sum
openssl sha256 "${SYM_TARBALL}" > "${SYM_TARBALL}".sha256sum
openssl sha512 "${SYM_TARBALL}" > "${SYM_TARBALL}".sha512sum
if [ -f "${BASE_DIR}"/pkg/github.user -a -f "${BASE_DIR}"/pkg/github.token ] ; then
local gh_user="$(cat "${BASE_DIR}"/pkg/github.user)"
local gh_token="$(cat "${BASE_DIR}"/pkg/github.token)"
local gh_project=XQuartz
local gh_repo=XQuartz
local tag=XQuartz-${APPLICATION_VERSION_STRING}
local prerelease="false"
if [ "${tag}" != "${tag/alpha/}" ] || [ "${tag}" != "${tag/beta/}" ] || [ "${tag}" != "${tag/rc/}" ] ; then
prerelease="true"
fi
# https://docs.github.com/en/rest/reference/repos#create-a-release
git tag -a ${tag} -m ${tag}
git push -f origin ${tag}
response=$(curl -i -u ${gh_user}:${gh_token} \
-d "{ \
\"tag_name\": \"${tag}\", \
\"name\": \"${tag}\", \
\"body\": \"See https://www.xquartz.org/releases/${tag}.html\", \
\"prerelease\": ${prerelease}, \
\"draft\": true \
}" \
https://api.github.com/repos/${gh_project}/${gh_repo}/releases)
# Get ID
eval $(echo "$response" | grep -m 1 "id.:" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
if [ -z "$id" ] ; then
echo "${response}" >&2
die "Error: Failed to get release id for tag: $tag"
fi
local tmpfile=$(mktemp)
for f in "${PKG}"* "${SYM_TARBALL}"* ; do
echo "Uploading ${f}"
GH_ASSET_URL="https://uploads.github.com/repos/${GH_PROJECT}/${GH_REPO}/releases/${id}/assets?name=$(basename ${f})"
if ! curl -i -u ${gh_user}:${gh_token} \
-o ${tmpfile} \
--progress-bar \
--data-binary @${f} \
-H "Content-Type: application/octet-stream" \
https://uploads.github.com/repos/${gh_project}/${gh_repo}/releases/${id}/assets?name=$(basename ${f}) ; then
cat ${tmpfile} >&2
die "Failed to upload $(basename ${f})."
fi
# The response printed by curl has no newline, so add it here
echo ""
done
rm ${tmpfile}
echo "Visit https://github.com/${gh_project}/${gh_repo}/releases to review / publish the release."
fi
if [ -f "${BASE_DIR}"/pkg/sparkle_dsa_priv.pem -a -f "${BASE_DIR}"/pkg/sparkle_eddsa_priv.key ] ; then
ED_SIG_AND_SIZE=$(${BUILD_TOOLS_PREFIX_STD}/bin/sign_update -f "${BASE_DIR}"/pkg/sparkle_eddsa_priv.key "${PKG}")
echo " <item>"
echo " <sparkle:minimumSystemVersion>${MACOSX_DEPLOYMENT_TARGET}</sparkle:minimumSystemVersion>"
echo " <title>XQuartz-${APPLICATION_VERSION_STRING}</title>"
echo " <sparkle:releaseNotesLink>https://www.xquartz.org/releases/bare/XQuartz-${APPLICATION_VERSION_STRING}.html</sparkle:releaseNotesLink>"
echo " <pubDate>$(date -u +"%a, %d %b %Y %T %Z")</pubDate>"
echo " <enclosure url=\"https://github.com/XQuartz/XQuartz/releases/download/XQuartz-${APPLICATION_VERSION_STRING}/XQuartz-${APPLICATION_VERSION_STRING}.pkg\" sparkle:version=\"${APPLICATION_VERSION}\" sparkle:shortVersionString=\"XQuartz-${APPLICATION_VERSION_STRING}\" type=\"application/octet-stream\" ${ED_SIG_AND_SIZE} sparkle:installationType=\"package\" />"
echo " </item>"
fi
echo "Commits For the release page:"
cd "${BASE_DIR}"
git submodule | egrep -v '(libXt-flatnamespace|xorg/test|Sparkle2x)' | sed 's: *\(.*\) src/\(.*\) (\(.*\)): * \2 \3 (\1):'
}
if [ -d ${BUILD_TOOLS_PREFIX_STD}/share/pkgconfig -o -d ${BUILD_TOOLS_PREFIX_STD}/lib/pkgconfig -o \
-d ${BUILD_TOOLS_PREFIX_CMAKE}/share/pkgconfig -o -d ${BUILD_TOOLS_PREFIX_CMAKE}/lib/pkgconfig ] ; then
die "Ensure that these directories don't exist as they can interfere with the build:
${BUILD_TOOLS_PREFIX_STD}/share/pkgconfig
${BUILD_TOOLS_PREFIX_STD}/lib/pkgconfig
${BUILD_TOOLS_PREFIX_CMAKE}/share/pkgconfig
${BUILD_TOOLS_PREFIX_CMAKE}/lib/pkgconfig"
fi
# TODO: Is there a better way to do this?
if [ ! -f submodules.initialized ] ; then
git submodule init || die "Failed to initialize submodules"
git submodule update || die "Failed to initialize submodules"
git submodule foreach git submodule init || die "Failed to initialize submodules"
git submodule foreach git submodule update || die "Failed to initialize submodules"
touch submodules.initialized
fi
# Install our base configs and other misc content
sudo ditto ${BASE_DIR}/base ${DESTDIR}
sudo ditto ${BASE_DIR}/base /
if [ -n "${SANITIZER_CONFIGS}" ] ; then
sudo install -o root -g wheel -m 0755 -d ${DESTDIR}${SANITIZER_LIB_DIR}
sudo install -o root -g wheel -m 0755 -d ${SANITIZER_LIB_DIR}
for dylib in ${SANITIZER_LIBS} ; do
sudo install -o root -g wheel -m 0755 ${SANITIZER_LIB_DIR_SRC}/${dylib} ${DESTDIR}${SANITIZER_LIB_DIR}
sudo install -o root -g wheel -m 0755 ${SANITIZER_LIB_DIR_SRC}/${dylib} ${SANITIZER_LIB_DIR}
done
fi
# Build Sparkle
cd ${BASE_DIR}/src/Sparkle
do_patches ${BASE_DIR}/src/Sparkle.patches
xcodebuild install -configuration Release \
ARCHS="${ARCHS_EXEC}" \
DSTROOT="${DESTDIR}.Sparkle" \
INSTALL_PATH="${APPLICATION_PATH}/XQuartz.app/Contents/Frameworks" \
DYLIB_INSTALL_NAME_BASE="@executable_path/../Frameworks" \
MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
DEAD_CODE_STRIPPING=NO \
GCC_GENERATE_DEBUGGING_SYMBOLS=YES
sudo ditto ${DESTDIR}.Sparkle ${DESTDIR}
sudo ditto ${DESTDIR}.Sparkle /
# Bincompat versions of libpng
do_autotools_build src/libpng/libpng12 LIB_BINCOMPAT_2_7
do_autotools_build src/libpng/libpng14 LIB_BINCOMPAT_2_7
do_autotools_build src/libpng/libpng15 LIB_BINCOMPAT_2_7
sudo rm -f {${DESTDIR}${PREFIX},${PREFIX}}/bin/libpng*-config
sudo rm -f {${DESTDIR}${PREFIX},${PREFIX}}/lib/libpng1?.dylib
sudo rm -f {${DESTDIR}${PREFIX},${PREFIX}}/lib/libpng12.0.*.dylib
sudo rm -f {${DESTDIR}${PREFIX},${PREFIX}}/lib/libpng.3.*.0.dylib
do_autotools_build src/libpng/libpng16 LIB
do_cmake_build src/epoll-shim EXEC
do_meson_build src/freetype2 LIB
do_meson_build src/pixman LIB
do_meson_build src/fontconfig LIB
do_autotools_build src/xorg/util/macros EXEC
do_autotools_build src/xorg/doc/xorg-docs EXEC
do_autotools_build src/xorg/doc/xorg-sgml-doctools EXEC
do_meson_build src/xorg/proto/xorgproto EXEC
do_autotools_build src/xorg/proto/xcbproto EXEC
do_autotools_build src/xorg/util/bdftopcf EXEC
do_autotools_build src/xorg/util/lndir EXEC
do_autotools_build src/xorg/font/util LIB
do_autotools_build src/xorg/lib/libxtrans LIB
do_autotools_build src/xorg/lib/pthread-stubs LIB
do_autotools_build src/xorg/lib/libXau LIB
do_autotools_build src/xorg/lib/libxcb LIB
do_autotools_build src/xorg/lib/libxcb-util LIB
do_autotools_build src/xorg/lib/libxcb-render-util LIB
do_autotools_build src/xorg/lib/libxcb-image LIB
do_autotools_build src/xorg/lib/libxcb-cursor LIB
do_autotools_build src/xorg/lib/libxcb-errors LIB
do_autotools_build src/xorg/lib/libxcb-keysyms LIB
do_autotools_build src/xorg/lib/libxcb-wm LIB
do_autotools_build src/xorg/lib/libXdmcp LIB
do_autotools_build src/xorg/lib/libX11 LIB
do_autotools_build src/xorg/lib/libXext LIB
do_autotools_build src/xorg/lib/libAppleWM LIB
do_autotools_build src/xorg/lib/libdmx LIB
do_autotools_build src/xorg/lib/libfontenc LIB
do_autotools_build src/xorg/lib/libxshmfence LIB
do_autotools_build src/xorg/lib/libFS LIB
do_autotools_build src/xorg/lib/libICE LIB
do_autotools_build src/xorg/lib/libSM LIB
# Bincompat
do_autotools_build src/xorg/lib/libXt-flatnamespace LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/lib/libXt7-stub LIB_BINCOMPAT_2_7
sudo install -o root -g wheel -m 0755 -d ${DESTDIR}${PREFIX}/lib/flat_namespace
sudo mv ${DESTDIR}${PREFIX}/lib/libXt.6.dylib ${DESTDIR}${PREFIX}/lib/flat_namespace
sudo install -o root -g wheel -m 0755 -d ${PREFIX}/lib/flat_namespace
sudo mv ${PREFIX}/lib/libXt.6.dylib ${PREFIX}/lib/flat_namespace
do_autotools_build src/xorg/lib/libXt LIB
do_autotools_build src/xorg/lib/libXmu LIB
do_autotools_build src/xorg/lib/libXpm LIB
# Bincompat
do_autotools_build src/xorg/lib/libXaw8 LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/lib/libXaw LIB
do_autotools_build src/xorg/lib/libXaw3d LIB
do_autotools_build src/xorg/lib/libXfixes LIB
do_autotools_build src/xorg/lib/libXcomposite LIB
do_autotools_build src/xorg/lib/libXrender LIB
do_autotools_build src/xorg/lib/libXdamage LIB
do_autotools_build src/xorg/lib/libXcursor LIB
do_autotools_build src/xorg/lib/libXfont LIB
do_autotools_build src/xorg/lib/libXfont2 LIB
do_autotools_build src/xorg/lib/libXxf86vm LIB
do_autotools_build src/xorg/lib/libXft LIB
do_autotools_build src/xorg/lib/libXi LIB
do_autotools_build src/xorg/lib/libXinerama LIB
do_autotools_build src/xorg/lib/libxkbfile LIB
do_autotools_build src/xorg/lib/libXrandr LIB
do_autotools_build src/xorg/lib/libXpresent LIB
do_autotools_build src/xorg/lib/libXres LIB
do_autotools_build src/xorg/lib/libXScrnSaver LIB
do_autotools_build src/xorg/lib/libXtst LIB
do_autotools_build src/xorg/lib/libXv LIB
do_meson_build src/xorg/lib/libXvMC LIB
do_meson_build src/xorg/lib/libxcvt LIB
# Bincompat
do_autotools_build src/xorg/lib/libxkbui LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/lib/libXp LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/lib/libXevie LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/lib/libXfontcache LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/lib/libXTrap LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/lib/libXxf86misc LIB_BINCOMPAT_2_7
do_autotools_build src/xorg/data/bitmaps EXEC
do_autotools_build src/xorg/app/appres EXEC
do_autotools_build src/xorg/app/bitmap EXEC
do_autotools_build src/xorg/app/editres EXEC
do_autotools_build src/xorg/app/fonttosfnt EXEC
do_autotools_build src/xorg/app/fslsfonts EXEC
do_autotools_build src/xorg/app/fstobdf EXEC
do_autotools_build src/xorg/app/iceauth EXEC
do_autotools_build src/xorg/app/ico EXEC
do_autotools_build src/xorg/app/listres EXEC
do_autotools_build src/xorg/app/luit EXEC
do_autotools_build src/xorg/app/mkfontscale EXEC
do_autotools_build src/xorg/app/oclock EXEC
do_autotools_build src/xorg/app/quartz-wm EXEC
do_autotools_build src/xorg/app/rgb EXEC
do_autotools_build src/xorg/app/sessreg EXEC
do_autotools_build src/xorg/app/setxkbmap EXEC
do_autotools_build src/xorg/app/showfont EXEC
do_autotools_build src/xorg/app/smproxy EXEC
do_autotools_build src/xorg/app/twm EXEC
do_autotools_build src/xorg/app/viewres EXEC
do_autotools_build src/xorg/app/xauth EXEC
do_autotools_build src/xorg/app/xbacklight EXEC
do_autotools_build src/xorg/app/xcalc EXEC
do_autotools_build src/xorg/app/xclipboard EXEC
do_autotools_build src/xorg/app/xclock EXEC
do_autotools_build src/xorg/app/xcmsdb EXEC
do_autotools_build src/xorg/app/xcompmgr EXEC
do_autotools_build src/xorg/app/xconsole EXEC
do_autotools_build src/xorg/app/xcursorgen EXEC
do_autotools_build src/xorg/app/xditview EXEC
do_autotools_build src/xorg/app/xdm EXEC
do_autotools_build src/xorg/app/xdpyinfo EXEC
do_autotools_build src/xorg/app/xedit EXEC
do_autotools_build src/xorg/app/xev EXEC
do_autotools_build src/xorg/app/xeyes EXEC
do_autotools_build src/xorg/app/xfd EXEC
do_autotools_build src/xorg/app/xfontsel EXEC
do_autotools_build src/xorg/app/xfs EXEC
do_autotools_build src/xorg/app/xfsinfo EXEC
do_autotools_build src/xorg/app/xgamma EXEC
do_autotools_build src/xorg/app/xgc EXEC
do_autotools_build src/xorg/app/xhost EXEC
do_autotools_build src/xorg/app/xinit EXEC
do_autotools_build src/xorg/app/xinput EXEC
do_autotools_build src/xorg/app/xkbcomp EXEC
do_autotools_build src/xorg/app/xkbevd EXEC
do_autotools_build src/xorg/app/xkbprint EXEC
do_autotools_build src/xorg/app/xkbutils EXEC
do_autotools_build src/xorg/app/xkill EXEC
do_autotools_build src/xorg/app/xload EXEC
do_autotools_build src/xorg/app/xlogo EXEC
do_autotools_build src/xorg/app/xlsatoms EXEC
do_autotools_build src/xorg/app/xlsclients EXEC
do_autotools_build src/xorg/app/xlsfonts EXEC
do_autotools_build src/xorg/app/xmag EXEC
do_autotools_build src/xorg/app/xman EXEC
do_autotools_build src/xorg/app/xmessage EXEC
do_autotools_build src/xorg/app/xmh EXEC
do_autotools_build src/xorg/app/xmodmap EXEC
do_autotools_build src/xorg/app/xmore EXEC
do_autotools_build src/xorg/app/xpr EXEC
do_autotools_build src/xorg/app/xprop EXEC
do_autotools_build src/xorg/app/xrandr EXEC
do_autotools_build src/xorg/app/xrdb EXEC