| 1 |
#!/usr/bin/ruby |
| 2 |
# VC8 用の config.h を作るスクリプト |
| 3 |
# Satofumi KAMIMURA |
| 4 |
# $Id$ |
| 5 |
# |
| 6 |
# \todo バージョン番号が更新されるように、package/config.h をリソース元にする |
| 7 |
|
| 8 |
# バージョン情報文字列の抜き出し |
| 9 |
version_str = "X.X.X" |
| 10 |
if ARGV.length < 1 |
| 11 |
print "usage:\n\t" + __FILE__ + " config.h\n" |
| 12 |
exit(1) |
| 13 |
end |
| 14 |
config_file = ARGV[0] |
| 15 |
|
| 16 |
package_name = 'unknown' |
| 17 |
major_version = 0 |
| 18 |
minor_version = 0 |
| 19 |
micro_version = 0 |
| 20 |
File.open(config_file) { |io| |
| 21 |
while line = io.gets |
| 22 |
if line =~ /PACKAGE_VERSION "(.+?)"/ |
| 23 |
version_str = $1 |
| 24 |
|
| 25 |
elsif line =~ /MAJOR_VERSION "([0-9]+)"/ |
| 26 |
major_version = $1 |
| 27 |
|
| 28 |
elsif line =~ /MINOR_VERSION "([0-9]+)"/ |
| 29 |
minor_version = $1 |
| 30 |
|
| 31 |
elsif line =~ /MICRO_VERSION "([0-9]+)"/ |
| 32 |
micro_version = $1 |
| 33 |
|
| 34 |
elsif line =~ /PACKAGE_NAME "(.+?)"/ |
| 35 |
package_name = $1 |
| 36 |
# 指定キーワードのある行を取り出す |
| 37 |
# !!! |
| 38 |
|
| 39 |
end |
| 40 |
end |
| 41 |
} |
| 42 |
|
| 43 |
print <<-"EOB" |
| 44 |
#ifndef CONFIG_H |
| 45 |
#define CONFIG_H |
| 46 |
|
| 47 |
#define HAVE_LIBSDL_TTF 1 |
| 48 |
#define HAVE_LIBSDL_NET 1 |
| 49 |
|
| 50 |
/* Name of package */ |
| 51 |
#define PACKAGE "#{package_name}" |
| 52 |
|
| 53 |
/* Define to the address where bug reports for this package should be sent. */ |
| 54 |
#define PACKAGE_BUGREPORT "satofumi@sourcefoge.jp" |
| 55 |
|
| 56 |
/* Define to the full name of this package. */ |
| 57 |
#define PACKAGE_NAME "#{package_name}" |
| 58 |
|
| 59 |
/* Define to the full name and version of this package. */ |
| 60 |
#define PACKAGE_STRING "#{package_name} #{version_str}" |
| 61 |
|
| 62 |
/* Define to the one symbol short name of this package. */ |
| 63 |
#define PACKAGE_TARNAME "#{package_name}" |
| 64 |
|
| 65 |
/* Define to the version of this package. */ |
| 66 |
#define PACKAGE_VERSION "#{version_str}" |
| 67 |
|
| 68 |
/* Version number of package */ |
| 69 |
#define VERSION "#{version_str}" |
| 70 |
|
| 71 |
/* Major Version */ |
| 72 |
#define MAJOR_VERSION "#{major_version}" |
| 73 |
|
| 74 |
/* Micro Version */ |
| 75 |
#define MICRO_VERSION "#{micro_version}" |
| 76 |
|
| 77 |
/* Minor Version */ |
| 78 |
#define MINOR_VERSION "#{minor_version}" |
| 79 |
|
| 80 |
#endif /* !CONFIG_H */ |
| 81 |
EOB |