Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.41 KB | None | 0 0
  1.  
  2. install_ass() {
  3.   mkdir -p build-$ARCH && cd build-$ARCH
  4.   cat > config.h << EOF
  5. #define _CRT_SECURE_NO_WARNINGS
  6. #define _CRT_NONSTDC_NO_DEPRECATE
  7.  
  8. #define CONFIG_DIRECTWRITE  1
  9. #define CONFIG_RASTERIZER   1
  10. #define CONFIG_HARFBUZZ     1
  11. #define CONFIG_ASM          0
  12.  
  13. #ifdef _M_IX86
  14. #define __i386__
  15. #elif _M_AMD64
  16. #define __x86_64__
  17. #endif
  18. EOF
  19.   cat > dirent.h << 'EOF'
  20. #ifndef DIRENT_INCLUDED
  21. #define DIRENT_INCLUDED
  22.  
  23. /*
  24. Declaration of POSIX directory browsing functions and types for Win32.
  25. Author:  Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
  26. History: Created March 1997. Updated June 2003.
  27. Rights:  See end of file.
  28. */
  29.  
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34.  
  35.     typedef struct DIR DIR;
  36.  
  37.     struct dirent
  38.     {
  39.         char *d_name;
  40.     };
  41.  
  42.     DIR           *opendir(const char *);
  43.     int           closedir(DIR *);
  44.     struct dirent *readdir(DIR *);
  45.     void          rewinddir(DIR *);
  46.  
  47.     /*
  48.     Copyright Kevlin Henney, 1997, 2003. All rights reserved.
  49.     Permission to use, copy, modify, and distribute this software and its
  50.     documentation for any purpose is hereby granted without fee, provided
  51.     that this copyright and permissions notice appear in all copies and
  52.     derivatives.
  53.     This software is supplied "as is" without express or implied warranty.
  54.     But that said, if there are any problems please get in touch.
  55.     */
  56.  
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60.  
  61. #endif
  62. EOF
  63.   cat > dirent.c << 'EOF'
  64. /*
  65. Implementation of POSIX directory browsing functions and types for Win32.
  66. Author:  Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
  67. History: Created March 1997. Updated June 2003 and July 2012.
  68. Rights:  See end of file.
  69. */
  70.  
  71. #define _CRT_SECURE_NO_WARNINGS
  72. #define _CRT_NONSTDC_NO_DEPRECATE
  73.  
  74. #include <dirent.h>
  75. #include <errno.h>
  76. #include <io.h> /* _findfirst and _findnext set errno iff they return -1 */
  77. #include <stdlib.h>
  78. #include <string.h>
  79.  
  80. #ifdef __cplusplus
  81. extern "C"
  82. {
  83. #endif
  84.  
  85.     typedef ptrdiff_t handle_type; /* C99's intptr_t not sufficiently portable */
  86.  
  87.     struct DIR
  88.     {
  89.         handle_type         handle; /* -1 for failed rewind */
  90.         struct _finddata_t  info;
  91.         struct dirent       result; /* d_name null iff first time */
  92.         char                *name;  /* null-terminated char string */
  93.     };
  94.  
  95.     DIR *opendir(const char *name)
  96.     {
  97.         DIR *dir = 0;
  98.  
  99.         if (name && name[0])
  100.         {
  101.             size_t base_length = strlen(name);
  102.             const char *all = /* search pattern must end with suitable wildcard */
  103.                 strchr("/\\", name[base_length - 1]) ? "*" : "/*";
  104.  
  105.             if ((dir = (DIR *)malloc(sizeof *dir)) != 0 &&
  106.                 (dir->name = (char *)malloc(base_length + strlen(all) + 1)) != 0)
  107.             {
  108.                 strcat(strcpy(dir->name, name), all);
  109.  
  110.                 if ((dir->handle =
  111.                     (handle_type)_findfirst(dir->name, &dir->info)) != -1)
  112.                 {
  113.                     dir->result.d_name = 0;
  114.                 }
  115.                 else /* rollback */
  116.                 {
  117.                     free(dir->name);
  118.                     free(dir);
  119.                     dir = 0;
  120.                 }
  121.             }
  122.             else /* rollback */
  123.             {
  124.                 free(dir);
  125.                 dir = 0;
  126.                 errno = ENOMEM;
  127.             }
  128.         }
  129.         else
  130.         {
  131.             errno = EINVAL;
  132.         }
  133.  
  134.         return dir;
  135.     }
  136.  
  137.     int closedir(DIR *dir)
  138.     {
  139.         int result = -1;
  140.  
  141.         if (dir)
  142.         {
  143.             if (dir->handle != -1)
  144.             {
  145.                 result = _findclose(dir->handle);
  146.             }
  147.  
  148.             free(dir->name);
  149.             free(dir);
  150.         }
  151.  
  152.         if (result == -1) /* map all errors to EBADF */
  153.         {
  154.             errno = EBADF;
  155.         }
  156.  
  157.         return result;
  158.     }
  159.  
  160.     struct dirent *readdir(DIR *dir)
  161.     {
  162.         struct dirent *result = 0;
  163.  
  164.         if (dir && dir->handle != -1)
  165.         {
  166.             if (!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
  167.             {
  168.                 result = &dir->result;
  169.                 result->d_name = dir->info.name;
  170.             }
  171.         }
  172.         else
  173.         {
  174.             errno = EBADF;
  175.         }
  176.  
  177.         return result;
  178.     }
  179.  
  180.     void rewinddir(DIR *dir)
  181.     {
  182.         if (dir && dir->handle != -1)
  183.         {
  184.             _findclose(dir->handle);
  185.             dir->handle = (handle_type)_findfirst(dir->name, &dir->info);
  186.             dir->result.d_name = 0;
  187.         }
  188.         else
  189.         {
  190.             errno = EBADF;
  191.         }
  192.     }
  193.  
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197.  
  198. /*
  199. Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved.
  200. Permission to use, copy, modify, and distribute this software and its
  201. documentation for any purpose is hereby granted without fee, provided
  202. that this copyright and permissions notice appear in all copies and
  203. derivatives.
  204. This software is supplied "as is" without express or implied warranty.
  205. But that said, if there are any problems please get in touch.
  206. */
  207. EOF
  208.   sed -i -E "s/const int max_subdiv = ([0-9]+);/#define max_subdiv \\1/g" ../libass/ass_outline.c
  209.   sed -i -E "s/const int n_outlines = ([0-9]+);/#define n_outlines \\1/g" ../libass/ass_render.c
  210.   cl -I $PWD -I $INSTALL_PREFIX/include/freetype2 -I $INSTALL_PREFIX/include/harfbuzz -I $INSTALL_PREFIX/include/fribidi -c \
  211.     dirent.c \
  212.     ../libass/ass.c \
  213.     ../libass/ass_bitmap.c \
  214.     ../libass/ass_blur.c \
  215.     ../libass/ass_cache.c \
  216.     ../libass/ass_directwrite.c \
  217.     ../libass/ass_drawing.c \
  218.     ../libass/ass_font.c \
  219.     ../libass/ass_fontselect.c \
  220.     ../libass/ass_library.c \
  221.     ../libass/ass_outline.c \
  222.     ../libass/ass_parse.c \
  223.     ../libass/ass_rasterizer.c \
  224.     ../libass/ass_rasterizer_c.c \
  225.     ../libass/ass_render.c \
  226.     ../libass/ass_render_api.c \
  227.     ../libass/ass_shaper.c \
  228.     ../libass/ass_string.c \
  229.     ../libass/ass_strtod.c \
  230.     ../libass/ass_utils.c &&
  231.   lib -out:$INSTALL_PREFIX/lib/ass.lib *.obj &&
  232.   mkdir -p $INSTALL_PREFIX/include/ass &&
  233.   cp ../libass/ass.h ../libass/ass_types.h $INSTALL_PREFIX/include/ass &&
  234.   pkgconfig_generate libass $1 -lass
  235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement