Backed out changeset 0f0edda611cf (bug 1874454) for causing bp-nu bustages in CocoaHe...
[gecko.git] / third_party / jpeg-xl / WORKSPACE
blob4e0e1326bbbe5bc5c6ca41b453b36005b3d39f79
1 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2 load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
4 workspace(name = "libjxl")
6 local_repository(
7     name = "highway",
8     path = "third_party/highway",
11 local_repository(
12     name = "brotli",
13     path = "third_party/brotli",
16 new_local_repository(
17     name = "skcms",
18     build_file_content = """
19 cc_library(
20     name = "skcms",
21     srcs = [
22         "skcms.cc",
23         "src/skcms_internals.h",
24         "src/skcms_Transform.h",
25         "src/Transform_inl.h",
26     ],
27     hdrs = ["skcms.h"],
28     visibility = ["//visibility:public"],
30     """,
31     path = "third_party/skcms",
34 new_git_repository(
35     name = "libjpeg_turbo",
36     build_file_content = """
37 load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
38 SUBSTITUTIONS = {
39     "@BUILD@" : "20230208",
40     "@CMAKE_PROJECT_NAME@" : "libjpeg-turbo",
41     "@COPYRIGHT_YEAR@" : "2023",
42     "@INLINE@" : "__inline__",
43     "@JPEG_LIB_VERSION@" : "62",
44     "@LIBJPEG_TURBO_VERSION_NUMBER@" : "2001091",
45     "@SIZE_T@" : "8",
46     "@THREAD_LOCAL@" : "__thread",
47     "@VERSION@" : "2.1.91",
49 YES_DEFINES = [
50     "C_ARITH_CODING_SUPPORTED", "D_ARITH_CODING_SUPPORTED",
51     "HAVE_BUILTIN_CTZL", "MEM_SRCDST_SUPPORTED"
53 NO_DEFINES = [
54     "WITH_SIMD", "RIGHT_SHIFT_IS_UNSIGNED", "HAVE_INTRIN_H"
56 SUBSTITUTIONS.update({
57     "#cmakedefine " + key : "#define " + key for key in YES_DEFINES
59 SUBSTITUTIONS.update({
60     "#cmakedefine " + key : "// #define " + key for key in NO_DEFINES
63     expand_template(
64         name = "expand_" + src,
65         template = src + ".in",
66         out = src,
67         substitutions = SUBSTITUTIONS,
68         visibility = ["//visibility:public"],
69     ) for src in ["jconfig.h", "jconfigint.h", "jversion.h"]
71 JPEG16_SOURCES = [
72     "jccolor.c",
73     "jcdiffct.c",
74     "jclossls.c",
75     "jcmainct.c",
76     "jcprepct.c",
77     "jcsample.c",
78     "jdcolor.c",
79     "jddiffct.c",
80     "jdlossls.c",
81     "jdmainct.c",
82     "jdmerge.c",
83     "jdpostct.c",
84     "jdsample.c",
85     "jquant1.c",
86     "jquant2.c",
87     "jutils.c",
89 JPEG12_SOURCES = JPEG16_SOURCES + [
90     "jccoefct.c",
91     "jcdctmgr.c",
92     "jdcoefct.c",
93     "jddctmgr.c",
94     "jfdctfst.c",
95     "jfdctint.c",
96     "jidctflt.c",
97     "jidctfst.c",
98     "jidctint.c",
99     "jidctred.c",
101 JPEG_SOURCES = JPEG12_SOURCES + [
102     "jaricom.c",
103     "jcapimin.c",
104     "jcapistd.c",
105     "jcarith.c",
106     "jchuff.c",
107     "jcicc.c",
108     "jcinit.c",
109     "jclhuff.c",
110     "jcmarker.c",
111     "jcmaster.c",
112     "jcomapi.c",
113     "jcparam.c",
114     "jcphuff.c",
115     "jdapimin.c",
116     "jdapistd.c",
117     "jdarith.c",
118     "jdatadst.c",
119     "jdatasrc.c",
120     "jdhuff.c",
121     "jdicc.c",
122     "jdinput.c",
123     "jdlhuff.c",
124     "jdmarker.c",
125     "jdmaster.c",
126     "jdphuff.c",
127     "jdtrans.c",
128     "jerror.c",
129     "jfdctflt.c",
130     "jmemmgr.c",
131     "jmemnobs.c",
133 JPEG_HEADERS = [
134     "jccolext.c",
135     "jchuff.h",
136     "jcmaster.h",
137     "jconfig.h",
138     "jconfigint.h",
139     "jdcoefct.h",
140     "jdcol565.c",
141     "jdcolext.c",
142     "jdct.h",
143     "jdhuff.h",
144     "jdmainct.h",
145     "jdmaster.h",
146     "jdmerge.h",
147     "jdmrg565.c",
148     "jdmrgext.c",
149     "jdsample.h",
150     "jerror.h",
151     "jinclude.h",
152     "jlossls.h",
153     "jmemsys.h",
154     "jmorecfg.h",
155     "jpeg_nbits_table.h",
156     "jpegapicomp.h",
157     "jpegint.h",
158     "jpeglib.h",
159     "jsamplecomp.h",
160     "jsimd.h",
161     "jsimddct.h",
162     "jstdhuff.c",
163     "jversion.h",
165 cc_library(
166     name = "jpeg16",
167     srcs = JPEG16_SOURCES,
168     hdrs = JPEG_HEADERS,
169     local_defines = ["BITS_IN_JSAMPLE=16"],
170     visibility = ["//visibility:public"],
172 cc_library(
173     name = "jpeg12",
174     srcs = JPEG12_SOURCES,
175     hdrs = JPEG_HEADERS,
176     local_defines = ["BITS_IN_JSAMPLE=12"],
177     visibility = ["//visibility:public"],
179 cc_library(
180     name = "jpeg",
181     srcs = JPEG_SOURCES,
182     hdrs = JPEG_HEADERS,
183     deps = [":jpeg16", ":jpeg12"],
184     includes = ["."],
185     visibility = ["//visibility:public"],
187 exports_files([
188     "jmorecfg.h",
189     "jpeglib.h",
191     """,
192     remote = "https://github.com/libjpeg-turbo/libjpeg-turbo.git",
193     tag = "2.1.91",
196 http_archive(
197     name = "gif",
198     build_file_content = """
199 cc_library(
200     name = "gif",
201     srcs = [
202         "dgif_lib.c", "egif_lib.c", "gifalloc.c", "gif_err.c", "gif_font.c",
203         "gif_hash.c", "openbsd-reallocarray.c", "gif_hash.h",
204         "gif_lib_private.h"
205     ],
206     hdrs = ["gif_lib.h"],
207     includes = ["."],
208     visibility = ["//visibility:public"],
210     """,
211     sha256 = "31da5562f44c5f15d63340a09a4fd62b48c45620cd302f77a6d9acf0077879bd",
212     strip_prefix = "giflib-5.2.1",
213     url = "https://netcologne.dl.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz",