Skip to content

Commit d6482c8

Browse files
authored
Remove embedded files from ports. NFC (#24308)
Embedding these headers inside the python ports files is kind of convenient in that it means each port is described by exactly one file. However, I think the maintenance downsides of embedding one language inside the other and the difficulty with diffing/viewing/updating these files outweighs this benefit.
1 parent 152a6ab commit d6482c8

File tree

15 files changed

+3909
-3917
lines changed

15 files changed

+3909
-3917
lines changed

tools/ports/libjpeg.py

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# found in the LICENSE file.
55

66
import os
7+
import shutil
78

89
VERSION = '9f'
910
HASH = '7f733d79cf176c690dcf127352f9aa7ec48000455944f286faae606cdeada6f6865b4a3f9f01bda8947b5b1089bb3e52d2b56879b6e871279ec5cbd1829304dc'
@@ -21,7 +22,9 @@ def get(ports, settings, shared):
2122

2223
def create(final):
2324
source_path = ports.get_dir('libjpeg', f'jpeg-{VERSION}')
24-
ports.write_file(os.path.join(source_path, 'jconfig.h'), jconfig_h)
25+
jconfig_h = os.path.join(os.path.dirname(__file__), 'libjpeg/jconfig.h')
26+
shutil.copyfile(jconfig_h, os.path.join(source_path, 'jconfig.h'))
27+
2528
ports.install_headers(source_path)
2629
excludes = [
2730
'ansi2knr.c', 'cjpeg.c', 'cjpegalt.c', 'ckconfig.c', 'djpeg.c', 'djpegalt.c', 'example.c',
@@ -39,66 +42,3 @@ def clear(ports, settings, shared):
3942

4043
def show():
4144
return 'libjpeg (-sUSE_LIBJPEG=1 or --use-port=libjpeg; BSD license)'
42-
43-
44-
jconfig_h = '''/* jconfig.h. Generated from jconfig.cfg by configure. */
45-
/* jconfig.cfg --- source file edited by configure script */
46-
/* see jconfig.txt for explanations */
47-
48-
#define HAVE_PROTOTYPES 1
49-
#define HAVE_UNSIGNED_CHAR 1
50-
#define HAVE_UNSIGNED_SHORT 1
51-
/* #undef void */
52-
/* #undef const */
53-
/* #undef CHAR_IS_UNSIGNED */
54-
#define HAVE_STDDEF_H 1
55-
#define HAVE_STDLIB_H 1
56-
#define HAVE_LOCALE_H 1
57-
/* #undef NEED_BSD_STRINGS */
58-
/* #undef NEED_SYS_TYPES_H */
59-
/* #undef NEED_FAR_POINTERS */
60-
/* #undef NEED_SHORT_EXTERNAL_NAMES */
61-
/* Define this if you get warnings about undefined structures. */
62-
/* #undef INCOMPLETE_TYPES_BROKEN */
63-
64-
/* Define "boolean" as unsigned char, not enum, on Windows systems. */
65-
#ifdef _WIN32
66-
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
67-
typedef unsigned char boolean;
68-
#endif
69-
#ifndef FALSE /* in case these macros already exist */
70-
#define FALSE 0 /* values of boolean */
71-
#endif
72-
#ifndef TRUE
73-
#define TRUE 1
74-
#endif
75-
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
76-
#endif
77-
78-
#ifdef JPEG_INTERNALS
79-
80-
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
81-
#define INLINE __inline__
82-
/* These are for configuring the JPEG memory manager. */
83-
/* #undef DEFAULT_MAX_MEM */
84-
/* #undef NO_MKTEMP */
85-
86-
#endif /* JPEG_INTERNALS */
87-
88-
#ifdef JPEG_CJPEG_DJPEG
89-
90-
#define BMP_SUPPORTED /* BMP image file format */
91-
#define GIF_SUPPORTED /* GIF image file format */
92-
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
93-
/* #undef RLE_SUPPORTED */
94-
#define TARGA_SUPPORTED /* Targa image file format */
95-
96-
/* #undef TWO_FILE_COMMANDLINE */
97-
/* #undef NEED_SIGNAL_CATCHER */
98-
/* #undef DONT_USE_B_MODE */
99-
100-
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
101-
/* #undef PROGRESS_REPORT */
102-
103-
#endif /* JPEG_CJPEG_DJPEG */
104-
'''

tools/ports/libjpeg/jconfig.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* jconfig.h. Generated from jconfig.cfg by configure. */
2+
/* jconfig.cfg --- source file edited by configure script */
3+
/* see jconfig.txt for explanations */
4+
5+
#define HAVE_PROTOTYPES 1
6+
#define HAVE_UNSIGNED_CHAR 1
7+
#define HAVE_UNSIGNED_SHORT 1
8+
/* #undef void */
9+
/* #undef const */
10+
/* #undef CHAR_IS_UNSIGNED */
11+
#define HAVE_STDDEF_H 1
12+
#define HAVE_STDLIB_H 1
13+
#define HAVE_LOCALE_H 1
14+
/* #undef NEED_BSD_STRINGS */
15+
/* #undef NEED_SYS_TYPES_H */
16+
/* #undef NEED_FAR_POINTERS */
17+
/* #undef NEED_SHORT_EXTERNAL_NAMES */
18+
/* Define this if you get warnings about undefined structures. */
19+
/* #undef INCOMPLETE_TYPES_BROKEN */
20+
21+
/* Define "boolean" as unsigned char, not enum, on Windows systems. */
22+
#ifdef _WIN32
23+
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
24+
typedef unsigned char boolean;
25+
#endif
26+
#ifndef FALSE /* in case these macros already exist */
27+
#define FALSE 0 /* values of boolean */
28+
#endif
29+
#ifndef TRUE
30+
#define TRUE 1
31+
#endif
32+
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
33+
#endif
34+
35+
#ifdef JPEG_INTERNALS
36+
37+
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
38+
#define INLINE __inline__
39+
/* These are for configuring the JPEG memory manager. */
40+
/* #undef DEFAULT_MAX_MEM */
41+
/* #undef NO_MKTEMP */
42+
43+
#endif /* JPEG_INTERNALS */
44+
45+
#ifdef JPEG_CJPEG_DJPEG
46+
47+
#define BMP_SUPPORTED /* BMP image file format */
48+
#define GIF_SUPPORTED /* GIF image file format */
49+
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
50+
/* #undef RLE_SUPPORTED */
51+
#define TARGA_SUPPORTED /* Targa image file format */
52+
53+
/* #undef TWO_FILE_COMMANDLINE */
54+
/* #undef NEED_SIGNAL_CATCHER */
55+
/* #undef DONT_USE_B_MODE */
56+
57+
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
58+
/* #undef PROGRESS_REPORT */
59+
60+
#endif /* JPEG_CJPEG_DJPEG */

tools/ports/libmodplug.py

Lines changed: 3 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# found in the LICENSE file.
55

66
import os
7+
import shutil
78

89
TAG = '11022021'
910
HASH = 'f770031ad6c2152cbed8c8eab8edf2be1d27f9e74bc255a9930c17019944ee5fdda5308ea992c66a78af9fe1d8dca090f6c956910ce323f8728247c10e44036b'
@@ -21,7 +22,8 @@ def create(final):
2122
src_dir = os.path.join(source_path, 'src')
2223
libmodplug_path = os.path.join(src_dir, 'libmodplug')
2324

24-
ports.write_file(os.path.join(source_path, 'config.h'), config_h)
25+
config_h = os.path.join(os.path.dirname(__file__), 'libmodplug/config.h')
26+
shutil.copyfile(config_h, os.path.join(source_path, 'config.h'))
2527

2628
flags = [
2729
'-Wno-deprecated-register',
@@ -88,141 +90,3 @@ def clear(ports, settings, shared):
8890

8991
def show():
9092
return 'libmodplug (-sUSE_MODPLUG=1 or --use-port=libmodplug; public domain)'
91-
92-
93-
config_h = '''/* src/config.h. Generated from config.h.in by configure. */
94-
/* src/config.h.in. Generated from configure.ac by autoheader. */
95-
96-
/* Define if building universal (internal helper macro) */
97-
/* #undef AC_APPLE_UNIVERSAL_BUILD */
98-
99-
/* Define to 1 if you have the <dlfcn.h> header file. */
100-
#define HAVE_DLFCN_H 1
101-
102-
/* Define to 1 if you have the <inttypes.h> header file. */
103-
#define HAVE_INTTYPES_H 1
104-
105-
/* Define to 1 if you have the <malloc.h> header file. */
106-
#define HAVE_MALLOC_H 1
107-
108-
/* Define to 1 if you have the `setenv' function. */
109-
#define HAVE_SETENV 1
110-
111-
/* Define to 1 if you have the `sinf' function. */
112-
#define HAVE_SINF 1
113-
114-
/* Define to 1 if you have the <stdint.h> header file. */
115-
#define HAVE_STDINT_H 1
116-
117-
/* Define to 1 if you have the <stdio.h> header file. */
118-
#define HAVE_STDIO_H 1
119-
120-
/* Define to 1 if you have the <stdlib.h> header file. */
121-
#define HAVE_STDLIB_H 1
122-
123-
/* Define to 1 if you have the <strings.h> header file. */
124-
#define HAVE_STRINGS_H 1
125-
126-
/* Define to 1 if you have the <string.h> header file. */
127-
#define HAVE_STRING_H 1
128-
129-
/* Define to 1 if you have the <sys/stat.h> header file. */
130-
#define HAVE_SYS_STAT_H 1
131-
132-
/* Define to 1 if you have the <sys/types.h> header file. */
133-
#define HAVE_SYS_TYPES_H 1
134-
135-
/* Define to 1 if you have the <unistd.h> header file. */
136-
#define HAVE_UNISTD_H 1
137-
138-
/* Define to the sub-directory where libtool stores uninstalled libraries. */
139-
#define LT_OBJDIR ".libs/"
140-
141-
/* Name of package */
142-
#define PACKAGE "libmodplug"
143-
144-
/* Define to the address where bug reports for this package should be sent. */
145-
#define PACKAGE_BUGREPORT ""
146-
147-
/* Define to the full name of this package. */
148-
#define PACKAGE_NAME "libmodplug"
149-
150-
/* Define to the full name and version of this package. */
151-
#define PACKAGE_STRING "libmodplug 0.8.9.0"
152-
153-
/* Define to the one symbol short name of this package. */
154-
#define PACKAGE_TARNAME "libmodplug"
155-
156-
/* Define to the home page for this package. */
157-
#define PACKAGE_URL ""
158-
159-
/* Define to the version of this package. */
160-
#define PACKAGE_VERSION "0.8.9.0"
161-
162-
/* Define to 1 if all of the C90 standard headers exist (not just the ones
163-
required in a freestanding environment). This macro is provided for
164-
backward compatibility; new code need not use it. */
165-
#define STDC_HEADERS 1
166-
167-
/* Version number of package */
168-
#define VERSION "0.8.9.0"
169-
170-
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
171-
significant byte first (like Motorola and SPARC, unlike Intel). */
172-
#if defined AC_APPLE_UNIVERSAL_BUILD
173-
# if defined __BIG_ENDIAN__
174-
# define WORDS_BIGENDIAN 1
175-
# endif
176-
#else
177-
# ifndef WORDS_BIGENDIAN
178-
/* # undef WORDS_BIGENDIAN */
179-
# endif
180-
#endif
181-
182-
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
183-
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
184-
#define below would cause a syntax error. */
185-
/* #undef _UINT32_T */
186-
187-
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
188-
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
189-
#define below would cause a syntax error. */
190-
/* #undef _UINT64_T */
191-
192-
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
193-
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
194-
#define below would cause a syntax error. */
195-
/* #undef _UINT8_T */
196-
197-
/* Define to the type of a signed integer type of width exactly 16 bits if
198-
such a type exists and the standard includes do not define it. */
199-
/* #undef int16_t */
200-
201-
/* Define to the type of a signed integer type of width exactly 32 bits if
202-
such a type exists and the standard includes do not define it. */
203-
/* #undef int32_t */
204-
205-
/* Define to the type of a signed integer type of width exactly 64 bits if
206-
such a type exists and the standard includes do not define it. */
207-
/* #undef int64_t */
208-
209-
/* Define to the type of a signed integer type of width exactly 8 bits if such
210-
a type exists and the standard includes do not define it. */
211-
/* #undef int8_t */
212-
213-
/* Define to the type of an unsigned integer type of width exactly 16 bits if
214-
such a type exists and the standard includes do not define it. */
215-
/* #undef uint16_t */
216-
217-
/* Define to the type of an unsigned integer type of width exactly 32 bits if
218-
such a type exists and the standard includes do not define it. */
219-
/* #undef uint32_t */
220-
221-
/* Define to the type of an unsigned integer type of width exactly 64 bits if
222-
such a type exists and the standard includes do not define it. */
223-
/* #undef uint64_t */
224-
225-
/* Define to the type of an unsigned integer type of width exactly 8 bits if
226-
such a type exists and the standard includes do not define it. */
227-
/* #undef uint8_t */
228-
'''

0 commit comments

Comments
 (0)