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